+
    œ°³j¤6  ã                   ó²   € ^ RI t ^ RIt^ RIHt ^ RIt^RIHtHt ^RI	H
t
 ^RIHt ^RIHtHtHt ]P"                  ! ]4      tR R lt ! R	 R
]
4      tR
.tR# )é    N)ÚSequence)Úmel_filter_bankÚwindow_function)ÚSequenceFeatureExtractor)ÚBatchFeature)ÚPaddingStrategyÚ
TensorTypeÚloggingc          
      ó|   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  /# )é   ÚarrayÚ	dimensionÚsizeÚstepÚreturn)ÚnpÚndarrayÚint)Úformats   "Úu/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/gemma4/feature_extraction_gemma4.pyÚ__annotate__r      s>   € ÷ ^ñ ^”2—:‘:ð ^¬#ð ^´Sð ^Äð ^ÌÏ
É
ñ ^ó    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.©Údtype)ÚshapeÚstrideséÿÿÿÿ)
ÚndimÚ
ValueErrorr   r   Úzerosr   r   ÚlibÚstride_tricksÚ
as_strided)	r   r   r   r   Ú
batch_sizeÚoriginal_lengthÚ
num_framesÚoutput_shapeÚoutput_stridess	   &&&&     r   Ú_unfoldr*      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^1t 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# )ÚGemma4AudioFeatureExtractora²	  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 20.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 0.0):
        The minimum frequency (in Hz) for the Mel filterbank.
    max_frequency (`float`, *optional*, defaults to 8000.0):
        The maximum frequency (in Hz) for the Mel filterbank.
    preemphasis (`float`, *optional*, defaults to 0.0):
        The preemphasis coefficient.
    preemphasis_htk_flavor (`bool`, *optional*, defaults to `True`):
        Whether to use HTK-style preemphasis.
    fft_overdrive (`bool`, *optional*, defaults to `False`):
        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 0.001):
        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   ÚfloatÚboolr   )r   Ú__classdict__s   "€r   r   Ú(Gemma4AudioFeatureExtractor.__annotate___   sÏ   ø€ ÷ H'ñ H'áðH'ñ ðH'ñ ð	H'ñ
  $ðH'ñ ðH'ñ ðH'ñ ðH'ñ ðH'ñ ðH'ñ !%ðH'ñ ðH'ñ ðH'ñ "ðH'ñ ðH'ñ  ™u•o¨Õ,ð!H'ñ" !¡�¨$Õ.ñ#H'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        \+        V P                  4      P-                  \        P.                  4      V n        \2        P4                  ! 4       ;_uu_ 4        \2        P6                  ! R4       \9        V P(                  ^,          ^,           VVVV P:                  RRR	7      V n        RRR4       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#   + '       g   i     Lƒ; i)r0   r1   r2   r3   g     @�@r   ÚignoreNÚhtk)Únum_frequency_binsÚnum_mel_filtersr6   r7   r1   ÚnormÚ	mel_scale© )"ÚsuperÚ__init__r6   r7   r8   r9   r:   r;   r<   r   ÚroundÚframe_lengthÚ
hop_lengthr   r   Úfloat64r=   ÚmathÚceilÚlog2Ú
fft_lengthr   ÚastypeÚfloat32ÚwindowÚwarningsÚcatch_warningsÚsimplefilterr   r1   Úmel_filtersÚreshaper>   r?   )Úselfr0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   ÚkwargsrU   Ú	__class__s   &&&&&&&&&&&&&&&&&, €r   rM   Ú$Gemma4AudioFeatureExtractor.__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Ø$ˆŒô & d×&7Ñ&7Ó8×?Ñ?ÄÇ
Á
ÓKˆŒô ×$Ò$×&Õ&Ü×!Ò! (Ô+Ü.Ø#'§?¡?°aÕ#7¸!Õ#;Ø ,Ø+Ø+Ø"×0Ñ0ØØô ˆDÔ÷ 'ð Ò#Ü "§¢¨Ó 6× >Ñ >¸qÀ!À\Ó RˆDÕà $ˆDÔàÒ%Ü"$§(¢(¨>Ó":×"BÑ"BÀ1ÀaÈÓ"VˆDÖà"&ˆDÖ÷) '×&ús   Å,AH7È7I	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   rB   s   "€r   r   rC   ©   sC   ø€ ÷ 7%ñ 7%©R¯Z©Zð 7%ÉÏÉð 7%ÑX]Ñ^`×^hÑ^hÑjl×jtÑjtÐ^tÕXuñ 7%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\        P                  ! VRV^ 33RR7      p\        P                  ! W#^ 3R^ R7      pV P                  ^,           p\        VRW@P                  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                   ! Wg.RR7      pM:VR,          V P                  VRR	R13,          ,          ,
          pMVRR	R13,          pW€P"                  ,          p\        P$                  P'                  W€P(                  RR
7      p	\        P*                  ! V	4      p
\        P,                  ! W P.                  4      p\        P0                  ! W°P2                  ,           4      pV P4                  e   WÀP4                  ,
          pV P6                  e   WÀP6                  ,          pVP9                  ^ 4      pVP                  ^ ,          p\        P:                  ! V4      V P                  ,          V,           ^,
          pW/,          P                  \<        4      pVV3# )é   )Úaxisç        ç      ð?Úconstant)Úmode)rl   Úconstant_values)r   r   r   .N)Únrh   )r   r   r   ).:Nrg   Néþÿÿÿ).:rg   NN)r   r   Úexpand_dimsr;   ÚrandomÚrandnr   rV   r   r<   rO   Úpadr*   rP   r8   r9   ÚconcatenaterX   ÚfftÚrfftrU   ÚabsÚmatmulr\   Úlogr=   r>   r?   ÚsqueezeÚarangerA   )r^   rc   rd   Úpad_leftÚframe_size_for_unfoldÚframes_to_processÚfirst_in_frameÚrest_in_frameÚframesÚstftÚmagnitude_specÚmel_specÚlog_mel_specÚmel_spectrogramÚnum_mel_framesÚframe_end_indicesÚmasks   &&&              r   Ú_extract_spectrogramÚ0Gemma4AudioFeatureExtractor._extract_spectrogram©   s˜  € Ø�=‰=˜AÔÜ—~’~ h°QÔ7ˆHà�;‰;˜ÔØ§+¡+´·	±	·²ÀÇÁÑ0P×0WÑ0WÐX`×XfÑXfÓ0gÕ"gÕgˆHà×"Ñ" cÔ)Ø×"9Ñ"9Õ9ˆHð ×$Ñ$¨Õ)ˆÜ—6’6˜( V¨h¸¨]Ð$;À*ÔMˆÜŸš ¸1°ÀJÐ`aÔbˆà $× 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˜h¯©Õ7Ó8ˆà×ÑÒ(Ø'×*;Ñ*;Õ;ˆLà×ÑÒ*Ø'×*=Ñ*=Õ=ˆLà&×.Ñ.¨qÓ1ˆØ(×.Ñ.¨qÕ1ˆô
 ŸIšI nÓ5¸¿¹ÕGÐJ_Õ_ÐbcÕcÐØÕ0×7Ñ7¼Ó=ˆØ Ð$Ð$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_tensorsr3   r   )
r   r   Úlistr@   rA   Ústrr   r   r	   r   )r   rB   s   "€r   r   rC   â   s­   ø€ ÷ D
ñ D
á—J‘J¡¡e¥Õ,©t±B·J±JÕ/?Õ?Á$ÁtÉEÅ{ÕBSÕSðD
ñ ™•™oÕ-ðD
ñ ˜$•Jð	D
ñ
 ðD
ñ   $�JðD
ñ ™jÕ(¨4Õ/ðD
ñ  $ d�{ðD
ñ 
ñ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'       d2   V Uu. uF$  p\        P                  ! V.4      P                  NK&  	  ppM>V'       g7   \        V\        P                  4      '       g   \        P                  ! V4      pV'       g   \        P                  ! V.4      .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  	  \        Wï4       UUu. uF  w  ppVVR,          ,          NK  	  ppp\        RVRV/VR7      # u upi u up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.
r-   )rŽ   r�   r�   r‘   r3   r.   )Útensor_type).N)Ú
isinstancer   r   Úlenr   r   ÚasarrayÚTrs   r   Úzipr-   rd   rŠ   ÚappendrV   rW   )r^   r�   rŽ   r�   r�   r‘   r’   r3   r_   Úis_batched_numpyÚis_batched_sequenceÚ
is_batchedÚrsÚbatched_speechÚprepared_speechÚprepared_speech_maskÚspeechr‰   s   &&&&&&&&,         r   Ú__call__Ú$Gemma4AudioFeatureExtractor.__call__â   sÇ  € ôF & j´"·*±*Ó=×[Ð[Ä#Àj×FVÑFVÓBWÐZ[ÑB[ÐÜ(¨´XÓ>×tÐtÄ:ÈjÐYZÍmÔ^`×^hÑ^hÔjrÐ]sÓCtÐØ%×<Ð<Ð)<ˆ
çÙ7AÓB±z°œ"Ÿ*š* b TÓ*×,Ô,±zˆJÐBˆJß¤J¨z¼2¿:¹:×$FÒ$FÜŸš JÓ/ˆJçÜŸ*š* j \Ó2Ð3ˆJàŸ™ÜÐ*¨JÐ7Ó8ØØ!Ø!Ø1Ø"7ð "ó 
ˆð ˆØ!ÐÜ × =Ñ =¸~×?\Ñ?\Ö]‰LˆF�DØ×4Ñ4°V·X±X¸tÓD‰LˆF�DØ×"Ñ" 6§=¡=´·±Ó#<Ô=Ø ×'Ñ'¨Ö-ñ ^ô
 ILÈOÔHrÔsÑHr¹¸À˜6 D¨¥O×3Ð3ÑHrˆÑsäØ˜Ð0EÐG[Ð\Ø&ô
ð 	
ùò3 Cùó. ts   Â*H	ÇH)r;   rU   r:   rO   rP   r<   r7   r\   r=   r6   r>   r?   r8   r9   rX   )é€   i€>  ri   Tg      4@g      $@ri   g     @¿@ri   TFri   rj   gü©ñÒMbP?NN)Úlongesti S Tr§   NT)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úmodel_input_namesrM   rŠ   r¥   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r`   rB   s   @@r   r,   r,   1   sC   ù‡ € ñ)ðV *Ð+@ÐAÐ÷H'õ H'÷T7%ð 7%÷rD
÷ D
ò D
r   r,   )rR   rY   Úcollections.abcr   Únumpyr   Úaudio_utilsr   r   Ú!feature_extraction_sequence_utilsr   Úfeature_extraction_utilsr   Úutilsr   r	   r
   Ú
get_loggerr©   Úloggerr*   r,   Ú__all__rK   r   r   Ú<module>r»      sT   ðó Û Ý $ã ç ;Ý IÝ 4ß 9Ñ 9ð 
×	Ò	˜HÓ	%€õ^ô&u
Ð":ô u
ðp )Ð
)‚r   