+
    œ°³jÂ1  ã                   óØ   € ^ RI t^RIHt ^RIHt ^RIHt ^RIH	t	H
t
Ht ^RIHt ]
! 4       '       d   ^ RIt]P                  ! ]4      tR R lt]! RR	7       ! R
 R]4      4       tR.tR# )é    N)Úhertz_to_mel)ÚSequenceFeatureExtractor)ÚBatchFeature)Ú
TensorTypeÚis_torch_availableÚlogging)Úrequiresc                ót   € V ^8„  d   QhR\         R\         R\        R\        R\        R\        P                  /# )é   Únum_mel_binsÚnum_spectrogram_binsÚsample_rateÚlower_edge_hertzÚupper_edge_hertzÚreturn)ÚintÚfloatÚnpÚndarray)Úformats   "Úq/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/lasr/feature_extraction_lasr.pyÚ__annotate__r       sP   € ÷ "Rñ "RÜð"Räð"Rô ð"Rô ð	"Rô
 ð"Rô ‡Z�Zñ"Ró    c                óØ  € \         P                  p^pVR,          p\         P                  ! RW�VR7      VR p	\        V	RR7      R\         P                  3,          p
\         P                  ! \        VRR7      \        VRR7      V ^,           VR7      pVRR	 \         P                  R3,          V^R
 \         P                  R3,          VR,          \         P                  R3,          rípW¬,
          WÜ,
          ,          pWê,
          Wí,
          ,          p\         P
                  ! R\         P                  ! VV4      4      p\         P                  ! VV^ .^ ^ ..4      P                  V4      # )z.NumPy-port of the JAX mel weight matrix logic.g       @ç        )ÚdtypeNÚkaldi)Ú	mel_scaleºNNN:r   NNéþÿÿÿéÿÿÿÿ)	r   Úfloat64Úlinspacer   ÚnewaxisÚmaximumÚminimumÚpadÚastype)r   r   r   r   r   r   Úinternal_dtypeÚbands_to_zeroÚnyquist_hertzÚlinear_frequenciesÚspectrogram_bins_melÚedgesÚlower_edge_melÚ
center_melÚupper_edge_melÚlower_slopesÚupper_slopesÚmel_weights_matrixs   &&&&&&            r   Úlinear_to_mel_weight_matrixr5       s:  € ô —Z‘Z€Nð €MØ #Õ%€MÜŸš S¨-ÐUcÔdÐerÐesÐtÐÜ'Ð(:ÀgÔNÈqÔRT×R\ÑR\È}Õ]Ðä�KŠKÜÐ%°Ô9ÜÐ%°Ô9Ø�qÕØô	€Eð 	ˆcˆrˆ
”2—:‘:˜q�=Õ!Øˆa�ˆ”B—J‘J �MÕ"Øˆb�	”"—*‘*˜a�-Õ ð !/€Nð )Õ9¸jÕ>YÕZ€LØ"Õ9¸nÕ>YÕZ€LÜŸš C¬¯ª°LÀ,Ó)OÓPÐÜ�6Š6Ð$¨°qÐ'9¸A¸q¸6Ð&BÓC×JÑJÈ5ÓQÐQr   )Úbackendsc                   ób   a a€ ] tR t^Et oRtRR.tR	V 3R lltR
R ltRV3R lR lltRt	Vt
V ;t# )ÚLasrFeatureExtractoraë  
Constructs a LASR feature extractor.

This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains
most of the main methods. Users should refer to this superclass for more information regarding those methods.

This class extracts mel-filter bank features from raw speech using a custom numpy implementation of the `Short Time
Fourier Transform` which should match pytorch's `torch.stft` equivalent.

Args:
        feature_size (`int`, *optional*, defaults to 128):
            The feature dimension of the extracted features.
        sampling_rate (`int`, *optional*, defaults to 16000):
            The sampling rate at which the audio files should be digitalized expressed in hertz (Hz).
        hop_length (`int`, *optional*, defaults to 160):
            Length of the overlapping windows for the STFT used to obtain the Mel Frequency coefficients.
        n_fft (`int`, *optional*, defaults to 512):
            Size of the Fourier transform.
        win_length (`int`, *optional*, defaults to 400):
            The window length for the STFT computation.
        padding_value (`float`, *optional*, defaults to 0.0):
            Padding value used to pad the audio. Should correspond to silences.
Úinput_featuresÚattention_maskc                óä   <€ \         SV `  ! RR VRVRV/VB  W0n        W@n        WPn        \
        P                  ! \        VV^,          ^,           VRR\        P                  R7      4      V n
        R# )Úfeature_sizeÚsampling_rateÚpadding_valueg     @_@g     L½@)r   r   r   r   r   r   N© )ÚsuperÚ__init__Ú
hop_lengthÚn_fftÚ
win_lengthÚtorchÚ
from_numpyr5   r   r"   Úmel_filters)	Úselfr<   r=   rB   rC   rD   r>   ÚkwargsÚ	__class__s	   &&&&&&&,€r   rA   ÚLasrFeatureExtractor.__init__a   sn   ø€ ô 	‰ÒÑw lÐwÀ-ÐwÐ_lÐwÐpvÒwà$ŒØŒ
Ø$ŒÜ ×+Ò+Ü'Ø)Ø%*¨a¥Z°!¥^Ø)Ø!&Ø!'Ü—j‘jôó	
ˆÖr   c                ó0  € \         P                  ! V P                  R V\         P                  R7      pVP	                  \         P                  4      pVP                  RV P                  V P                  4      p\         P                  P                  W4,          V P                  R7      p\         P                  ! V4      ^,          pV P                  P	                  V4      p\         P                  ! Wg,          RR7      p\         P                  ! V4      pV# )F)ÚperiodicÚdevicer   )Úngñhãˆµøä>)Úminr!   )rE   Úhann_windowrD   r"   ÚtoÚunfoldrB   ÚfftÚrfftrC   ÚabsrG   ÚclampÚlog)	rH   ÚwaveformrN   ÚwindowÚframesÚstftÚ
power_specrG   Úmel_specs	   &&&      r   Ú_torch_extract_fbank_featuresÚ2LasrFeatureExtractor._torch_extract_fbank_features{   s½   € ä×"Ò" 4§?¡?¸UÈ6ÔY^×YfÑYfÔgˆØ—;‘;œuŸ}™}Ó-ˆð
 —‘  T§_¡_°d·o±oÓFˆÜ�y‰y�~‰~˜f�o°·±ˆ~Ó<ˆÜ—Y’Y˜t“_¨Õ)ˆ
ð ×&Ñ&×)Ñ)¨&Ó1ˆÜ—;’;˜zÕ7¸TÔBˆÜ—9’9˜XÓ&ˆàˆr   c                óˆ  <€ V ^8„  d   QhRS[ P                  S[S[,          ,          S[S[ P                  ,          ,          S[S[S[,          ,          ,          RS[RS[R,          RS[S[,          R,          RS[R,          RS[R,          RS[R,          R	S[R,          R
S[R,          RS[R,          RS[R,          RS[/# )r   Ú
raw_speechÚ
truncationÚpad_to_multiple_ofNÚreturn_tensorsÚreturn_attention_maskÚpaddingÚ
max_lengthr=   Údo_normalizerN   Úreturn_token_timestampsr   )	r   r   Úlistr   Úboolr   Ústrr   r   )r   Ú__classdict__s   "€r   r   Ú!LasrFeatureExtractor.__annotate__Ž   sò   ø€ ÷ ECñ ECá—J‘J¡¡e¥Õ,©t±B·J±JÕ/?Õ?Á$ÁtÉEÅ{ÕBSÕSðECñ ðECñ   $�Jð	ECñ
 ™jÕ(¨4Õ/ðECñ  $ d�{ðECñ �t•ðECñ ˜$•JðECñ ˜T•zðECñ ˜T•kðECñ �d•
ðECñ "&¨¥ðECñ 
ñECr   c                óZ  € VeR   W€P                   8w  dA   \        RV P                  P                   RV P                    RV P                    RV R2	4      hM-\        P                  RV P                  P                   R24       \        V\        P                  4      '       d   \        P                  ! V4      pM…\        V\        \        34      '       dj   \        V^ ,          \        \        P                  34      '       d'   V Uu. uF  p\        P                  ! V4      NK  	  ppM\        P                  ! V4      p\        V\        P                  4      ;'       d    \        VP                  4      ^8„  pV'       dY   \        VP                  4      ^8”  d?   \        P                  R	V P                  P                   R
24       VP!                  R4      p\        V\        \        34      pV'       dd   V F]  p\        VP                  4      ^8”  g   K  \        P                  R	V P                  P                   R
24       VP!                  R4      pK_  	  V'       g	   V'       d6   V Uu. uF(  qÝR,          P#                  \        P$                  4      NK*  	  ppM'VR,          P#                  \        P$                  4      .p\'        RV/4      pV P)                  VVVVVVRR7      pVP*                  P-                  R4      pV P/                  VV
4      pRVP#                  \        P$                  4      /pV'       dV   VP0                  RV P2                  ^,
          RV P4                  13,          pVP#                  \        P6                  4      VR&   \'        VVR7      # u upi u upi )až  
Main method to featurize and prepare for the model one or several sequence(s). Implementation uses PyTorch for
the STFT computation if available, otherwise a slower NumPy based one.

Args:
    raw_speech (`np.ndarray`, `list[float]`, `list[np.ndarray]`, `list[list[float]]`):
        The sequence or batch of sequences to be padded. Each sequence can be a numpy array, a list of float
        values, a list of numpy arrays or a list of list of float values. Must be mono channel audio, not
        stereo, i.e. single float per timestep.
    truncation (`bool`, *optional*, default to `True`):
        Activates truncation to cut input sequences longer than *max_length* to *max_length*.
    pad_to_multiple_of (`int`, *optional*, defaults to None):
        If set will pad the sequence to a multiple of the provided value.

        This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability
        `>= 7.5` (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128.
    return_attention_mask (`bool`, *optional*):
        Whether to return the attention mask. If left to the default, will return the attention mask according
        to the specific feature_extractor's default.

        [What are attention masks?](../glossary#attention-mask)

        <Tip>

        For Parakeet models, `attention_mask` should always be passed for batched inference, to avoid subtle
        bugs.

        </Tip>

    return_tensors (`str` or [`~utils.TensorType`], *optional*):
        If set, will return tensors instead of list of python integers. Acceptable values are:

        - `'tf'`: Return TensorFlow `tf.constant` objects.
        - `'pt'`: Return PyTorch `torch.Tensor` objects.
        - `'np'`: Return Numpy `np.ndarray` objects.
    sampling_rate (`int`, *optional*):
        The sampling rate at which the `raw_speech` input was sampled. It is strongly recommended to pass
        `sampling_rate` at the forward call to prevent silent errors and allow automatic speech recognition
        pipeline.
    padding_value (`float`, *optional*, defaults to 0.0):
        The value that is used to fill the padding values / vectors.
    do_normalize (`bool`, *optional*, defaults to `False`):
        Whether or not to zero-mean unit-variance normalize the input. Normalizing can help to significantly
        improve the performance of the model.
    device (`str`, *optional*, defaults to `'cpu'`):
        Specifies the device for computation of the log-mel spectrogram of audio signals in the
        `_torch_extract_fbank_features` method. (e.g., "cpu", "cuda")
    return_token_timestamps (`bool`, *optional*, defaults to `None`):
        Deprecated. Use `return_attention_mask` instead from which the number of frames can be inferred.

        Whether or not to return the number of frames of the input raw_speech.
        These num_frames can be used by the model to compute word level timestamps.
Nz3The model corresponding to this feature extractor: z& was trained using a sampling rate of zI. Please make sure that the provided `raw_speech` input was sampled with z	 and not Ú.zDIt is strongly recommended to pass the `sampling_rate` argument to `zN()`. Failing to do so can result in silent errors that might be hard to debug.z2Only mono-channel audio is supported for input to z;. We will take the mean of the channels to convert to mono.r   r9   Úpt)rg   rh   rc   rd   rf   re   r:   )ÚdataÚtensor_typer!   )r   N)r=   Ú
ValueErrorrJ   Ú__name__ÚloggerÚwarningÚ
isinstancer   r   rE   Útensorrk   ÚtupleÚTensorÚlenÚshapeÚmeanrR   Úfloat32r   r'   r9   Úsqueezer_   r:   rD   rB   rl   )rH   rb   rc   rd   re   rf   rg   rh   r=   ri   rN   rj   rI   ÚspeechÚis_batched_torchÚis_batched_sequenceÚbatched_speechÚpadded_inputsr9   rs   r:   s   &&&&&&&&&&&&,        r   Ú__call__ÚLasrFeatureExtractor.__call__Ž   s'  € ðH Ò$Ø× 2Ñ 2Ô2Ü ØIÈ$Ï.É.×JaÑJaÐIbð c)Ø)-×);Ñ);Ð(<ð =)Ø)-×);Ñ);Ð(<¸IÀmÀ_ÐTUðWóð ð 3ô �N‰NØVÐW[×WeÑWe×WnÑWnÐVoð p\ð \ôô �j¤"§*¡*×-Ò-ÜŸš jÓ1‰JÜ˜
¤T¬5 M×2Ò2Ü˜* Q�-¬$´·
±
Ð);×<Ò<ÙAKÓLÁ°vœeŸlšl¨6Ö2Á�
ÐL�
ä"Ÿ\š\¨*Ó5�
ä% j´%·,±,Ó?×]Ð]ÄCÈ
×HXÑHXÓDYÐ\]ÑD]Ðß¤ J×$4Ñ$4Ó 5¸Ô 9Ü�N‰NØDÀTÇ^Á^×E\ÑE\ÐD]ð ^Lð Lôð $Ÿ™¨Ó,ˆJä(¨´d¼E°]ÓCÐßÛ$�Ü�v—|‘|Ó$ qÖ(Ü—N‘NØLÈTÏ^É^×MdÑMdÐLeð fTð Tôð $Ÿ[™[¨›_’Fñ %÷ ×2ÙJTÓUÉ*À �/×,Ñ,¬U¯]©]Ö;É*ˆJÐUˆJà$ WÕ-×0Ñ0´·±Ó?Ð@ˆJä%Ð'7¸Ð&DÓEˆØŸ™ØØØ!Ø!Ø1Ø"7Øð !ó 
ˆð '×5Ñ5×=Ñ=¸bÓAˆØ×;Ñ;¸NÈFÓSˆà˜n×/Ñ/´·±Ó>ð
ˆ÷ !Ø*×9Ñ9¸!¸T¿_¹_ÈqÕ=PÐ=cÐTX×TcÑTcÐ=cÐ:cÕdˆNØ%3×%6Ñ%6´u·z±zÓ%BˆDÐ!Ñ"ä °>ÔBÐBùò_ Mùò. Vs   ÄN#É..N()rB   rG   rC   rD   )é€   i€>  é    i   i�  r   )Úcpu)
FNNNÚlongestNNNr‹   N)rv   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úmodel_input_namesrA   r_   r‡   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)rJ   rn   s   @@r   r8   r8   E   s7   ù‡ € ñð0 *Ð+;Ð<Ð÷
ô4÷&EC÷ ECò ECr   r8   )rE   )Únumpyr   Úaudio_utilsr   Ú!feature_extraction_sequence_utilsr   Úfeature_extraction_utilsr   Úutilsr   r   r   Úutils.import_utilsr	   rE   Ú
get_loggerrv   rw   r5   r8   Ú__all__r?   r   r   Ú<module>r�      su   ðó å 'Ý IÝ 4ß <Ñ <Ý *ñ ×ÒÛð 
×	Ò	˜HÓ	%€õ"RñJ 
�:ÔôMCÐ3ó MCó ðMCð` "Ð
"‚r   