+
    œ°³jÑ5  ã                   óL  € ^ RI t ^ RIHt ^ RIHt ^ RIt^RIHtH	t	H
t
 ^RIHtHt ]
! 4       '       d   ^ RIt]	! 4       '       d   ^ RIt^RIHtHt ^RIHt ^RIHtHtHtHt ^R	IHtHt  ! R
 R]RR7      t ! R R]RR7      t]! RR7      ] ! R R]4      4       4       t R.t!R# )é    N)ÚPath)ÚAny)Úauto_docstringÚis_soundfile_availableÚis_torch_available)ÚrequiresÚrequires_backends)Ú
AudioInputÚmake_list_of_audio)ÚBatchFeature)ÚAudioKwargsÚProcessingKwargsÚProcessorMixinÚUnpack)ÚPreTokenizedInputÚ	TextInputc                   ó0   a € ] tR t^%t o RtV 3R ltRtV tR# )ÚCsmAudioKwargsa«  
encoded_length_kwargs (`dict[str, Any]`, *optional*):
    Dictionary of keyword arguments used to compute the encoded audio sequence length. This includes parameters
    such as `kernel_sizes`, `strides`, `dilations`, and `use_causal_conv` that define the convolutional layers
    used in audio encoding. The encoded length is used to determine how many audio tokens to generate for each
    audio input in the text sequence.
c                óJ   <€ V ^8„  d   Qh/ S[ S[S[3,          R,          ;R&   # )é   NÚencoded_length_kwargs)ÚdictÚstrr   )ÚformatÚ__classdict__s   "€Úg/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/csm/processing_csm.pyÚ__annotate__ÚCsmAudioKwargs.__annotate__%   s   ø‡ ‚ ñ  ¡¡S �>¨DÕ0Ñ0ò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r   %   s   ø‡ € ñ÷ ƒ r   r   F)Útotalc                   óp   a € ] tR t^1t o RRRRRRR/RR	R
. ROR. ROR. RORR/RR/RRR//tV 3R ltRtV tR# )ÚCsmProcessorKwargsÚtext_kwargsÚpaddingTÚpadding_sideÚleftÚadd_special_tokensFÚaudio_kwargsr   Úkernel_sizesÚstridesÚ	dilationsÚuse_causal_convÚsampling_rateiÀ]  Úcommon_kwargsÚreturn_tensorsÚptc                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )r   r2   )r   )r   r   s   "€r   r   ÚCsmProcessorKwargs.__annotate__1   s   ø‡ ‚ Ù Ñ ò r   r    N)é   é   é   é   r>   r?   é
   r>   r?   é   r>   r?   é   r>   é   )r?   r?   r?   rD   r?   r?   é   r?   r?   é   r?   r?   r@   r?   r   )r?   r?   r?   r?   r?   r?   r?   r?   r?   r?   r?   r?   r?   r?   r?   )r!   r"   r#   r$   Ú	_defaultsr&   r'   r(   r)   s   @r   r,   r,   1   si   ø‡ € ð 	Ø�tØ˜FØ  %ð
ð
 	Ø#ØÒ PØÒHØÒJØ! 4ð	&ð ˜Uð
ð 	Ð*¨DÐ1ð€I÷ ƒ r   r,   )Úbackendsc                   ó�   a a€ ] tR t^Ft o]tR	V 3R llt]R
R l4       tV3R lR lt	]
RV3R lR ll4       t]R 4       tRtVtV ;t# )ÚCsmProcessorc                óš  <€ \        VR 4      '       g)   RV n        VP                  V P                  4      V n        M"VP                  V n        VP                  V n        \        VR4      '       g)   RV n        VP                  V P                  4      V n        M"VP                  V n        VP
                  V n        \        SV `  WVR7       R# )Úaudio_tokenz	<|AUDIO|>Úaudio_eos_tokenz<|audio_eos|>)Úchat_templateN)ÚhasattrrL   Úconvert_tokens_to_idsÚaudio_token_idrM   Úaudio_eos_token_idÚsuperÚ__init__)ÚselfÚfeature_extractorÚ	tokenizerrN   Ú	__class__s   &&&&€r   rT   ÚCsmProcessor.__init__K   s­   ø€ ô �y -×0Ò0Ø*ˆDÔØ"+×"AÑ"AÀ$×BRÑBRÓ"SˆDÕà(×4Ñ4ˆDÔØ"+×":Ñ":ˆDÔä�yÐ"3×4Ò4Ø#2ˆDÔ Ø&/×&EÑ&EÀd×FZÑFZÓ&[ˆDÕ#à#,×#<Ñ#<ˆDÔ Ø&/×&BÑ&BˆDÔ#ä‰ÑÐ*À]ÐÖSr   c                ó  € T pVe   Ve	   Ve   Vf   V# \        WV4       FÝ  w  rgpV^,
          V,          ^,           p	Wg,
          p
V
^,          pW«,
          pWY,
          V
,           V,          ^,           p\        P                  ! V4      ^,
          pW×,          V,           V
,
          pWå,
          pV'       d   T
pTpMW¿,           pW\,           V,           pWXV^,
          ,          ,
          ^,
          V,          ^,           pKß  	  V# )aD  
Compute the length of the encoded audio sequence.

Args:
    audio_length (int): The length of the audio sequence.
    kernel_sizes (list[int]): The kernel sizes for the convolutional layers.
    strides (list[int]): The strides for the convolutional layers.
    use_causal_conv (bool): Whether to use causal convolutions.
)ÚzipÚmathÚceil)Úaudio_lengthr3   r4   r5   r6   Ú
cur_lengthÚkernel_sizeÚstrideÚdilationÚeffective_kernel_sizeÚpadding_totalÚpadding_rightÚpadding_leftÚn_framesÚideal_lengthÚextra_paddings   &&&&&           r   Ú_get_encoded_lengthÚ CsmProcessor._get_encoded_lengtha   sø   € ð "ˆ
àÒ 7¢?°iÒ6GÈ?ÒKbØÐä-0°È	Ö-RÑ)ˆK Ø%0°1¥_¸Õ$@À1Õ$DÐ!Ø'Õ0ˆMØ)¨QÕ.ˆMØ(Õ8ˆLà"Õ:¸]ÕJÈfÕTÐWXÕXˆHÜ—y’y Ó*¨QÕ.ˆHØ#Õ,¨{Õ:¸]ÕJˆLØ(Õ5ˆMçØ,�Ø -‘à -Õ =�à#Õ2°]ÕBˆJØ$°;Àµ?Õ'CÕCÀaÕGÈFÕRÐUVÕVŠJñ% .Sð( Ðr   c                ó|   <€ V ^8„  d   QhRS[ RS[S[,          S[S[S[,          ,          ,          RS[S[,          /# )r   ÚaudioÚsaving_pathÚkwargs)r
   r   r   Úlistr   r,   )r   r   s   "€r   r   ÚCsmProcessor.__annotate__‡   sA   ø€ ÷ 4ñ 4áð4ñ ™4•Z¡$¡s©T¥zÕ"2Õ2ð4ñ Ñ+Õ,ñ	4r   c                óÀ  € \        V R .4       \        V4      p\        V\        \        34      '       d   V.pMa\        V\
        \        34      '       d;   \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   \        R4      h\        V4      \        V4      8w  d   \        R4      hV P                  ! \        3/ VB pVR,          pVR,          p\        W4       Fh  w  rx\        V\        P                  4      '       d-   VP                  4       P!                  4       P#                  4       p\$        P&                  ! W‡V4       Kj  	  R# )	Ú	soundfilec              3   óN   "  € T F  p\        V\        \        34      x € K  	  R # 5i©N)Ú
isinstancer   r   )Ú.0Úps   & r   Ú	<genexpr>Ú*CsmProcessor.save_audio.<locals>.<genexpr>–   s#   é € Ð@qÑepÐ`aÄÈAÔPSÔUYÈ{×A[ÐA[Óepùs   ‚#%FTzAInvalid input path. Please provide a string, or a list of stringsz5The number of audio and saving paths must be the samer2   r7   N)r	   r   rv   r   r   rp   ÚtupleÚallÚ
ValueErrorÚlenÚ_merge_kwargsr,   r[   ÚtorchÚTensorÚcpuÚfloatÚnumpyÚsfÚwrite)	rU   rm   rn   ro   Úoutput_kwargsr2   r7   Úaudio_valuerx   s	   &&&,     r   Ú
save_audioÚCsmProcessor.save_audio‡   s  € ô 	˜$  Ô.ô # 5Ó)ˆô �k¤C¬ ;×/Ò/Ø&˜-‰KÜ˜[¬4´¨-×8Ò8¿S»SÑ@qÑepÓ@q¿S¿SºSÑ@qÑepÓ@q×=qÒ=qÜÐ`ÓaÐaäˆu‹:œ˜[Ó)Ô)ÜÐTÓUÐUà×*Ò*Üñ
àñ
ˆð % ^Õ4ˆØ$ _Õ5ˆä! %Ö5‰NˆKÜ˜+¤u§|¡|×4Ò4Ø)Ÿo™oÓ/×5Ñ5Ó7×=Ñ=Ó?�Ü�HŠH�Q ]Ö3ó 6r   c                óÐ   <€ V ^8„  d   QhRS[ S[,          S[S[ ,          ,          S[S[,          ,          R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# )r   ÚtextNrm   Úoutput_labelsÚdepth_decoder_labels_ratioro   )r   r   rp   r
   Úboolrƒ   r   r,   )r   r   s   "€r   r   rq   ©   s~   ø€ ÷ OCñ OCáÑ+Õ+©d±9­oÕ=ÁÑEVÕ@WÕWÐZ^Õ^ðOCñ ˜DÕ ðOCñ ˜d•{ð	OCñ
 %*¨D¥LðOCñ Ñ+Õ,ñOCr   c                ó®  € V P                   ! \        3RV P                  P                  /VB pVR,          pVR,          pVP	                  RR4      p	V	R8w  d#   \        V P                  P                   R24      h\        V\        4      '       d   V.pMa\        V\        \        34      '       d;   \        ;QJ d    R V 4       F  '       d   K   R	M	  R
M! R V 4       4      '       g   \        R4      hV U
u. uF  qªP                  V P                  4      NK  	  pp
^ pVe   \        V4      p\!        V4      p\#        V4      ^ 8”  d2   V\#        V4      8w  d"   Vf   \        R4      h\        RV RV R24      hVEe   VP%                  R/ 4      pV Uu. uF&  qàP&                  ! VP(                  R,          3/ VB NK(  	  ppVP+                  4       p. pV F¦  p. pV P                  V9   dU   VP%                  ^ 4      pV P                  V,          pVP-                  V4       VP/                  V P                  R^4      pKe  RV9   d%   VP/                  RVP%                  ^ 4      ^4      pK+  VP-                  V4       K¨  	  TpV P                  ! V3/ VB p/ pVP1                  V4       VEe   VP%                  RR4       . . pp^ pV EF@  pV^ 8X  dN   VP-                  \2        P4                  ! ^ 4      4       VP-                  \6        P8                  ! R.4      4       KX  TP-                  \2        P:                  ! VVVV,             Uu. uFC  p\        V\6        P<                  4      '       d   VP?                  4       PA                  4       MTNKE  	  upRR7      4       TP-                  \6        P8                  ! VVVV,             Uu. uF  pVP(                  R,          NK  	  up4      PC                  RR7      4       VV,          pEKC  	  V PD                  ! V3/ VB pVP%                  RR4       VP1                  V4       \G        R V 4       4      pV Uu. uFI  p\6        PH                  PJ                  PM                  V^ VVP(                  R,          ,
          3RR7      NKK  	  pp\6        PN                  ! V^ R7      VR&   V'       dã   VR,          V PP                  8H  PS                  4       pVP(                  ^ ,          p VR8:  d;   \6        PT                  ! V 4      R\W        V ^V,
          ,          4       p!VV!,          p"MTp"\6        PX                  ! VR,          V PP                  8H  VR,          V PZ                  8H  ,          VR,          R4      p#RV#V"R ,          V"R!,          3&   V#VR&   \]        VV	R7      # u up
i u upi u upi u upi u upi )"a•  
output_labels (bool, *optional*, default=False):
    Whether to return labels for training. Indices will be in `[config.audio_token_id, -100, -101]`.
    - `config.audio_token_id` indicates an audio frame (considering sequence length elements as frames)
    - `-100` will be ignored in the loss computation
    - `-101` indicates the audio frame will be used only for the backbone model (using the first codebook token as labels)
depth_decoder_labels_ratio (float, *optional*, default=1.0):
    The ratio of audio frames to keep for the depth decoder labels.

Returns:
    [`BatchFeature`]: A [`BatchFeature`] with the following fields:

    - **input_ids** -- List of token ids to be fed to a model. Returned when `text` is not `None`.
    - **input_values** -- List of audio values to be fed to a model. Returned when `audio` is not `None`.
    - **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when
      `return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names` and if `text` is not
      `None`).
    - **labels** -- List of labels for the audio frames. Returned when `output_labels=True`.
Útokenizer_init_kwargsr-   r2   r9   Nr:   z% only supports `return_tensors='pt'`.c              3   óB   "  € T F  p\        V\        4      x € K  	  R # 5iru   )rv   r   )rw   Úts   & r   ry   Ú(CsmProcessor.__call__.<locals>.<genexpr>Ó   s   é € Ð9[ÑVZÐQR¼*ÀQÌ×:LÐ:LÓVZùs   ‚FTzAInvalid input text. Please provide a string, or a list of stringsz@No audio were provided, but there are audio tokens in the promptz)The number of audio tokens in each text (z7) should be the same as the number of provided audios (z).r   z<placeholder>Úreturn_attention_mask)Úaxis)ÚdimÚpadding_maskc              3   óF   "  € T F  qP                   R,          x € K  	  R# 5i)r?   Néÿÿÿÿ)Úshape)rw   Úcut_idxss   & r   ry   r”     s   é € ÐRÑ=Q°Ÿ.™.¨×,Ò,Ó=Qùs   ‚!)ÚvalueÚinput_values_cutoffsÚ	input_idsç      ð?Úlabels)ÚdataÚtensor_typerš   iœÿÿÿi›ÿÿÿ)ºNNNr   )r¤   r?   )/r   r,   rW   Úinit_kwargsÚgetr}   rX   r!   rv   r   rp   r{   r|   ÚcountrL   r   r~   ÚsumÚpoprj   r›   ÚcopyÚappendÚreplaceÚupdateÚnpÚzerosr€   ÚtensorÚconcatenater�   r‚   r„   ÚcumsumrV   ÚmaxÚnnÚ
functionalÚpadÚstackrQ   ÚnonzeroÚrandpermÚintÚwhererR   r   )$rU   rŒ   rm   r�   rŽ   ro   r‡   r-   r2   r9   r“   Ún_audio_in_textÚn_audior   Úaudio_arrayÚnum_audio_tokens_listÚnum_audio_tokens_list_copyÚexpanded_textÚsampleÚreplace_strÚnum_audio_tokensÚexpanded_audio_tokenÚencodingr¢   Úconcatenated_audiorž   ÚoffsetÚelÚaudio_inputsÚmax_lenrœ   Úaudio_frame_idxsÚn_audio_framesÚ	rand_idxsÚskip_frames_idxsr¡   s$   &&&&&,                              r   Ú__call__ÚCsmProcessor.__call__¨   s}  € ð: ×*Ò*Üñ
à"&§.¡.×"<Ñ"<ð
ð ñ
ˆð $ MÕ2ˆØ$ ^Õ4ˆØ$Ÿ™Ð)9¸4Ó@ˆØ˜TÔ!Ü §¡× 7Ñ 7Ð8Ð8]Ð^Ó_Ð_ä�dœC× Ò Ø�6‰DÜ˜T¤D¬% =×1Ò1·c³cÑ9[ÑVZÓ9[·c·c²cÑ9[ÑVZÓ9[×6[Ò6[ÜÐ`ÓaÐaÙ>BÓC¹d¸Ÿ7™7 4×#3Ñ#3Ö4¹dˆÐCàˆØÒÜ& uÓ-ˆEÜ˜%“jˆGäˆÓ !Ô#¨´3°Ó3GÔ(GØŠ}Ü Ð!cÓdÐdä Ø?ÀÐ?Pð Q2Ø29°¸"ð>óð ð
 ÓØ$0×$4Ñ$4Ð5LÈbÓ$QÐ!álqó%ÙlqÐ]h×(Ò(¨×):Ñ):¸2Õ)>ÑXÐBWÔXÑlqð "ð %ð *?×)CÑ)CÓ)EÐ&ð ˆMÛ�Ø �Ø×&Ñ&¨&Ô0Ø'A×'EÑ'EÀaÓ'HÐ$Ø+/×+;Ñ+;Ð>NÕ+NÐ(à×&Ñ&Ð';Ô<Ø#Ÿ^™^¨D×,<Ñ,<¸oÈqÓQ’Fà%¨Ô/Ø#Ÿ^™^¨O¸[¿_¹_ÈQÓ=OÐQRÓS’FØ×$Ñ$ VÖ,ñ ð !ˆDà—>’> $Ñ6¨+Ñ6ˆØˆØ�‰�HÔàÓØ×ÑÐ4°dÔ;à79¸2Ð 4ÐØˆFÜ*�Ø˜a”<Ø&×-Ñ-¬b¯hªh°q«kÔ:Ø(×/Ñ/´·²¸b¸TÓ0BÖCà&×-Ñ-ÜŸšð +0°¸À'Õ9IÑ*Jóá*J Bô 5?¸rÄ5Ç<Á<×4PÒ4P §¡£§¡Ô 0ÐVXÒ XÙ*Jñð "$ôôð )×/Ñ/ÜŸš¸UÀ6ÈFÐU\ÕL\Ñ=]Ó%^Ñ=]°r b§h¡h¨r§l lÑ=]Ñ%^Ó_×fÑfÐkmÐfÓnôð ˜gÕ%“Fñ# +ð&  ×1Ò1Ð2DÑUÈÑUˆLØ×Ñ˜^¨TÔ2Ø�K‰K˜Ô%ô ÑRÑ=QÓRÓRˆGñ !5ó$á 4�Hô —‘×#Ñ#×'Ñ'¨°1°gÀÇÁÈrÕ@RÕ6RÐ2SÐ[]Ð'Ö^Ù 4ð !ð $ô ,1¯;ª;Ð7KÐQRÔ+SˆDÐ'Ñ(çØ $ [Õ 1°T×5HÑ5HÑ H×QÑQÓSÐØ-×3Ñ3°AÕ6ˆNà)¨SÔ0Ü!ŸNšN¨>Ó:Ð;s¼SÀÐSTÐWqÕSqÕArÓ=sÐt�	Ø#3°IÕ#>Ñ à#3Ð ä—[’[Ø�kÕ" d×&9Ñ&9Ñ9¸dÀ;Õ>OÐSW×SjÑSjÑ>jÕkØ�[Õ!ØóˆFð
 FJˆFÐ# DÕ)Ð+;¸DÕ+AÐAÑBà#ˆD�‰Nä °>ÔBÐBùòG Dùò$%ùòLùò &_ùò$s    Ã:#V>Æ,WÍA	WÏ
WÑAWc                óÈ   € V P                   P                  pV P                  P                  pV Uu. uF  q3R 8w  g   K  VNK  	  pp\        W,           R.,           4      # u upi )r˜   rž   )rW   Úmodel_input_namesrV   rp   )rU   Útokenizer_input_namesÚfeature_extractor_input_namesÚnames   &   r   rÓ   ÚCsmProcessor.model_input_names:  sd   € à $§¡× @Ñ @ÐØ(,×(>Ñ(>×(PÑ(PÐ%ñ ;XÓ(rÑ:W°$ÐcqÑ[q¯¨Ñ:WÐ%Ð(rÜÐ)ÕIÐMcÐLdÕdÓeÐeùò )ss
   ±A¾A)rM   rR   rL   rQ   ru   )NNNN)NFr    )r!   r"   r#   r$   r,   Úvalid_processor_kwargsrT   Ústaticmethodrj   r‰   r   rÐ   ÚpropertyrÓ   r'   r(   Ú__classcell__)rX   r   s   @@r   rJ   rJ   F   so   ù‡ € ð 0Ð÷Tð, ó#ó ð#÷J4ð 4ðB ÷OCñ OCó ðOCðb ñfó ÷fð fr   rJ   )r€   )"r\   Úpathlibr   Útypingr   r„   r®   Úutilsr   r   r   Úutils.import_utilsr   r	   r€   rs   r…   Úaudio_utilsr
   r   Úfeature_extraction_utilsr   Úprocessing_utilsr   r   r   r   Útokenization_utils_baser   r   r   r,   rJ   Ú__all__r    r   r   Ú<module>rå      s›   ðó Ý Ý ã ç OÑ Oß =ñ ×ÒÛá×ÒÛç 9Ý 4ß UÓ Uß Cô	1�[¨õ 	1ôÐ)°õ ñ* 
�:ÔØôzf�>ó zfó ó ðzfðz Ð
‚r   