+
    œ°³j:  ã                   óª   € ^ RI t ^ RIHt ^ RIt^RIHt ^RIHt ^RI	H
t
HtHt ]P                  ! ]4      tRR R lltR R	 lt ! R
 R]4      tR.tR# )é    N)ÚSequence)ÚSequenceFeatureExtractor)ÚBatchFeature)ÚPaddingStrategyÚ
TensorTypeÚloggingc                óš   € V ^8„  d   QhR\         R\        R\        R\         R\         R\         R\        R,          R	\        P                  /# )
é   Ún_freqsÚf_minÚf_maxÚn_melsÚsample_rateÚ
fft_lengthÚnormNÚreturn)ÚintÚfloatÚstrÚnpÚndarray)Úformats   "Úw/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/gemma3n/feature_extraction_gemma3n.pyÚ__annotate__r      s`   € ÷ :ñ :Üð:äð:ô ð:ô ð	:ô
 ð:ô ð:ô ��*ð:ô ‡Z�Zñ:ó    c                óâ  € Ve   VR8w  d   \        R4      h\        P                  ! V \        P                  R7      WE,          ,          pR\        P
                  ! RVR,          ,           4      ,          pR\        P
                  ! RVR,          ,           4      ,          p	\        P                  ! W‰V^,           4      p
R^
V
R,          ,          R,
          ,          pVR,          VRR ,
          p\        P                  ! V^ 4      \        P                  ! V^4      ,
          p\        P                  ! ^\        P                  R7      pRVR	RR13,          ,          VRR ,          pVR,          VR,          ,          p\        P                  ! V\        P                  ! VV4      4      pVeC   VR8X  d<   R
V^V^,            VRV ,
          ,          pV\        P                  ! V^ 4      ,          pV# )aa  Create a frequency bin conversion matrix (NumPy version).

Args:
    n_freqs (int): Number of frequencies to highlight/apply
    f_min (float): Minimum frequency (Hz)
    f_max (float): Maximum frequency (Hz)
    n_mels (int): Number of mel filterbanks
    sample_rate (int): Sample rate of the audio waveform
    fft_length (int): FFT length
    norm (Optional[str]): If 'slaney', divide the triangular mel weights by
      the width of the mel band (area normalization). (Default: ``None``)

Returns:
    np.ndarray: Triangular filter banks (fb matrix) of size (``n_freqs``,
    ``n_mels``)
    meaning number of frequencies to highlight/apply to x the number of
    filterbanks.
    Each column is a filterbank so that assuming there is a matrix A of
    size (..., ``n_freqs``), the applied result would be
    ``A @ create_fb_matrix_numpy(A.shape[-1], ...)``.
NÚslaneyz$norm must be one of None or 'slaney'©Údtypeg     F¤@ç      ð?g     à…@ºé   NNºNNNg       @éÿÿÿÿg      ð¿éþÿÿÿ)r#   :r
   NN)Ú
ValueErrorr   ÚarangeÚfloat32ÚmathÚlog10ÚlinspaceÚexpand_dimsÚzerosÚmaximumÚminimum)r   r   r   r   r   r   r   Ú	all_freqsÚm_minÚm_maxÚm_ptsÚf_ptsÚf_diffÚslopesÚzeroÚdown_slopesÚ	up_slopesÚfbÚenorms   &&&&&&&            r   Úcreate_fb_matrixr<      s~  € ð> Ò˜D HÔ,ÜÐ?Ó@Ð@ô —	’	˜'¬¯©Ô4¸Õ8PÕQ€Ið ”T—Z’Z  u¨u¥}Õ 5Ó6Õ6€EØ”T—Z’Z  u¨u¥}Õ 5Ó6Õ6€EÜ�KŠK˜ f¨q¥jÓ1€Eà�R˜E F�NÕ+¨cÕ1Õ2€Eà�2�Y˜˜s ˜Õ#€FÜ�^Š^˜E 1Ó%¬¯ª°yÀ!Ó(DÕD€Fä�8Š8�AœRŸZ™ZÔ(€DØ˜&  C R C �.Õ(¨F°3°B¨KÕ7€KØ�u•  r¥
Õ*€IÜ	�Š�Dœ"Ÿ*š* [°)Ó<Ó	=€BàÒ˜D HÔ,à�u˜Q ¨!¥Ð,¨u°W°f¨~Õ=Õ>ˆØ
Œb�nŠn˜U AÓ&Õ&ˆà€Ir   c          
      ó|   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  /# )r
   ÚarrayÚ	dimensionÚsizeÚstepr   )r   r   r   )r   s   "r   r   r   Y   s>   € ÷ ^ñ ^”2—:‘:ð ^¬#ð ^´Sð ^Äð ^ÌÏ
É
ñ ^r   c                ó  € V P                   ^8w  d   \        R4      hVR8w  d#   WP                   ^,
          8w  d   \        R4      hV P                  w  rEWR,
          V,          ^,           pV^ 8:  d&   \        P                  ! V^ V3V P
                  R7      # WFV3pV P                  ^ ,          V P                  ^,          V,          V P                  ^,          3p\        P                  P                  P                  WVR7      # )zNA basic NumPy equivalent of PyTorch's unfold for 2D arrays along the last dim.zFThis unfold implementation currently supports 2D arrays (batch, time).zFThis unfold implementation only supports unfolding the last dimension.r   )ÚshapeÚstridesr$   )
Úndimr&   rC   r   r-   r   rD   ÚlibÚstride_tricksÚ
as_strided)	r>   r?   r@   rA   Ú
batch_sizeÚoriginal_lengthÚ
num_framesÚoutput_shapeÚoutput_stridess	   &&&&     r   Ú_unfoldrN   Y   sÐ   € à‡z�z�Q„ÜÐaÓbÐbØ�B„˜9¯
©
°Q­Ô6ÜÐaÓbÐbà"'§+¡+Ñ€JØ!Õ(¨TÕ1°AÕ5€Jà�Q„Ü�xŠx˜ Q¨Ð-°U·[±[ÔAÐAà¨DÐ1€LØ—m‘m AÕ&¨¯©°aÕ(8¸4Õ(?ÀÇÁÈqÕAQÐR€Nä�6‰6×Ñ×*Ñ*¨5ÈnÐ*Ó]Ð]r   c                   óv   a a€ ] tR t^lt oRtRR.tRV3R lV 3R llltV3R lR ltRV3R lR	 lltR
t	Vt
V ;t# )ÚGemma3nAudioFeatureExtractora´	  An audio feature extractor Universal Speech Models https://huggingface.co/papers/2303.01037.

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).
    padding_value (`float`, *optional*, defaults to 0.0):
        Padding value used to pad the audio. Should correspond to silences.
    return_attention_mask (`bool`, *optional*, defaults to `True`):
        Whether to return the attention mask for the generated MEL spectrograms.
    frame_length_ms (`float`, *optional*, defaults to 32.0):
        The length of a frame in milliseconds.
    hop_length_ms (`float`, *optional*, defaults to 10.0):
        Length of the overlapping windows for the STFT used to obtain the Mel Frequency coefficients.
    min_frequency (`float`, *optional*, defaults to 125.0):
        The minimum frequency (in Hz) for the Mel filterbank.
    max_frequency (`float`, *optional*, defaults to 7600.0):
        The maximum frequency (in Hz) for the Mel filterbank.
    preemphasis (`float`, *optional*, defaults to 0.97):
        The preemphasis coefficient.
    preemphasis_htk_flavor (`bool`, *optional*, defaults to `True`):
        Whether to use HTK-style preemphasis.
    fft_overdrive (`bool`, *optional*, defaults to `True`):
        Whether to use FFT overdrive.
    dither (`float`, *optional*, defaults to 0.0):
        Adds dithering. In other words, adds a small Gaussian noise to each frame.
        E.g. use 0.0001 to add dithering with a normal distribution centered
        around 0.0 with standard deviation 0.0001 (assuming [-1,+1] range of raw_speech).
        The value 0.0 means no dithering.
        Dithering has similar effect as `spectrogram(mel_floor=...)`. It reduces
        the high log_mel_fbank values for signals with hard-zero sections,
        when VAD cutoff is present in the signal.
    input_scale_factor (`float`, *optional*, defaults to 1.0):
        Scaling factor applied to the input waveform.
    mel_floor (`float`, *optional*, defaults to 1e-05):
        Minimum value for Mel spectrograms to avoid log(0).
    per_bin_mean (`Optional[Sequence[float]]`, *optional*):
        Mean values for per-bin normalization.
    per_bin_stddev (`Optional[Sequence[float]]`, *optional*):
        Standard deviation values for per-bin normalization.
Úinput_featuresÚinput_features_maskc          !      ó¶   <€ V ^8„  d   QhRS[ RS[ RS[RS[RS[RS[RS[RS[R	S[R
S[RS[RS[RS[RS[RS[S[,          R,          RS[S[,          R,          /# )r
   Úfeature_sizeÚsampling_rateÚpadding_valueÚreturn_attention_maskÚframe_length_msÚhop_length_msÚmin_frequencyÚmax_frequencyÚpreemphasisÚpreemphasis_htk_flavorÚfft_overdriveÚditherÚinput_scale_factorÚ	mel_floorÚper_bin_meanNÚper_bin_stddev)r   r   Úboolr   )r   Ú__classdict__s   "€r   r   Ú)Gemma3nAudioFeatureExtractor.__annotate__š   sÏ   ø€ ÷ B'ñ B'áðB'ñ ðB'ñ ð	B'ñ
  $ðB'ñ ðB'ñ ðB'ñ ðB'ñ ðB'ñ ðB'ñ !%ðB'ñ ðB'ñ ðB'ñ "ðB'ñ ðB'ñ  ™u•o¨Õ,ð!B'ñ" !¡�¨$Õ.ñ#B'r   c                óÒ  <€ \         SV `  ! R	R VRVRVRV/VB  Wpn        W€n        W�n        W n        W°n        WÀn        WÐn        \        \        W%,          R,          4      4      V n        \        \        W&,          R,          4      4      V n        \        P                  ! V\        P                  R7      V n        ^\"        P$                  ! \"        P&                  ! V P                  4      4      ,          pV P                  '       d
   V^,          pVV n        \        P*                  ! V P                  \        P,                  R7      pR^\        P.                  ! ^\        P0                  ,          V,          V P                  ,          4      ,
          ,          pVP3                  \        P,                  4      V n        \7        V P(                  ^,          ^,           VVVV P8                  RVR7      V n        Ve.   \        P                  ! V4      P=                  ^^V4      V n        MRV n        Ve/   \        P                  ! V4      P=                  ^^V4      V n         R# RV n         R# )
rT   rU   rV   rW   g     @�@r   g      à?N)r   r   r   r   r   r   r   © )!ÚsuperÚ__init__rZ   r[   r\   r]   r^   r_   r`   r   ÚroundÚframe_lengthÚ
hop_lengthr   r>   Úfloat64ra   r)   ÚceilÚlog2r   r'   r(   ÚcosÚpiÚastypeÚwindowr<   rU   Úmel_filtersÚreshaperb   rc   )ÚselfrT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   Úkwargsr   Úhann_arangert   Ú	__class__s   &&&&&&&&&&&&&&&&&,   €r   rj   Ú%Gemma3nAudioFeatureExtractor.__init__š   sä  ø€ ô( 	‰Òñ 	
Ø%ð	
à'ð	
ð (ð	
ð #8ð		
ð
 ò	
ð +ÔØ*ÔØ&ÔØ&<Ô#Ø*ÔØŒØ"4ÔÜ¤ mÕ&EÈÕ&NÓ OÓPˆÔÜœe MÕ$AÀFÕ$JÓKÓLˆŒÜŸš )´2·:±:Ô>ˆŒàœ$Ÿ)š)¤D§I¢I¨d×.?Ñ.?Ó$@ÓAÕAˆ
Ø××ÐØ˜!�OˆJØ$ˆŒä—i’i × 1Ñ 1¼¿¹ÔDˆØ˜œBŸFšF 1¤r§u¡u¥9¨{Õ#:¸T×=NÑ=NÕ#NÓOÕOÕPˆØ—m‘m¤B§J¡JÓ/ˆŒä+Ø—O‘O qÕ(¨1Õ,ØØØØ×*Ñ*ØØ!ô
ˆÔð Ò#Ü "§¢¨Ó 6× >Ñ >¸qÀ!À\Ó RˆDÕà $ˆDÔàÒ%Ü"$§(¢(¨>Ó":×"BÑ"BÀ1ÀaÈÓ"VˆDÖà"&ˆDÖr   c                ó’   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[S[ P                  S[ P                  3,          /# )r
   ÚwaveformÚattention_maskr   )r   r   Útuple)r   re   s   "€r   r   rf   Þ   sH   ø€ ÷ +Añ +A©R¯Z©Zð +AÉÏÉð +AÑX]Ñ^`×^hÑ^hÑjl×jtÑjtÐ^tÕXuñ +Ar   c                óÂ  € VP                   ^8X  d   \        P                  ! V^ R7      pV P                  R8”  dY   WP                  \        P                  P
                  ! VP                  !  P                  VP                  4      ,          ,           pV P                  R8w  d   WP                  ,          pV P                  ^,           p\        VRW0P                  R7      pV P                  R8”  d«   V P                  '       dl   VR	,          RV P                  ,
          ,          pVR^R13,          V P                  VRRR
13,          ,          ,
          p\        P                  ! WV.RR7      pM:VR,          V P                  VRRR13,          ,          ,
          pMVRRR13,          pWpP                   ,          p\        P"                  P%                  WpP&                  RR7      p\        P(                  ! V4      p	\        P*                  ! W�P,                  4      p
\        P.                  ! \        P0                  ! W P2                  4      4      pV P4                  e   W°P4                  ,
          pV P6                  e   W°P6                  ,          pVP9                  ^ 4      pVRRV P                  1,          P                  \:        4      pWÍRVP                  ^ ,           3# )Ú )Úaxisç        r    )r?   r@   rA   .N)Únr‚   r$   ).:Nr"   Nr%   ).r!   )rE   r   r,   r_   ÚrandomÚrandnrC   rs   r   r`   rl   rN   rm   r\   r]   Úconcatenatert   ÚfftÚrfftr   ÚabsÚmatmulru   Úlogr.   ra   rb   rc   Úsqueezerd   )rw   r}   r~   Úframe_size_for_unfoldÚframes_to_processÚfirst_in_frameÚrest_in_frameÚframesÚstftÚmagnitude_specÚmel_specÚlog_mel_specÚmel_spectrogramÚmasks   &&&           r   Ú_extract_spectrogramÚ1Gemma3nAudioFeatureExtractor._extract_spectrogramÞ   s?  € à�=‰=˜AÔÜ—~’~ h°QÔ7ˆHà�;‰;˜ÔØ§+¡+´·	±	·²ÀÇÁÑ0P×0WÑ0WÐX`×XfÑXfÓ0gÕ"gÕgˆHà×"Ñ" cÔ)Ø×"9Ñ"9Õ9ˆHà $× 1Ñ 1°AÕ 5Ðô $ H¸ÐAV×]lÑ]lÔmÐà×Ñ˜cÔ!Ø×*×*Ð*Ø!2°7Õ!;¸sÀT×EUÑEUÕ?UÕ!V�Ø 1°#°q¸°t°)Õ <¸t×?OÑ?OÐRcÐdgÐilÐjlÐilÐdlÕRmÕ?mÕ m�ÜŸš¨Ð(GÈbÔQ‘à*¨7Õ3°d×6FÑ6FÐIZÐ[^Ð`cÐacÐ`cÐ[cÕIdÕ6dÕd‘à& s¨C¨R¨C xÕ0ˆFàŸ+™+Õ%ˆÜ�v‰v�{‰{˜6§_¡_¸2ˆ{Ó>ˆäŸš ›ˆä—9’9˜^×-=Ñ-=Ó>ˆÜ—v’vœbŸjšj¨·>±>ÓBÓCˆà×ÑÒ(Ø'×*;Ñ*;Õ;ˆLà×ÑÒ*Ø'×*=Ñ*=Õ=ˆLà&×.Ñ.¨qÓ1ˆØÑ0 §¡Ð0Õ1×8Ñ8¼Ó>ˆàÐ%? ×'<Ñ'<¸QÕ'?Ð @Ð@Ð@r   c                óJ  <€ V ^8„  d   QhRS[ P                  S[S[,          ,          S[S[ P                  ,          ,          S[S[S[,          ,          ,          RS[S[,          S[,          RS[R,          RS[RS[R,          RS[S[,          R,          RS[R,          R	S[	/# )
r
   Ú
raw_speechÚpaddingÚ
max_lengthNÚ
truncationÚpad_to_multiple_ofÚreturn_tensorsrW   r   )
r   r   Úlistr   rd   r   r   r   r   r   )r   re   s   "€r   r   rf     s£   ø€ ÷ ?
ñ ?
á—J‘J¡¡e¥Õ,©t±B·J±JÕ/?Õ?Á$ÁtÉEÅ{ÕBSÕSð?
ñ ™•™oÕ-ð?
ñ ˜$•Jð	?
ñ
 ð?
ñ   $�Jð?
ñ ™jÕ(¨4Õ/ð?
ñ  $ d�{ð?
ñ 
ñ?
r   c           	     ó
  € \        V\        P                  4      ;'       d    \        VP                  4      ^8„  p	\        V\
        4      ;'       d(    \        V^ ,          \        P                  \
        34      p
T	;'       g    T
pV'       g   V.pV Uu. uF$  p\        P                  ! V.4      P                  NK&  	  ppV P                  \        RV/4      VVVVVR7      p. p. p\        VP                  VP                  4       Fd  w  ppV P                  VP                  V4      w  ppVP                  VP                  \        P                   4      4       VP                  V4       Kf  	  \        RVRV/VR7      # u upi )an  Creates a batch of MEL spectrograms from the provided raw speech.

This implementation uses a different algorithm for windowing and preemphasis compared to the built-in
`transformers.audio_utils.spectrogram()` function that _will_ result in different outputs. Consider this
carefully when selecting an audio feature extractor, especially with pre-trained models.

Args:
    raw_speech:
        The audio for which MEL spectrograms are created.
    padding (`Union[bool, str, PaddingStrategy]`, *optional*, defaults to `"longest"`):
        The padding strategy to use for batches of audio with different lengths.
    max_length (`int`, *optional*, defaults to 480000):
        If provided, defines the maximum length of the audio to allow. Audio longer than this will be
        truncated if `truncation=True`.
    truncation (`bool`, *optional*, defaults to `True`):
        Whether or not to truncate audio above `max_length`.
    pad_to_multiple_of (`int`, *optional*, defaults to 128):
        When padding, pad to a multiple of this value. The default value is defined for optimal TPU support.
    return_tensors (`Union[str, TensorType]`, *optional*, defaults to `None`):
        The type of tensors to return (e.g., NumPy, or Torch).
    return_attention_mask (`bool`, *optional*, defaults to `True`):
        Whether to return the attention mask for the generated MEL spectrograms.
rQ   )r�   rž   rŸ   r    rW   rR   )Útensor_type)Ú
isinstancer   r   ÚlenrC   r   ÚasarrayÚTÚpadr   ÚziprQ   r~   r™   Úappendrs   r(   )rw   rœ   r�   rž   rŸ   r    r¡   rW   rx   Úis_batched_numpyÚis_batched_sequenceÚ
is_batchedÚrsÚbatched_speechÚprepared_speechÚprepared_speech_maskÚspeechr˜   s   &&&&&&&&,         r   Ú__call__Ú%Gemma3nAudioFeatureExtractor.__call__  sc  € ôF & j´"·*±*Ó=×[Ð[Ä#Àj×FVÑFVÓBWÐZ[ÑB[ÐÜ(¨´XÓ>×tÐtÄ:ÈjÐYZÍmÔ^`×^hÑ^hÔjrÐ]sÓCtÐØ%×<Ð<Ð)<ˆ
÷ Ø$˜ˆJÙ3=Ó>±:¨R”b—j’j " Ó&×(Ô(±:ˆ
Ð>àŸ™ÜÐ*¨JÐ7Ó8ØØ!Ø!Ø1Ø"7ð "ó 
ˆð ˆØ!ÐÜ × =Ñ =¸~×?\Ñ?\Ö]‰LˆF�DØ×4Ñ4°V·X±X¸tÓD‰LˆF�DØ×"Ñ" 6§=¡=´·±Ó#<Ô=Ø ×'Ñ'¨Ö-ñ ^ô
 Ø˜Ð0EÐG[Ð\Ø&ô
ð 	
ùò% ?s   Â*F )r_   r   r^   rl   rm   r`   r[   ru   ra   rZ   rb   rc   r\   r]   rt   )é€   i€>  rƒ   Tg      @@g      $@g     @_@g     °½@g
×£p=
ï?TTrƒ   r    gñhãˆµøä>NN)Úlongesti S Tr¶   NT)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úmodel_input_namesrj   r™   r´   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)rz   re   s   @@r   rP   rP   l   sB   ù‡ € ñ)ðV *Ð+@ÐAÐ÷B'õ B'÷H+Að +A÷Z?
÷ ?
ò ?
r   rP   )N)r)   Úcollections.abcr   Únumpyr   Ú!feature_extraction_sequence_utilsr   Úfeature_extraction_utilsr   Úutilsr   r   r   Ú
get_loggerr¸   Úloggerr<   rN   rP   Ú__all__rh   r   r   Ú<module>rÉ      sT   ðó Ý $ã å IÝ 4ß 9Ñ 9ð 
×	Ò	˜HÓ	%€÷:õz^ô&^
Ð#;ô ^
ðB *Ð
*‚r   