Ë
    S^(h´, ã                   ó$  — d dl Z d dlZd dlmZmZmZ d dlZd dlZd dlm	Z	 d dl
mZ ddlmZ ddlmZ ddlmZ dd	lmZmZ dd
lmZmZmZmZmZmZ ddlmZ ddlmZm Z m!Z!m"Z"m#Z# ddl$m%Z%  e«       rddlm&Z&  e#jN                  e(«      Z)dZ*dZ+ G d„ de	jX                  «      Z- G d„ de	jX                  «      Z. G d„ de	jX                  «      Z/ G d„ de	jX                  «      Z0 G d„ de	jX                  «      Z1 G d„ de	jX                  «      Z2 G d„ de	jX                  «      Z3 G d „ d!e3«      Z4 G d"„ d#e3«      Z5 G d$„ d%e	jX                  «      Z6e3e5e4d&œZ7 G d'„ d(e	jX                  «      Z8 G d)„ d*e	jX                  «      Z9 G d+„ d,e	jX                  «      Z: G d-„ d.e	jX                  «      Z; G d/„ d0e«      Z<	 	 dRd1ee=e=f   d2e>d3e=d4eej~                     d5e=d6ej€                  fd7„ZAg d8¢ZBd9ZCd:ZDeZE e d;eC«       G d<„ d=e<«      «       ZFd>ZGd?ZHd@ZI e dAeC«       G dB„ dCe<«      «       ZJ e dDeC«       G dE„ dFe<«      «       ZK e dGeC«       G dH„ dIe<«      «       ZL G dJ„ dKe	jX                  «      ZM G dL„ dMe	jX                  «      ZN e dNeC«       G dO„ dPe<«      «       ZOg dQ¢ZPy)Sé    N)ÚOptionalÚTupleÚUnion)Únn)ÚCrossEntropyLossé   )ÚACT2FN)Úis_deepspeed_zero3_enabled)Úis_fsdp_managed_module)Ú!flash_attn_supports_top_left_maskÚis_flash_attn_available)ÚBaseModelOutputÚCausalLMOutputÚSequenceClassifierOutputÚTokenClassifierOutputÚWav2Vec2BaseModelOutputÚXVectorOutput)ÚPreTrainedModel)Úadd_code_sample_docstringsÚadd_start_docstringsÚ%add_start_docstrings_to_model_forwardÚis_peft_availableÚloggingé   )ÚData2VecAudioConfig)Ú_flash_attention_forwardz!facebook/data2vec-audio-base-960hr   c                   ó&   ‡ — e Zd Zdˆ fd„	Zd„ Zˆ xZS )ÚData2VecAudioConvLayerc                 ó°  •— t         ‰| �  «        |dkD  r|j                  |dz
     nd| _        |j                  |   | _        t        j                  | j                  | j                  |j                  |   |j                  |   |j                  ¬«      | _
        t        j                  | j                  d¬«      | _        t        |j                     | _        y )Nr   r   )Úkernel_sizeÚstrideÚbiasT©Úelementwise_affine)ÚsuperÚ__init__Úconv_dimÚin_conv_dimÚout_conv_dimr   ÚConv1dÚconv_kernelÚconv_strideÚ	conv_biasÚconvÚ	LayerNormÚ
layer_normr	   Úfeat_extract_activationÚ
activation©ÚselfÚconfigÚlayer_idÚ	__class__s      €úr/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/data2vec/modeling_data2vec_audio.pyr&   zData2VecAudioConvLayer.__init__5   s¯   ø€ Ü‰ÑÔØ<DÀqºL˜6Ÿ?™?¨8°a©<Ò8ÈaˆÔØ"ŸO™O¨HÑ5ˆÔä—I‘IØ×ÑØ×ÑØ×*Ñ*¨8Ñ4Ø×%Ñ% hÑ/Ø×!Ñ!ô
ˆŒ	ô Ÿ,™, t×'8Ñ'8ÈTÔRˆŒÜ  ×!?Ñ!?Ñ@ˆ�ó    c                 ó´   — | j                  |«      }|j                  dd«      }| j                  |«      }|j                  dd«      }| j                  |«      }|S )Néþÿÿÿéÿÿÿÿ)r.   Ú	transposer0   r2   ©r4   Úhidden_statess     r8   ÚforwardzData2VecAudioConvLayer.forwardD   sV   € ØŸ	™	 -Ó0ˆà%×/Ñ/°°BÓ7ˆØŸ™¨Ó6ˆØ%×/Ñ/°°BÓ7ˆàŸ™¨Ó6ˆØÐr9   ©r   ©Ú__name__Ú
__module__Ú__qualname__r&   r@   Ú__classcell__©r7   s   @r8   r   r   4   s   ø„ õAör9   r   c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )ÚData2VecAudioPadLayerc                 óP   •— t         ‰| �  «        |dz  dk(  rd| _        y d| _        y )Né   r   r   )r%   r&   Únum_pad_remove)r4   Únum_conv_pos_embeddingsr7   s     €r8   r&   zData2VecAudioPadLayer.__init__P   s)   ø€ Ü‰ÑÔØ#:¸QÑ#>À!Ò#C˜aˆÕÈˆÕr9   c                 óV   — | j                   dkD  r|d d …d d …d | j                    …f   }|S ©Nr   )rL   r>   s     r8   r@   zData2VecAudioPadLayer.forwardT   s6   € Ø×Ñ Ò"Ø)ª!ªQÐ0F°4×3FÑ3FÐ2FÐ0FÐ*FÑGˆMØÐr9   rB   rG   s   @r8   rI   rI   O   s   ø„ ôKör9   rI   c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )Ú Data2VecAudioPositionalConvLayerc                 óz  •— t         ‰| �  «        t        j                  |j                  |j                  |j
                  |j
                  dz  |j                  ¬«      | _        t        |j
                  «      | _	        t        |j                     | _        t        j                  |j                  d¬«      | _        y )NrK   )r    ÚpaddingÚgroupsFr#   )r%   r&   r   r*   Úhidden_sizeÚconv_pos_kernel_sizeÚnum_conv_pos_embedding_groupsr.   rI   rS   r	   r1   r2   r/   r0   ©r4   r5   r7   s     €r8   r&   z)Data2VecAudioPositionalConvLayer.__init__[   sŽ   ø€ Ü‰ÑÔÜ—I‘IØ×ÑØ×ÑØ×3Ñ3Ø×/Ñ/°1Ñ4Ø×7Ñ7ô
ˆŒ	ô -¨V×-HÑ-HÓIˆŒÜ  ×!?Ñ!?Ñ@ˆŒäŸ,™, v×'9Ñ'9ÈeÔTˆ�r9   c                 óÖ   — | j                  |«      }| j                  |«      }|j                  dd«      }| j                  |«      }|j                  dd«      }| j	                  |«      }|S ©Nr   rK   )r.   rS   r=   r0   r2   r>   s     r8   r@   z(Data2VecAudioPositionalConvLayer.forwardj   sd   € ØŸ	™	 -Ó0ˆØŸ™ ]Ó3ˆà%×/Ñ/°°1Ó5ˆØŸ™¨Ó6ˆØ%×/Ñ/°°1Ó5ˆØŸ™¨Ó6ˆØÐr9   rB   rG   s   @r8   rQ   rQ   Z   s   ø„ ôUör9   rQ   c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )Ú$Data2VecAudioPositionalConvEmbeddingc                 ó´   •— t         ‰| �  «        t        j                  t	        |j
                  «      D �cg c]  }t        |«      ‘Œ c}«      | _        y c c}w ©N)r%   r&   r   Ú
ModuleListÚrangerM   rQ   Úlayers©r4   r5   Ú_r7   s      €r8   r&   z-Data2VecAudioPositionalConvEmbedding.__init__v   s@   ø€ Ü‰ÑÔÜ—m‘mÜ?DÀV×EcÑEcÓ?dÖe¸!Ô-¨fÕ5Òeó
ˆ�ùÚes   ¶Ac                 ó€   — |j                  dd«      }| j                  D ]
  } ||«      }Œ |j                  dd«      }|S rZ   )r=   ra   )r4   r?   Úlayers      r8   r@   z,Data2VecAudioPositionalConvEmbedding.forward|   sI   € Ø%×/Ñ/°°1Ó5ˆØ—[‘[ò 	1ˆEÙ! -Ó0‰Mð	1à%×/Ñ/°°1Ó5ˆØÐr9   rB   rG   s   @r8   r\   r\   u   s   ø„ ô
ör9   r\   c                   ó.   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zˆ xZS )ÚData2VecAudioFeatureEncoderz.Construct the features from raw audio waveformc           	      óÔ   •— t         ‰| �  «        t        j                  t	        |j
                  «      D �cg c]  }t        ||¬«      ‘Œ c}«      | _        d| _        d| _	        y c c}w )N)r6   FT)
r%   r&   r   r_   r`   Únum_feat_extract_layersr   Úconv_layersÚgradient_checkpointingÚ_requires_grad)r4   r5   Úir7   s      €r8   r&   z$Data2VecAudioFeatureEncoder.__init__‡   sX   ø€ Ü‰ÑÔÜŸ=™=ÜAFÀv×GeÑGeÓAfÖg¸AÔ# F°QÖ7Ògó
ˆÔð ',ˆÔ#Ø"ˆÕùò hs   ¶A%c                 óJ   — | j                  «       D ]	  }d|_        Œ d| _        y ©NF)Ú
parametersÚrequires_gradrl   ©r4   Úparams     r8   Ú_freeze_parametersz.Data2VecAudioFeatureEncoder._freeze_parameters�   s(   € Ø—_‘_Ó&ò 	(ˆEØ"'ˆEÕð	(à#ˆÕr9   c                 ó
  — |d d …d f   }| j                   r| j                  rd|_        | j                  D ]K  }| j                   r5| j                  r)| j                  r| j                  |j                  |«      }ŒD ||«      }ŒM |S )NT)rl   Útrainingrq   rj   rk   Ú_gradient_checkpointing_funcÚ__call__)r4   Úinput_valuesr?   Ú
conv_layers       r8   r@   z#Data2VecAudioFeatureEncoder.forward”   s…   € Ø$¢Q¨ WÑ-ˆð ×Ò 4§=¢=Ø*.ˆMÔ'à×*Ñ*ò 	:ˆJØ×"Ò" t×'BÒ'BÀtÇ}Â}Ø $× AÑ AØ×'Ñ'Ø!ó!‘ñ
 !+¨=Ó 9‘ð	:ð Ðr9   )rC   rD   rE   Ú__doc__r&   rt   r@   rF   rG   s   @r8   rg   rg   „   s   ø„ Ù8ô#ò$ö
r9   rg   c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )ÚData2VecAudioFeatureProjectionc                 ó4  •— t         ‰| �  «        t        j                  |j                  d   |j
                  ¬«      | _        t        j                  |j                  d   |j                  «      | _	        t        j                  |j                  «      | _        y )Nr<   ©Úeps)r%   r&   r   r/   r'   Úlayer_norm_epsr0   ÚLinearrU   Ú
projectionÚDropoutÚfeat_proj_dropoutÚdropoutrX   s     €r8   r&   z'Data2VecAudioFeatureProjection.__init__¨   sf   ø€ Ü‰ÑÔÜŸ,™, v§¡°rÑ':À×@UÑ@UÔVˆŒÜŸ)™) F§O¡O°BÑ$7¸×9KÑ9KÓLˆŒÜ—z‘z &×":Ñ":Ó;ˆ�r9   c                 óp   — | j                  |«      }| j                  |«      }| j                  |«      }||fS r^   )r0   rƒ   r†   )r4   r?   Únorm_hidden_statess      r8   r@   z&Data2VecAudioFeatureProjection.forward®   s:   € à!Ÿ_™_¨]Ó;ÐØŸ™Ð(:Ó;ˆØŸ™ ]Ó3ˆØÐ0Ð0Ð0r9   rB   rG   s   @r8   r}   r}   §   s   ø„ ô<ö1r9   r}   c                   ó†  ‡ — e Zd ZdZ	 	 	 	 	 ddededededededee   fˆ fd	„Z	d
e
j                  dedefd„Z	 	 	 	 	 dde
j                  dee
j                     deee
j                        dee
j                     dee
j                     dedee
j                  ee
j                     eee
j                        f   fd„Zˆ xZS )ÚData2VecAudioAttentionz=Multi-headed attention from 'Attention Is All You Need' paperÚ	embed_dimÚ	num_headsr†   Ú
is_decoderr"   Ú	is_causalr5   c                 ó
  •— t         ‰| �  «        || _        || _        || _        ||z  | _        || _        | j
                  |z  | j                  k7  rt        d| j                  › d|› d�«      ‚| j
                  dz  | _        || _	        || _
        t        j                  |||¬«      | _        t        j                  |||¬«      | _        t        j                  |||¬«      | _        t        j                  |||¬«      | _        y )Nz;embed_dim must be divisible by num_heads (got `embed_dim`: z and `num_heads`: z).g      à¿)r"   )r%   r&   r‹   rŒ   r†   Úhead_dimr5   Ú
ValueErrorÚscalingr�   rŽ   r   r‚   Úk_projÚv_projÚq_projÚout_proj)	r4   r‹   rŒ   r†   r�   r"   rŽ   r5   r7   s	           €r8   r&   zData2VecAudioAttention.__init__¹   sä   ø€ ô 	‰ÑÔØ"ˆŒØ"ˆŒØˆŒØ! YÑ.ˆŒØˆŒà�M‰M˜IÑ%¨$¯.©.Ò8ÜØMÈdÏnÉnÐM]Ø$ Y K¨rð3óð ð —}‘} dÑ*ˆŒØ$ˆŒØ"ˆŒä—i‘i 	¨9¸4Ô@ˆŒÜ—i‘i 	¨9¸4Ô@ˆŒÜ—i‘i 	¨9¸4Ô@ˆŒÜŸ	™	 )¨Y¸TÔBˆ�r9   ÚtensorÚseq_lenÚbszc                 óŽ   — |j                  ||| j                  | j                  «      j                  dd«      j	                  «       S rZ   )ÚviewrŒ   r�   r=   Ú
contiguous©r4   r—   r˜   r™   s       r8   Ú_shapezData2VecAudioAttention._shapeØ   s7   € Ø�{‰{˜3 ¨¯©¸¿¹ÓG×QÑQÐRSÐUVÓW×bÑbÓdÐdr9   r?   Úkey_value_statesÚpast_key_valueÚattention_maskÚlayer_head_maskÚoutput_attentionsÚreturnc                 ó
  — |du}|j                  «       \  }}	}
| j                  |«      | j                  z  }|r0|�.|d   j                  d   |j                  d   k(  r|d   }|d   }�n
|rE| j	                  | j                  |«      d|«      }| j	                  | j                  |«      d|«      }nÃ|�}| j	                  | j                  |«      d|«      }| j	                  | j                  |«      d|«      }t        j                  |d   |gd¬«      }t        j                  |d   |gd¬«      }nD| j	                  | j                  |«      d|«      }| j	                  | j                  |«      d|«      }| j                  r||f}|| j                  z  d| j                  f} | j	                  ||	|«      j                  |Ž } |j                  |Ž } |j                  |Ž }|j                  d«      }t        j                  ||j                  dd«      «      }|j                  «       || j                  z  |	|fk7  r/t!        d|| j                  z  |	|f› d|j                  «       › �«      ‚|�{|j                  «       |d|	|fk7  r#t!        d	|d|	|f› d|j                  «       › �«      ‚|j                  || j                  |	|«      |z   }|j                  || j                  z  |	|«      }t"        j$                  j'                  |d¬«      }|�›|j                  «       | j                  fk7  r*t!        d
| j                  f› d|j                  «       › �«      ‚|j                  dddd«      |j                  || j                  |	|«      z  }|j                  || j                  z  |	|«      }|r?|j                  || j                  |	|«      }|j                  || j                  z  |	|«      }nd}t"        j$                  j)                  || j(                  | j*                  ¬«      }t        j                  ||«      }|j                  «       || j                  z  |	| j                  fk7  r9t!        d|| j                  z  |	| j                  f› d|j                  «       › �«      ‚|j                  || j                  |	| j                  «      }|j                  dd«      }|j                  ||	| j,                  «      }| j/                  |«      }|||fS )ú#Input shape: Batch x Time x ChannelNr   rK   r   r<   ©Údimz$Attention weights should be of size ú	, but is z!Attention mask should be of size z/Head mask for a single layer should be of size )Úprv   ú `attn_output` should be of size )Úsizer•   r’   Úshaperž   r“   r”   ÚtorchÚcatr�   rŒ   r�   r›   ÚreshapeÚbmmr=   r‘   r   Ú
functionalÚsoftmaxr†   rv   r‹   r–   )r4   r?   rŸ   r    r¡   r¢   r£   Úis_cross_attentionr™   Útgt_lenrc   Úquery_statesÚ
key_statesÚvalue_statesÚ
proj_shapeÚsrc_lenÚattn_weightsÚattn_weights_reshapedÚ
attn_probsÚattn_outputs                       r8   r@   zData2VecAudioAttention.forwardÛ   s  € ð .°TÐ9Ðà'×,Ñ,Ó.‰ˆˆW�að —{‘{ =Ó1°D·L±LÑ@ˆñ ØÐ*Ø˜qÑ!×'Ñ'¨Ñ*Ð.>×.DÑ.DÀQÑ.GÒGð (¨Ñ*ˆJØ)¨!Ñ,ŠLÙàŸ™ T§[¡[Ð1AÓ%BÀBÈÓLˆJØŸ;™; t§{¡{Ð3CÓ'DÀbÈ#ÓN‰LØÐ'àŸ™ T§[¡[°Ó%?ÀÀSÓIˆJØŸ;™; t§{¡{°=Ó'AÀ2ÀsÓKˆLÜŸ™ N°1Ñ$5°zÐ#BÈÔJˆJÜ Ÿ9™9 n°QÑ&7¸Ð%FÈAÔN‰Lð Ÿ™ T§[¡[°Ó%?ÀÀSÓIˆJØŸ;™; t§{¡{°=Ó'AÀ2ÀsÓKˆLà�?Š?ð )¨,Ð7ˆNà˜DŸN™NÑ*¨B°·±Ð>ˆ
ØC�t—{‘{ <°¸#Ó>×CÑCÀZÐPˆØ'�Z×'Ñ'¨Ð4ˆ
Ø+�|×+Ñ+¨ZÐ8ˆà—/‘/ !Ó$ˆÜ—y‘y ¨z×/CÑ/CÀAÀqÓ/IÓJˆà×ÑÓ 3¨¯©Ñ#7¸À'Ð"JÒJÜØ6¸¸d¿n¹nÑ8LÈgÐW^Ð7_Ð6`ð aØ ×%Ñ%Ó'Ð(ð*óð ð
 Ð%Ø×"Ñ"Ó$¨¨a°¸'Ð(BÒBÜ Ø7¸¸aÀÈ'Ð8RÐ7SÐS\Ð]k×]pÑ]pÓ]rÐ\sÐtóð ð (×,Ñ,¨S°$·.±.À'È7ÓSÐVdÑdˆLØ'×,Ñ,¨S°4·>±>Ñ-AÀ7ÈGÓTˆLä—}‘}×,Ñ,¨\¸rÐ,ÓBˆàÐ&Ø×#Ñ#Ó%¨$¯.©.Ð):Ò:Ü ØEÀtÇ~Á~ÐFWÐEXð YØ'×,Ñ,Ó.Ð/ð1óð ð +×/Ñ/°°2°q¸!Ó<¸|×?PÑ?PÐQTÐVZ×VdÑVdÐfmÐovÓ?wÑwˆLØ'×,Ñ,¨S°4·>±>Ñ-AÀ7ÈGÓTˆLáð
 %1×$5Ñ$5°c¸4¿>¹>È7ÐT[Ó$\Ð!Ø0×5Ñ5°c¸D¿N¹NÑ6JÈGÐU\Ó]‰Là$(Ð!ä—]‘]×*Ñ*¨<¸4¿<¹<ÐRV×R_ÑR_Ð*Ó`ˆ
ä—i‘i 
¨LÓ9ˆà×ÑÓ #¨¯©Ñ"6¸ÀÇÁÐ!OÒOÜØ2°C¸$¿.¹.Ñ4HÈ'ÐSW×S`ÑS`Ð3aÐ2bð cØ×$Ñ$Ó&Ð'ð)óð ð
 "×&Ñ& s¨D¯N©N¸GÀTÇ]Á]ÓSˆØ!×+Ñ+¨A¨qÓ1ˆð "×)Ñ)¨#¨w¸¿¹ÓGˆà—m‘m KÓ0ˆàÐ1°>ÐAÐAr9   )ç        FTFN©NNNNF)rC   rD   rE   r{   ÚintÚfloatÚboolr   r   r&   r®   ÚTensorrž   r   r@   rF   rG   s   @r8   rŠ   rŠ   ¶   sN  ø„ ÙGð Ø ØØØ04ñCàðCð ðCð ð	Cð
 ðCð ðCð ðCð Ð,Ñ-õCð>e˜UŸ\™\ð e°Cð e¸có eð 48Ø8<Ø15Ø26Ø"'ñvBà—|‘|ðvBð # 5§<¡<Ñ0ðvBð !  u§|¡|Ñ!4Ñ5ð	vBð
 ! §¡Ñ.ðvBð " %§,¡,Ñ/ðvBð  ðvBð 
ˆu�|‰|˜X e§l¡lÑ3°X¸eÀEÇLÁLÑ>QÑ5RÐRÑ	S÷vBr9   rŠ   c                   óV  ‡ — e Zd ZdZˆ fd„Zdej                  dedefd„Z	 	 	 	 	 ddej                  de	ej                     d	e	e
ej                        d
e	ej                     de	ej                     dede
ej                  e	ej                     e	e
ej                        f   fd„Zˆ xZS )ÚData2VecAudioFlashAttention2aV  
    Data2VecAudio flash attention module. This module inherits from `Data2VecAudioAttention` as the weights of the module stays
    untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
    flash attention and deal with padding tokens in case the input contains any of them.
    c                 óB   •— t        ‰| �  |i |¤Ž t        «       | _        y r^   )r%   r&   r   Ú_flash_attn_uses_top_left_mask)r4   ÚargsÚkwargsr7   s      €r8   r&   z%Data2VecAudioFlashAttention2.__init__[  s#   ø€ Ü‰Ñ˜$Ð) &Ò)ô
 /PÓ.QˆÕ+r9   r—   r˜   r™   c                 óR   — |j                  ||| j                  | j                  «      S r^   )r›   rŒ   r�   r�   s       r8   Ú_reshapez%Data2VecAudioFlashAttention2._reshapec  s   € Ø�{‰{˜3 ¨¯©¸¿¹ÓGÐGr9   r?   rŸ   r    r¡   r¢   r£   r¤   c           
      óÎ  — |rt        d«      ‚|d u}|j                  «       \  }}	}
| j                  | j                  |«      d|«      }|rP|�N|d   j                  d   |j                  d   k(  r,|d   j                  dd«      }|d   j                  dd«      }�n*|rE| j                  | j                  |«      d|«      }| j                  | j                  |«      d|«      }nã|��| j                  | j                  |«      d|«      }| j                  | j                  |«      d|«      }t        j                  |d   j                  dd«      |gd¬«      }t        j                  |d   j                  dd«      |gd¬«      }nD| j                  | j                  |«      d|«      }| j                  | j                  |«      d|«      }| j                  r$|j                  dd«      |j                  dd«      f}|j                  d   }|�||d   j                  d   z  }|j                  }|t        j                  k(  rÂt        j                  «       rt        j                  «       }nMt        | j                   d«      r| j                   j"                  }n | j                  j$                  j                  }t&        j)                  d	|› d
�«       |j+                  |«      }|j+                  |«      }|j+                  |«      }t-        |||||	| j.                  r| j0                  nd| j2                  | j4                  ¬«      }|j7                  ||	d«      }| j9                  |«      }|sd }||fS )NzIData2VecAudioFlashAttention2 attention does not support output_attentionsr<   r   rK   r   r§   r;   Ú_pre_quantization_dtypez¾The input hidden states seems to be silently casted in float32, this might be related to the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in ú.r¿   )r†   rŽ   Úuse_top_left_mask)r‘   r¬   rÌ   r•   r­   r=   r“   r”   r®   r¯   r�   ÚdtypeÚfloat32Úis_autocast_enabledÚget_autocast_gpu_dtypeÚhasattrr5   rÎ   ÚweightÚloggerÚwarning_onceÚtor   rv   r†   rŽ   rÈ   r°   r–   )r4   r?   rŸ   r    r¡   r¢   r£   r´   r™   Úq_lenrc   r¶   r·   r¸   Ú
kv_seq_lenÚinput_dtypeÚtarget_dtyper¾   r»   s                      r8   r@   z$Data2VecAudioFlashAttention2.forwardf  s0  € ñ ÜÐhÓiÐið .°TÐ9Ðà%×*Ñ*Ó,‰ˆˆU�Að —}‘} T§[¡[°Ó%?ÀÀSÓIˆñ ØÐ*Ø˜qÑ!×'Ñ'¨Ñ*Ð.>×.DÑ.DÀQÑ.GÒGð (¨Ñ*×4Ñ4°Q¸Ó:ˆJØ)¨!Ñ,×6Ñ6°q¸!Ó<ŠLÙàŸ™ t§{¡{Ð3CÓ'DÀbÈ#ÓNˆJØŸ=™=¨¯©Ð5EÓ)FÈÈCÓP‰LØÐ'àŸ™ t§{¡{°=Ó'AÀ2ÀsÓKˆJØŸ=™=¨¯©°]Ó)CÀRÈÓMˆLÜŸ™ N°1Ñ$5×$?Ñ$?ÀÀ1Ó$EÀzÐ#RÐXYÔZˆJÜ Ÿ9™9 n°QÑ&7×&AÑ&AÀ!ÀQÓ&GÈÐ%VÐ\]Ô^‰Lð Ÿ™ t§{¡{°=Ó'AÀ2ÀsÓKˆJØŸ=™=¨¯©°]Ó)CÀRÈÓMˆLà�?Š?ð )×2Ñ2°1°aÓ8¸,×:PÑ:PÐQRÐTUÓ:VÐWˆNà×%Ñ% bÑ)ˆ
ØÐ%Ø˜.¨Ñ+×1Ñ1°"Ñ5Ñ5ˆJð #×(Ñ(ˆØœ%Ÿ-™-Ò'Ü×(Ñ(Ô*Ü$×;Ñ;Ó=‘ä˜Ÿ™Ð&?Ô@Ø#Ÿ{™{×BÑB‘à#Ÿ{™{×1Ñ1×7Ñ7�ä×Ñðà �> ð$ôð (Ÿ?™?¨<Ó8ˆLØ#Ÿ™ |Ó4ˆJØ'Ÿ?™?¨<Ó8ˆLä.ØØØØØØ$(§M¢M�D—L’L°sØ—n‘nØ"×AÑAô	
ˆð "×)Ñ)¨#¨u°bÓ9ˆØ—m‘m KÓ0ˆá ØˆLà˜L¨.Ð8Ð8r9   rÀ   )rC   rD   rE   r{   r&   r®   rÄ   rÁ   rÌ   r   r   rÃ   r@   rF   rG   s   @r8   rÆ   rÆ   T  sæ   ø„ ñôRðH˜uŸ|™|ð H°cð HÀó Hð 48Ø8<Ø15Ø26Ø"'ñi9à—|‘|ði9ð # 5§<¡<Ñ0ði9ð !  u§|¡|Ñ!4Ñ5ð	i9ð
 ! §¡Ñ.ði9ð " %§,¡,Ñ/ði9ð  ði9ð 
ˆu�|‰|˜X e§l¡lÑ3°X¸eÀEÇLÁLÑ>QÑ5RÐRÑ	S÷i9r9   rÆ   c                   ó$  ‡ — e Zd Z	 	 	 	 	 d	dej                  deej                     deeej                        deej                     deej                     dedeej                  eej                     eeej                        f   fˆ fd„Zˆ xZ	S )
ÚData2VecAudioSdpaAttentionr?   rŸ   r    r¡   r¢   r£   r¤   c                 óz  •— |s|�*t         j                  d«       t        ‰| �  ||||||¬«      S |du}|j	                  «       \  }}	}
| j                  |«      }|r0|�.|d   j                  d   |j                  d   k(  r|d   }|d   }�n
|rE| j                  | j                  |«      d|«      }| j                  | j                  |«      d|«      }nÃ|�}| j                  | j                  |«      d|«      }| j                  | j                  |«      d|«      }t        j                  |d   |gd¬«      }t        j                  |d   |gd¬«      }nD| j                  | j                  |«      d|«      }| j                  | j                  |«      d|«      }| j                  r||f}| j                  ||	|«      }| j                  r	|€|	dkD  rd	nd
}t        j                  j                  j!                  ||||| j"                  r| j$                  nd|¬«      }|j	                  «       || j&                  |	| j(                  fk7  r7t+        d|| j&                  |	| j(                  f› d|j	                  «       › �«      ‚|j-                  dd«      }|j/                  ||	| j0                  «      }| j3                  |«      }|d|fS )r¦   Naµ  Data2VecAudioModel is using Data2VecAudioSdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True` or `layer_head_mask` not None. Falling back to the manual attention implementation, but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.)rŸ   r    r¡   r¢   r£   r   rK   r   r<   r§   TFr¿   )Ú	attn_maskÚ	dropout_prŽ   r«   r©   )r×   rØ   r%   r@   r¬   r•   r­   rž   r“   r”   r®   r¯   r�   rŽ   r   r²   Úscaled_dot_product_attentionrv   r†   rŒ   r�   r‘   r=   r°   r‹   r–   )r4   r?   rŸ   r    r¡   r¢   r£   r´   r™   rµ   rc   r¶   r·   r¸   rŽ   r¾   r7   s                   €r8   r@   z"Data2VecAudioSdpaAttention.forwardÓ  sÕ  ø€ ñ  Ð ;ä×Ñðlôô ‘7‘?ØØ!1Ø-Ø-Ø /Ø"3ð #ó ð ð .°TÐ9Ðà'×,Ñ,Ó.‰ˆˆW�að —{‘{ =Ó1ˆñ ØÐ*Ø˜qÑ!×'Ñ'¨Ñ*Ð.>×.DÑ.DÀQÑ.GÒGð (¨Ñ*ˆJØ)¨!Ñ,ŠLÙàŸ™ T§[¡[Ð1AÓ%BÀBÈÓLˆJØŸ;™; t§{¡{Ð3CÓ'DÀbÈ#ÓN‰LØÐ'àŸ™ T§[¡[°Ó%?ÀÀSÓIˆJØŸ;™; t§{¡{°=Ó'AÀ2ÀsÓKˆLÜŸ™ N°1Ñ$5°zÐ#BÈÔJˆJÜ Ÿ9™9 n°QÑ&7¸Ð%FÈAÔN‰Lð Ÿ™ T§[¡[°Ó%?ÀÀSÓIˆJØŸ;™; t§{¡{°=Ó'AÀ2ÀsÓKˆLà�?Š?ð )¨,Ð7ˆNà—{‘{ <°¸#Ó>ˆð
 !ŸNšN¨~Ð/EÈ'ÐTUÊ+‘DÐ[`ˆ	ô —h‘h×)Ñ)×FÑFØØØØ$Ø&*§m¢m�d—l’l¸Øð Gó 
ˆð ×ÑÓ # t§~¡~°wÀÇÁÐ!NÒNÜØ2°C¸¿¹ÈÐRV×R_ÑR_Ð3`Ð2að bØ×$Ñ$Ó&Ð'ð)óð ð
 "×+Ñ+¨A¨qÓ1ˆð "×)Ñ)¨#¨w¸¿¹ÓGˆà—m‘m KÓ0ˆà˜D .Ð0Ð0r9   rÀ   )
rC   rD   rE   r®   rÄ   r   r   rÃ   r@   rF   rG   s   @r8   rß   rß   Ò  s¿   ø„ ð 48Ø8<Ø15Ø26Ø"'ñf1à—|‘|ðf1ð # 5§<¡<Ñ0ðf1ð !  u§|¡|Ñ!4Ñ5ð	f1ð
 ! §¡Ñ.ðf1ð " %§,¡,Ñ/ðf1ð  ðf1ð 
ˆu�|‰|˜X e§l¡lÑ3°X¸eÀEÇLÁLÑ>QÑ5RÐRÑ	S÷f1ñ f1r9   rß   c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )ÚData2VecAudioFeedForwardc                 óö  •— t         ‰| �  «        t        j                  |j                  «      | _        t        j                  |j                  |j                  «      | _	        t        |j                  t        «      rt        |j                     | _        n|j                  | _        t        j                  |j                  |j                  «      | _        t        j                  |j                   «      | _        y r^   )r%   r&   r   r„   Úactivation_dropoutÚintermediate_dropoutr‚   rU   Úintermediate_sizeÚintermediate_denseÚ
isinstanceÚ
hidden_actÚstrr	   Úintermediate_act_fnÚoutput_denseÚhidden_dropoutÚoutput_dropoutrX   s     €r8   r&   z!Data2VecAudioFeedForward.__init__=  s«   ø€ Ü‰ÑÔÜ$&§J¡J¨v×/HÑ/HÓ$IˆÔ!ä"$§)¡)¨F×,>Ñ,>À×@XÑ@XÓ"YˆÔÜ�f×'Ñ'¬Ô-Ü'-¨f×.?Ñ.?Ñ'@ˆDÕ$à'-×'8Ñ'8ˆDÔ$äŸI™I f×&>Ñ&>À×@RÑ@RÓSˆÔÜ Ÿj™j¨×)>Ñ)>Ó?ˆÕr9   c                 ó°   — | j                  |«      }| j                  |«      }| j                  |«      }| j                  |«      }| j	                  |«      }|S r^   )rê   rî   rè   rï   rñ   r>   s     r8   r@   z Data2VecAudioFeedForward.forwardJ  sX   € Ø×/Ñ/°Ó>ˆØ×0Ñ0°Ó?ˆØ×1Ñ1°-Ó@ˆà×)Ñ)¨-Ó8ˆØ×+Ñ+¨MÓ:ˆØÐr9   rB   rG   s   @r8   rå   rå   <  s   ø„ ô@ör9   rå   )ÚeagerÚsdpaÚflash_attention_2c                   ó&   ‡ — e Zd Zˆ fd„Zdd„Zˆ xZS )ÚData2VecAudioEncoderLayerc                 óÈ  •— t         ‰| �  «        t        |j                     |j                  |j
                  |j                  d¬«      | _        t        j                  |j                  «      | _        t        j                  |j                  |j                  ¬«      | _        t        |«      | _        t        j                  |j                  |j                  ¬«      | _        y )NF)r‹   rŒ   r†   r�   r   )r%   r&   Ú DATA2VEC_AUDIO_ATTENTION_CLASSESÚ_attn_implementationrU   Únum_attention_headsÚattention_dropoutÚ	attentionr   r„   rð   r†   r/   r�   r0   rå   Úfeed_forwardÚfinal_layer_normrX   s     €r8   r&   z"Data2VecAudioEncoderLayer.__init__\  s¥   ø€ Ü‰ÑÔÜ9¸&×:UÑ:UÑVØ×(Ñ(Ø×0Ñ0Ø×,Ñ,Øô	
ˆŒô —z‘z &×"7Ñ"7Ó8ˆŒÜŸ,™, v×'9Ñ'9¸v×?TÑ?TÔUˆŒÜ4°VÓ<ˆÔÜ "§¡¨V×-?Ñ-?ÀV×EZÑEZÔ [ˆÕr9   c                 óè   — |}| j                  |||¬«      \  }}}| j                  |«      }||z   }| j                  |«      }|| j                  |«      z   }| j	                  |«      }|f}|r||fz  }|S )N©r¡   r£   )rý   r†   r0   rþ   rÿ   )r4   r?   r¡   r£   Úattn_residualr»   rc   Úoutputss           r8   r@   z!Data2VecAudioEncoderLayer.forwardj  s’   € Ø%ˆØ)-¯©Ø¨.ÐL]ð *8ó *
Ñ&ˆ�| Qð Ÿ™ ]Ó3ˆØ%¨Ñ5ˆàŸ™¨Ó6ˆØ%¨×(9Ñ(9¸-Ó(HÑHˆØ×-Ñ-¨mÓ<ˆà Ð"ˆáØ˜�Ñ&ˆGàˆr9   ro   rB   rG   s   @r8   r÷   r÷   [  s   ø„ ô\÷r9   r÷   c                   ór   ‡ — e Zd Zˆ fd„Z	 	 	 	 ddej
                  deej                     dededef
d„Z	ˆ xZ
S )	ÚData2VecAudioEncoderc                 óÀ  •— t         ‰| �  «        || _        t        |«      | _        t        j                  |j                  |j                  ¬«      | _	        t        j                  |j                  «      | _        t        j                  t        |j                  «      D �cg c]  }t!        |«      ‘Œ c}«      | _        d| _        |j&                  dk(  | _        y c c}w )Nr   Frõ   )r%   r&   r5   r\   Úpos_conv_embedr   r/   rU   r�   r0   r„   rð   r†   r_   r`   Únum_hidden_layersr÷   ra   rk   rú   Ú_use_flash_attention_2rb   s      €r8   r&   zData2VecAudioEncoder.__init__  s¦   ø€ Ü‰ÑÔØˆŒÜBÀ6ÓJˆÔÜŸ,™, v×'9Ñ'9¸v×?TÑ?TÔUˆŒÜ—z‘z &×"7Ñ"7Ó8ˆŒÜ—m‘mÔPUÐV\×VnÑVnÓPoÖ$pÈ1Ô%>¸vÕ%FÒ$pÓqˆŒØ&+ˆÔ#Ø&,×&AÑ&AÐEXÑ&XˆÕ#ùò %qs   Â!Cr?   r¡   r£   Úoutput_hidden_statesÚreturn_dictc                 ó4  — |rdnd }|rdnd }|�Ý|j                  d«      j                  dd|j                  d   «      }d|| <   | j                  r|�d|v r|nd }n‘d|d d …d d d d …f   j	                  |j
                  ¬«      z
  }|t        j                  |j
                  «      j                  z  }|j                  |j                  d   d|j                  d   |j                  d   «      }| j                  |«      }	||	z   }| j                  |«      }| j                  |«      }t        «       xs t        | «      }
| j                  D ]£  }|r||fz   }t        j                   g «      }| j"                  r|| j$                  j&                  k  rdnd	}|r|
rG| j(                  r+| j"                  r| j+                  |j,                  |||«      }n ||||¬
«      }|d   }|rd}|sŒ›|d   fz   }Œ¥ |r||fz   }|st/        d„ |||fD «       «      S t1        |||¬«      S )N© r<   r   rK   r   ç      ð?©rÑ   TFr  ©NNc              3   ó&   K  — | ]	  }|€Œ|–— Œ y ­wr^   r  )Ú.0Úvs     r8   ú	<genexpr>z/Data2VecAudioEncoder.forward.<locals>.<genexpr>Ë  s   è ø€ Òm˜qÐ_`Ñ_lœÑmùs   ‚Š)Úlast_hidden_stater?   Ú
attentions)Ú	unsqueezeÚrepeatr­   r	  rÙ   rÑ   r®   ÚfinfoÚminÚexpandr  r0   r†   r
   r   ra   Úrandrv   r5   Ú	layerdroprk   rw   rx   Útupler   )r4   r?   r¡   r£   r
  r  Úall_hidden_statesÚall_self_attentionsÚexpand_attention_maskÚposition_embeddingsÚsynced_gpusre   Údropout_probabilityÚskip_the_layerÚlayer_outputss                  r8   r@   zData2VecAudioEncoder.forward‰  s[  € ñ #7™B¸DÐÙ$5™b¸4ÐàÐ%à$2×$<Ñ$<¸RÓ$@×$GÑ$GÈÈ1Èm×NaÑNaÐbcÑNdÓ$eÐ!Ø45ˆMÐ0Ð0Ñ1Ø×*Ò*à4BÐ4NÐSTÐXfÑSf¡Ðmq‘ð "% ~²a¸¸tÂQÐ6FÑ'G×'JÑ'JÐQ^×QdÑQdÐ'JÓ'eÑ!e�Ø!/´%·+±+¸m×>QÑ>QÓ2R×2VÑ2VÑ!V�Ø!/×!6Ñ!6Ø"×(Ñ(¨Ñ+¨Q°×0DÑ0DÀRÑ0HÈ.×J^ÑJ^Ð_aÑJbó"�ð #×1Ñ1°-Ó@ÐØ%Ð(;Ñ;ˆØŸ™¨Ó6ˆØŸ™ ]Ó3ˆä0Ó2ÒRÔ6LÈTÓ6Rˆà—[‘[ò 	PˆEÙ#Ø$5¸Ð8HÑ$HÐ!ô #(§*¡*¨R£.Ðà%)§]¢]Ð8KÈdÏkÉk×NcÑNcÒ8c™TÐjoˆNÙ!¡[à×.Ò.°4·=²=Ø$(×$EÑ$EØŸ™Ø%Ø&Ø)ó	%‘Mñ %*Ø%°nÐXiô%�Mð !.¨aÑ 0�áØ ,�â Ø&9¸]È1Ñ=MÐ<OÑ&OÑ#ð7	Pñ:  Ø 1°]Ð4DÑ DÐáÜÑm ]Ð4EÐGZÐ$[ÔmÓmÐmÜØ+Ø+Ø*ô
ð 	
r9   )NFFT)rC   rD   rE   r&   r®   r—   r   rÄ   rÃ   r@   rF   rG   s   @r8   r  r  ~  s_   ø„ ôYð 26Ø"'Ø%*Ø ñG
à—|‘|ðG
ð ! §¡Ñ.ðG
ð  ð	G
ð
 #ðG
ð ÷G
r9   r  c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )ÚData2VecAudioAdapterLayerc                 ó¶   •— t         ‰| �  «        t        j                  |j                  d|j                  z  |j
                  |j                  d¬«      | _        y )NrK   r   )r!   rS   )r%   r&   r   r*   Úoutput_hidden_sizeÚadapter_kernel_sizeÚadapter_strider.   rX   s     €r8   r&   z"Data2VecAudioAdapterLayer.__init__Ô  sJ   ø€ Ü‰ÑÔÜ—I‘IØ×%Ñ%Ø�×)Ñ)Ñ)Ø×&Ñ&Ø×(Ñ(Øô
ˆ�	r9   c                 ój   — | j                  |«      }t        j                  j                  |d¬«      }|S )Nr   r§   )r.   r   r²   Úglur>   s     r8   r@   z!Data2VecAudioAdapterLayer.forwardÞ  s/   € ØŸ	™	 -Ó0ˆÜŸ™×)Ñ)¨-¸QÐ)Ó?ˆàÐr9   rB   rG   s   @r8   r(  r(  Ó  s   ø„ ô
ör9   r(  c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )ÚData2VecAudioAdapterc                 ó¨  •‡— t         ‰| �  «        ‰j                  ‰j                  k7  rTt	        j
                  ‰j                  ‰j                  «      | _        t	        j                  ‰j                  «      | _        nd x| _        | _        t	        j                  ˆfd„t        ‰j                  «      D «       «      | _        ‰j                  | _        y )Nc              3   ó4   •K  — | ]  }t        ‰«      –— Œ y ­wr^   )r(  )r  rc   r5   s     €r8   r  z0Data2VecAudioAdapter.__init__.<locals>.<genexpr>ð  s   øè ø€ Ò#pÈ!Ô$=¸f×$EÑ#pùs   ƒ)r%   r&   r*  rU   r   r‚   Úprojr/   Úproj_layer_normr_   r`   Únum_adapter_layersra   r  rX   s    `€r8   r&   zData2VecAudioAdapter.__init__æ  s—   ù€ Ü‰ÑÔð ×$Ñ$¨×(:Ñ(:Ò:ÜŸ	™	 &×"4Ñ"4°f×6OÑ6OÓPˆDŒIÜ#%§<¡<°×0IÑ0IÓ#JˆDÕ à/3Ð3ˆDŒI˜Ô,ä—m‘mÓ#pÌuÐU[×UnÑUnÓOoÔ#pÓpˆŒØ×)Ñ)ˆ�r9   c                 óh  — | j                   �.| j                  �"| j                  |«      }| j                  |«      }|j                  dd«      }| j                  D ]D  }t        j
                  j                  «       }| j                  r|| j                  kD  sŒ= ||«      }ŒF |j                  dd«      }|S rZ   )r3  r4  r=   ra   ÚnpÚrandomrv   r  )r4   r?   re   Úlayerdrop_probs       r8   r@   zData2VecAudioAdapter.forwardó  s¢   € à�9‰9Ð  T×%9Ñ%9Ð%EØ ŸI™I mÓ4ˆMØ ×0Ñ0°Ó?ˆMà%×/Ñ/°°1Ó5ˆà—[‘[ò 	5ˆEÜŸY™Y×-Ñ-Ó/ˆNØ—=’= ^°d·n±nÓ%DÙ % mÓ 4‘ð	5ð
 &×/Ñ/°°1Ó5ˆØÐr9   rB   rG   s   @r8   r0  r0  å  s   ø„ ô*ör9   r0  c                   óŽ   — e Zd ZdZeZdZdZdZdZ	dZ
d„ Z	 ddeej                  ef   dee   fd	„Z	 dd
edej                  fd„Zy)ÚData2VecAudioPreTrainedModelz†
    An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
    models.
    Údata2vec_audiory   Tc                 ó€  — t        |t        «      r›t        j                  d|j                  j
                  z  «      }t        j                  j                  |j                  j                  | |¬«       t        j                  j                  |j                  j                  | |¬«       yt        |t        «      r5t        j                  j                  |j                  j                  d«       yt        |t        j                  «      rm|j                  j                  j!                  d| j"                  j$                  ¬«       |j                  �%|j                  j                  j'                  «        yyt        |t        j(                  t        j*                  f«      rc|j                  �$|j                  j                  j'                  «        |j                  �&|j                  j                  j-                  d«       yyt        |t        j.                  «      r t        j                  j1                  |j                  «       |j                  �jt        j                  |j2                  |j4                  |j6                  d   z  z  «      }t        j                  j                  |j                  | |¬«       yyy)zInitialize the weightsr   )ÚaÚbr   r¿   )ÚmeanÚstdNr  )rë   r}   ÚmathÚsqrtrƒ   Úin_featuresr   ÚinitÚuniform_rÖ   r"   rQ   Ú	constant_r.   r‚   ÚdataÚnormal_r5   Úinitializer_rangeÚzero_r/   Ú	GroupNormÚfill_r*   Úkaiming_normal_rT   Úin_channelsr    )r4   ÚmoduleÚks      r8   Ú_init_weightsz*Data2VecAudioPreTrainedModel._init_weights  sà  € ä�fÔ<Ô=Ü—	‘	˜!˜f×/Ñ/×;Ñ;Ñ;Ó<ˆAÜ�G‰G×Ñ˜V×.Ñ.×5Ñ5¸!¸¸qÐÔAÜ�G‰G×Ñ˜V×.Ñ.×3Ñ3¸°r¸QÐÕ?Ü˜Ô @ÔAÜ�G‰G×Ñ˜fŸk™k×.Ñ.°Õ2Ü˜¤§	¡	Ô*Ø�M‰M×Ñ×&Ñ&¨C°T·[±[×5RÑ5RÐ&ÔSà�{‰{Ð&Ø—‘× Ñ ×&Ñ&Õ(ð 'ä˜¤§¡¬r¯|©|Ð <Ô=Ø�{‰{Ð&Ø—‘× Ñ ×&Ñ&Ô(Ø�}‰}Ð(Ø—‘×"Ñ"×(Ñ(¨Õ-ð )ä˜¤§	¡	Ô*Ü�G‰G×#Ñ# F§M¡MÔ2à�{‰{Ð&Ü—I‘I˜fŸm™m¨v×/AÑ/AÀF×DVÑDVÐWXÑDYÑ/YÑZÓ[�Ü—‘× Ñ  §¡°°°aÐ Õ8ð 'ð +r9   NÚinput_lengthsÚadd_adapterc                 óT  — |€| j                   j                  n|}d„ }t        | j                   j                  | j                   j                  «      D ]  \  }} ||||«      }Œ |rBt        | j                   j                  «      D ]   } ||d| j                   j                  «      }Œ" |S )zH
        Computes the output length of the convolutional layers
        c                 ó>   — t        j                  | |z
  |d¬«      dz   S )NÚfloor)Úrounding_moder   )r®   Údiv©Úinput_lengthr    r!   s      r8   Ú_conv_out_lengthzWData2VecAudioPreTrainedModel._get_feat_extract_output_lengths.<locals>._conv_out_length3  s"   € ô —9‘9˜\¨KÑ7¸ÈwÔWÐZ[Ñ[Ð[r9   r   )r5   rT  Úzipr+   r,   r`   r5  r,  )r4   rS  rT  r\  r    r!   rc   s          r8   Ú _get_feat_extract_output_lengthsz=Data2VecAudioPreTrainedModel._get_feat_extract_output_lengths*  s¦   € ð 2=Ð1D�d—k‘k×-Ò-È+ˆò	\ô
 $' t§{¡{×'>Ñ'>ÀÇÁ×@WÑ@WÓ#Xò 	QÑˆK˜Ù,¨]¸KÈÓP‰Mð	Qñ Ü˜4Ÿ;™;×9Ñ9Ó:ò _�Ù 0°ÀÀ4Ç;Á;×C]ÑC]Ó ^‘ð_ð Ðr9   Úfeature_vector_lengthr¡   c                 ó   — |j                  d¬«      d d …df   }| j                  ||¬«      }|j                  t        j                  «      }|j
                  d   }t        j                  ||f|j                  |j                  ¬«      }d|t        j                  |j
                  d   |j                  ¬«      |dz
  f<   |j                  dg«      j                  d«      j                  dg«      j                  «       }|S )Nr<   r§   ©rT  r   )rÑ   Údevicer   )rb  )Úcumsumr^  rÙ   r®   Úlongr­   ÚzerosrÑ   rb  ÚarangeÚfliprÃ   )r4   r_  r¡   rT  Únon_padded_lengthsÚoutput_lengthsÚ
batch_sizes          r8   Ú"_get_feature_vector_attention_maskz?Data2VecAudioPreTrainedModel._get_feature_vector_attention_maskA  só   € ð
 ,×2Ñ2°rÐ2Ó:º1¸b¸5ÑAÐà×>Ñ>Ð?QÐ_jÐ>ÓkˆØ'×*Ñ*¬5¯:©:Ó6ˆà#×)Ñ)¨!Ñ,ˆ
äŸ™ØÐ.Ð/°~×7KÑ7KÐTb×TiÑTiô
ˆð uvˆœŸ™ ^×%9Ñ%9¸!Ñ%<À^×EZÑEZÔ[Ð]kÐnoÑ]oÐpÑqØ'×,Ñ,¨b¨TÓ2×9Ñ9¸"Ó=×BÑBÀBÀ4ÓH×MÑMÓOˆØÐr9   r^   )rC   rD   rE   r{   r   Úconfig_classÚbase_model_prefixÚmain_input_nameÚsupports_gradient_checkpointingÚ_supports_flash_attn_2Ú_supports_sdparR  r   r®   Ú
LongTensorrÁ   r   rÃ   r^  rk  r  r9   r8   r;  r;    s‚   „ ñð
 '€LØ(ÐØ$€OØ&*Ð#Ø!ÐØ€Nò9ð4 Z^ñØ" 5×#3Ñ#3°SÐ#8Ñ9ðØHPÐQUÉóð0 Y]ñØ%(ðØ:?×:JÑ:Jôr9   r;  r­   Ú	mask_probÚmask_lengthr¡   Ú	min_masksr¤   c                 óà  ‡‡‡‡‡— | \  }Š‰dk  rt        d«      ‚‰‰kD  rt        d‰› d‰› d�«      ‚t        j                  j                  d«      j	                  «       Šˆˆˆˆˆfd„}|�-|j                  «       j                  d«      j                  «       nt        |«      D �cg c]  }‰‘Œ c}}t        j                  |‰ft        ¬	«      }	g }
 |‰«      }|d
k(  r|	S |D ]¯  } ||«      }t        j                  j                  t        j                  |‰dz
  z
  «      |d¬«      }t        |«      d
k(  r‰dz
  }n|d
   }t        j                  |t        j                  ||z
  t        j                   ¬	«      |z  g«      }|
j#                  |«       Œ± t        j$                  |
«      }
t        j&                  |
dd…dd…df   ||‰f«      }
|
j)                  ||‰z  «      }
t        j                  ‰«      dddd…f   }t        j&                  |||‰f«      j)                  ||‰z  «      }|
|z   }
|
j+                  «       ‰dz
  kD  r‰dz
  |
|
‰dz
  kD  <   t        j,                  |	|
dd«       |	S c c}w )af  
    Computes random mask spans for a given shape. Used to implement [SpecAugment: A Simple Data Augmentation Method for
    ASR](https://arxiv.org/abs/1904.08779). Note that this method is not optimized to run on TPU and should be run on
    CPU as part of the preprocessing during training.

    Args:
        shape: The shape for which to compute masks. This should be of a tuple of size 2 where
               the first element is the batch size and the second element is the length of the axis to span.
        mask_prob:  The percentage of the whole axis (between 0 and 1) which will be masked. The number of
                    independently generated mask spans of length `mask_length` is computed by
                    `mask_prob*shape[1]/mask_length`. Note that due to overlaps, `mask_prob` is an upper bound and the
                    actual percentage will be smaller.
        mask_length: size of the mask
        min_masks: minimum number of masked spans
        attention_mask: A (right-padded) attention mask which independently shortens the feature axis of
                        each batch dimension.
    r   z&`mask_length` has to be bigger than 0.zO`mask_length` has to be smaller than `sequence_length`, but got `mask_length`: z and `sequence_length`: ú`c                 óœ   •— t        ‰| z  ‰z  ‰z   «      }t        |‰«      }|‰z  ‰kD  r‰‰z  }| ‰dz
  z
  |k  rt        | ‰dz
  z
  d«      }|S )z;Given input length, compute how many spans should be maskedr   r   )rÁ   Úmax)r[  Únum_masked_spanÚepsilonrt  rs  ru  Úsequence_lengths     €€€€€r8   Úcompute_num_masked_spanz6_compute_mask_indices.<locals>.compute_num_masked_span|  so   ø€ ä˜i¨,Ñ6¸ÑDÀwÑNÓOˆÜ˜o¨yÓ9ˆð ˜[Ñ(¨?Ò:Ø-°Ñ<ˆOð ˜;¨™?Ñ+¨oÒ=Ü! ,°+À±/Ñ"BÀAÓFˆOàÐr9   Nr<   r  r   F)Úreplace)r‘   r7  r8  r  ÚitemÚdetachÚsumÚtolistr`   re  rÃ   Úchoicerf  ÚlenÚconcatenateÚonesÚint32ÚappendÚarrayÚbroadcast_tor°   ry  Úput_along_axis)r­   rs  rt  r¡   ru  rj  r}  rc   rS  Úspec_aug_maskÚspec_aug_mask_idxsÚmax_num_masked_spanr[  rz  Úspec_aug_mask_idxÚdummy_mask_idxÚoffsetsr{  r|  s    `` `            @@r8   Ú_compute_mask_indicesr’  V  s­  ü€ ð0 #(Ñ€J�à�Q‚ÜÐAÓBÐBà�_Ò$ÜØ]Ð^iÐ]jØ& Ð&7°qð:ó
ð 	
ô �i‰i�n‰n˜QÓ×$Ñ$Ó&€G÷ð ð$ Ð%ð 	×ÑÓ×#Ñ# BÓ'×.Ñ.Ô0ä',¨ZÓ'8Ö9 !ŠoÒ9ð ô —H‘H˜j¨/Ð:Ä$ÔG€MØÐá1°/ÓBÐà˜aÒØÐà%ò 5ˆá1°,Ó?ˆô ŸI™I×,Ñ,Ü�I‰I�l k°A¡oÑ6Ó7¸ÐRWð -ó 
Ðô Ð Ó! QÒ&ð -¨qÑ0‰Nà.¨qÑ1ˆNäŸN™NØ¤§¡Ð(;¸oÑ(MÔUW×U]ÑU]Ô ^ÐaoÑ oÐpó
Ðð 	×!Ñ!Ð"3Õ4ð/5ô2 Ÿ™Ð"4Ó5Ðô Ÿ™Øš1ša ˜:Ñ&¨Ð5HÈ+Ð(VóÐð ,×3Ñ3°JÐ@SÐVaÑ@aÓbÐô �i‰i˜Ó$ T¨4² ]Ñ3€GÜ�o‰o˜g¨
Ð4GÈÐ'UÓV×^Ñ^ØÐ'¨+Ñ5ó€Gð ,¨gÑ5Ðð ×ÑÓ /°AÑ"5Ò5ØGVÐYZÑGZÐÐ-°À!Ñ0CÑCÑDô ×Ñ�mÐ%7¸¸BÔ?àÐùòw :s   Â$	I+)r   i$  i   a  
    Data2VecAudio was proposed in [data2vec: A General Framework for Self-supervised Learning in Speech, Vision and
    Language](https://arxiv.org/pdf/2202.03555) by Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu and
    Michael Auli.

    This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
    library implements for all its model (such as downloading or saving etc.).

    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use
    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
    behavior.

    Parameters:
        config ([`Data2VecAudioConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
aJ  
    Args:
        input_values (`torch.FloatTensor` of shape `(batch_size, sequence_length)`):
            Float values of input raw speech waveform. Values can be obtained by loading a *.flac* or *.wav* audio file
            into an array of type *List[float]* or a *numpy.ndarray*, *e.g.* via the soundfile library (*pip install
            soundfile*). To prepare the array into *input_values*, the [`AutoProcessor`] should be used for padding and
            conversion into a tensor of type *torch.FloatTensor*. See [`Wav2Vec2Processor.__call__`] for details.
        attention_mask (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Mask to avoid performing convolution and attention on padding token indices. Mask values selected in `[0,
            1]`:

            - 1 for tokens that are **not masked**,
            - 0 for tokens that are **masked**.

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

            <Tip warning={true}>

            `attention_mask` should be passed if the corresponding processor has `config.return_attention_mask ==
            True`, which is the case for all pre-trained Data2Vec Audio models. Be aware that that even with
            `attention_mask`, zero-padded inputs will have slightly different outputs compared to non-padded inputs
            because there are more than one convolutional layer in the positional encodings. For a more detailed
            explanation, see [here](https://github.com/huggingface/transformers/issues/25621#issuecomment-1713759349).

            </Tip>

        output_attentions (`bool`, *optional*):
            Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
            tensors for more detail.
        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
            more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
zgThe bare Data2VecAudio Model transformer outputting raw hidden-states without any specific head on top.c                   ó\  ‡ — e Zd Zdefˆ fd„Zd„ Z	 	 ddej                  deej                     deej                     fd„Z
 ee«       eeeede¬	«      	 	 	 	 	 dd
eej$                     deej$                     deej                     dee   dee   dee   deeef   fd„«       «       Zˆ xZS )ÚData2VecAudioModelr5   c                 ó´  •— t         ‰| �  |«       || _        t        |«      | _        t        |«      | _        |j                  dkD  s|j                  dkD  rEt        j                  t        j                  |j                  «      j                  «       «      | _        t!        |«      | _        |j$                  rt'        |«      nd | _        | j+                  «        y )Nr¿   )r%   r&   r5   rg   Úfeature_extractorr}   Úfeature_projectionÚmask_time_probÚmask_feature_probr   Ú	Parameterr®   rÄ   rU   rF  Úmasked_spec_embedr  ÚencoderrT  r0  ÚadapterÚ	post_initrX   s     €r8   r&   zData2VecAudioModel.__init__  s¦   ø€ Ü‰Ñ˜Ô ØˆŒÜ!<¸VÓ!DˆÔÜ"@ÀÓ"HˆÔð × Ñ  3Ò&¨&×*BÑ*BÀSÒ*HÜ%'§\¡\´%·,±,¸v×?QÑ?QÓ2R×2[Ñ2[Ó2]Ó%^ˆDÔ"ä+¨FÓ3ˆŒà7=×7IÒ7IÔ+¨FÔ3ÈtˆŒð 	�‰Õr9   c                 ó8   — | j                   j                  «        y©ú¨
        Calling this function will disable the gradient computation for the feature encoder so that its parameter will
        not be updated during training.
        N)r–  rt   ©r4   s    r8   Úfreeze_feature_encoderz)Data2VecAudioModel.freeze_feature_encoder  s   € ð
 	×Ñ×1Ñ1Õ3r9   r?   Úmask_time_indicesr¡   c                 óÎ  — t        | j                  dd«      s|S |j                  «       \  }}}|�)| j                  j	                  |j
                  «      ||<   nË| j                  j                  dkD  r²| j                  r¦t        ||f| j                  j                  | j                  j                  || j                  j                  ¬«      }t        j                  ||j                  t        j                  ¬«      }| j                  j	                  |j
                  «      ||<   | j                  j                  dkD  r¨| j                  rœt        ||f| j                  j                  | j                  j                   | j                  j"                  ¬«      }t        j                  ||j                  t        j                  ¬«      }|dd…df   j%                  d|d«      }d||<   |S )	zš
        Masks extracted features along time axis and/or along feature axis according to
        [SpecAugment](https://arxiv.org/abs/1904.08779).
        Úapply_spec_augmentTNr   )rs  rt  r¡   ru  )rb  rÑ   )rs  rt  ru  r<   )Úgetattrr5   r¬   r›  rÙ   rÑ   r˜  rv   r’  Úmask_time_lengthÚmask_time_min_masksr®   r—   rb  rÃ   r™  Úmask_feature_lengthÚmask_feature_min_masksr  )r4   r?   r¤  r¡   rj  r|  rU   Úmask_feature_indicess           r8   Ú_mask_hidden_statesz&Data2VecAudioModel._mask_hidden_states&  sš  € ô �t—{‘{Ð$8¸$Ô?Ø Ð ð 4A×3EÑ3EÓ3GÑ0ˆ
�O [àÐ(à/3×/EÑ/E×/HÑ/HÈ×I\ÑI\Ó/]ˆMÐ+Ò,Ø�[‰[×'Ñ'¨!Ò+°·²Ü 5Ø˜_Ð-ØŸ+™+×4Ñ4Ø ŸK™K×8Ñ8Ø-ØŸ+™+×9Ñ9ô!Ðô !&§¡Ð->À}×G[ÑG[Ôch×cmÑcmÔ nÐØ/3×/EÑ/E×/HÑ/HÈ×I\ÑI\Ó/]ˆMÐ+Ñ,à�;‰;×(Ñ(¨1Ò,°·²ä#8Ø˜[Ð)ØŸ+™+×7Ñ7Ø ŸK™K×;Ñ;ØŸ+™+×<Ñ<ô	$Ð ô $)§<¡<Ð0DÈ]×MaÑMaÔin×isÑisÔ#tÐ Ø#7º¸4¸Ñ#@×#GÑ#GÈÈOÐ]_Ó#`Ð Ø23ˆMÐ.Ñ/àÐr9   Úaudio)Ú
checkpointÚoutput_typerl  ÚmodalityÚexpected_outputry   r£   r
  r  r¤   c                 óH  — |�|n| j                   j                  }|�|n| j                   j                  }|�|n| j                   j                  }| j	                  |«      }|j                  dd«      }|�!| j                  |j                  d   |d¬«      }| j                  |«      \  }}| j                  |||¬«      }| j                  |||||¬«      }	|	d   }| j                  �| j                  |«      }|s
||f|	dd  z   S t        |||	j                  |	j                  ¬«      S )	Nr   rK   Fra  )r¤  r¡   ©r¡   r£   r
  r  r   )r  Úextract_featuresr?   r  )r5   r£   r
  Úuse_return_dictr–  r=   rk  r­   r—  r­  rœ  r�  ÚData2VecAudioBaseModelOutputr?   r  )
r4   ry   r¡   r¤  r£   r
  r  rµ  r?   Úencoder_outputss
             r8   r@   zData2VecAudioModel.forwardT  sb  € ð" 2CÐ1NÑ-ÐTX×T_ÑT_×TqÑTqÐà$8Ð$DÑ È$Ï+É+×JjÑJjð 	ð &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà×1Ñ1°,Ó?ÐØ+×5Ñ5°a¸Ó;ÐàÐ%à!×DÑDØ ×&Ñ& qÑ)¨>Àuð Eó ˆNð +/×*AÑ*AÐBRÓ*SÑ'ˆÐ'Ø×0Ñ0ØÐ->È~ð 1ó 
ˆð Ÿ,™,ØØ)Ø/Ø!5Ø#ð 'ó 
ˆð (¨Ñ*ˆà�<‰<Ð#Ø ŸL™L¨Ó7ˆMáØ!Ð#3Ð4°ÀqÀrÐ7JÑJÐJä+Ø+Ø-Ø)×7Ñ7Ø&×1Ñ1ô	
ð 	
r9   r  ©NNNNN)rC   rD   rE   r   r&   r£  r®   ÚFloatTensorr   rr  r­  r   ÚDATA2VEC_AUDIO_INPUTS_DOCSTRINGr   Ú_CHECKPOINT_FOR_DOCr·  Ú_CONFIG_FOR_DOCÚ_EXPECTED_OUTPUT_SHAPErÄ   rÃ   r   r   r@   rF   rG   s   @r8   r”  r”  	  s  ø„ ð
Ð2õ ò"4ð :>Ø59ñ	,à×(Ñ(ð,ð $ E×$5Ñ$5Ñ6ð,ð ! ×!1Ñ!1Ñ2ó	,ñ\ +Ð+JÓKÙØ&Ø0Ø$ØØ.ôð 26Ø9=Ø,0Ø/3Ø&*ñ2
à˜uŸ|™|Ñ,ð2
ð ! §¡Ñ.ð2
ð $ E×$5Ñ$5Ñ6ð	2
ð
 $ D™>ð2
ð ' t™nð2
ð ˜d‘^ð2
ð 
ˆuÐ2Ð2Ñ	3ò2
óó Lô2
r9   r”  rK   z['MISTER QUILTER IS THE APOSTLE OF THE MIDDLE CLASSES AND WE ARE GLAD TO WELCOME HIS GOSPEL'gÍÌÌÌÌ¼P@zkData2VecAudio Model with a `language modeling` head on top for Connectionist Temporal Classification (CTC).c                   óú   ‡ — e Zd Zˆ fd„Zd„ Zd„ Z ee«       ee	e
eee¬«      	 	 	 	 	 ddeej                      deej                      dee   dee   d	ee   d
eej                      deee
f   fd„«       «       Zˆ xZS )ÚData2VecAudioForCTCc                 ó   •— t         ‰| �  |«       t        |«      | _        t	        j
                  |j                  «      | _        |j                  €t        d| j                  › d�«      ‚t        |d«      r|j                  r|j                  n|j                  }t	        j                  ||j                  «      | _        | j#                  «        y )NzYou are trying to instantiate zü with a configuration that does not define the vocabulary size of the language model head. Please instantiate the model as follows: `Data2VecAudioForCTC.from_pretrained(..., vocab_size=vocab_size)`. or define `vocab_size` of your model's configuration.rT  )r%   r&   r”  r<  r   r„   Úfinal_dropoutr†   Ú
vocab_sizer‘   r7   rÕ   rT  r*  rU   r‚   Úlm_headrž  )r4   r5   r*  r7   s      €r8   r&   zData2VecAudioForCTC.__init__�  s¶   ø€ Ü‰Ñ˜Ô ä0°Ó8ˆÔÜ—z‘z &×"6Ñ"6Ó7ˆŒà×ÑÐ$ÜØ0°·±Ð0@ð AHð Hóð ô *1°¸Ô)GÈF×L^ÒL^ˆF×%Ò%Ðdj×dvÑdvð 	ô —y‘yÐ!3°V×5FÑ5FÓGˆŒð 	�‰Õr9   c                 óX   — t        j                  dt        «       | j                  «        y©r¡  úžThe method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5. Please use the equivalent `freeze_feature_encoder` method instead.N©ÚwarningsÚwarnÚFutureWarningr£  r¢  s    r8   Úfreeze_feature_extractorz,Data2VecAudioForCTC.freeze_feature_extractor²  ó'   € ô
 	�‰ðQäô	
ð
 	×#Ñ#Õ%r9   c                 óL   — | j                   j                  j                  «        yr   ©r<  r–  rt   r¢  s    r8   r£  z*Data2VecAudioForCTC.freeze_feature_encoder¾  ó   € ð
 	×Ñ×-Ñ-×@Ñ@ÕBr9   )r¯  r°  rl  r²  Úexpected_lossry   r¡   r£   r
  r  Úlabelsr¤   c           
      ó¤  — |�|n| j                   j                  }|�I|j                  «       | j                   j                  k\  r"t	        d| j                   j                  › �«      ‚| j                  |||||¬«      }|d   }| j                  |«      }| j                  |«      }	d}
|��b|�|n$t        j                  |t        j                  ¬«      }| j                  |j                  d«      «      j                  t        j                  «      }|dk\  }|j                  d«      }|j                  |«      }t        j                   j#                  |	dt        j$                  ¬«      j'                  dd«      }t        j(                  j*                  j-                  d	¬
«      5  t        j                   j/                  ||||| j                   j0                  | j                   j2                  | j                   j4                  ¬«      }
ddd«       |s|	f|t6        d z   }|
�|
f|z   S |S t9        |
|	|j:                  |j<                  ¬«      S # 1 sw Y   ŒExY w)aà  
        labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*):
            Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to
            the sequence length of the output logits. Indices are selected in `[-100, 0, ..., config.vocab_size - 1]`.
            All labels set to `-100` are ignored (masked), the loss is only computed for labels in `[0, ...,
            config.vocab_size - 1]`.
        Nz$Label values must be <= vocab_size: r´  r   r  r<   )r¨   rÑ   r   F)Úenabled)ÚblankÚ	reductionÚzero_infinity©ÚlossÚlogitsr?   r  )r5   r¶  ry  rÃ  r‘   r<  r†   rÄ  r®   Ú	ones_likerd  r^  r�  rÙ   Úmasked_selectr   r²   Úlog_softmaxrÒ   r=   ÚbackendsÚcudnnÚflagsÚctc_lossÚpad_token_idÚctc_loss_reductionÚctc_zero_infinityÚ_HIDDEN_STATES_START_POSITIONr   r?   r  )r4   ry   r¡   r£   r
  r  rÒ  r  r?   rÚ  rÙ  rS  Úlabels_maskÚtarget_lengthsÚflattened_targetsÚ	log_probsÚoutputs                    r8   r@   zData2VecAudioForCTC.forwardÅ  s)  € ð0 &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆàÐ &§*¡*£,°$·+±+×2HÑ2HÒ"HÜÐCÀDÇKÁK×DZÑDZÐC[Ð\Ó]Ð]à×%Ñ%ØØ)Ø/Ø!5Ø#ð &ó 
ˆð   ™
ˆØŸ™ ]Ó3ˆà—‘˜mÓ,ˆàˆØÑð #1Ð"<‘Ä%Ç/Á/ÐR^Ôfk×fpÑfpÔBqð ð !×AÑAÀ.×BTÑBTÐUWÓBXÓY×\Ñ\Ô]b×]gÑ]gÓhˆMð ! A™+ˆKØ(Ÿ_™_¨RÓ0ˆNØ &× 4Ñ 4°[Ó AÐô Ÿ™×1Ñ1°&¸bÌÏÉÐ1ÓV×`Ñ`ÐabÐdeÓfˆIä—‘×%Ñ%×+Ñ+°EÐ+Ó:ñ 	Ü—}‘}×-Ñ-ØØ%Ø!Ø"ØŸ+™+×2Ñ2Ø"Ÿk™k×<Ñ<Ø"&§+¡+×"?Ñ"?ð .ó �÷	ñ Ø�Y Ô)FÐ)GÐ!HÑHˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEäØ˜f°G×4IÑ4IÐV]×VhÑVhô
ð 	
÷	ð 	ús   ÆA#IÉIr¹  )rC   rD   rE   r&   rÌ  r£  r   r»  r   r¼  r   r½  Ú_CTC_EXPECTED_OUTPUTÚ_CTC_EXPECTED_LOSSr   r®   rÄ   rÃ   r   r   r@   rF   rG   s   @r8   rÀ  rÀ  ˜  sÙ   ø„ ô
ò*
&òCñ +Ð+JÓKÙØ&Ø"Ø$Ø,Ø(ôð 26Ø,0Ø/3Ø&*Ø)-ñD
à˜uŸ|™|Ñ,ðD
ð ! §¡Ñ.ðD
ð $ D™>ð	D
ð
 ' t™nðD
ð ˜d‘^ðD
ð ˜Ÿ™Ñ&ðD
ð 
ˆu�nÐ$Ñ	%òD
óó LôD
r9   rÀ  zœ
    Data2VecAudio Model with a sequence classification head on top (a linear layer over the pooled output) for tasks
    like SUPERB Keyword Spotting.
    c                   óþ   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Z ee«       e	e
eed¬«      	 	 	 	 	 ddeej                     deej                     d	ee   d
ee   dee   deej                     deeef   fd„«       «       Zˆ xZS )Ú&Data2VecAudioForSequenceClassificationc                 óü  •— t         ‰| �  |«       t        |d«      r|j                  rt	        d«      ‚t        |«      | _        |j                  dz   }|j                  r0t        j                  t        j                  |«      |z  «      | _        t        j                  |j                  |j                   «      | _        t        j                  |j                   |j$                  «      | _        | j)                  «        y )NrT  zdSequence classification does not support the use of Data2VecAudio adapters (config.add_adapter=True)r   )r%   r&   rÕ   rT  r‘   r”  r<  r  Úuse_weighted_layer_sumr   rš  r®   r†  Úlayer_weightsr‚   rU   Úclassifier_proj_sizeÚ	projectorÚ
num_labelsÚ
classifierrž  ©r4   r5   Ú
num_layersr7   s      €r8   r&   z/Data2VecAudioForSequenceClassification.__init__  sÁ   ø€ Ü‰Ñ˜Ô ä�6˜=Ô)¨f×.@Ò.@ÜØvóð ô 1°Ó8ˆÔØ×-Ñ-°Ñ1ˆ
Ø×(Ò(Ü!#§¡¬e¯j©j¸Ó.DÀzÑ.QÓ!RˆDÔÜŸ™ 6×#5Ñ#5°v×7RÑ7RÓSˆŒÜŸ)™) F×$?Ñ$?À×ARÑARÓSˆŒð 	�‰Õr9   c                 óX   — t        j                  dt        «       | j                  «        y)z©
        Calling this function will disable the gradient computation for the feature encoder so that its parameters will
        not be updated during training.
        rÇ  NrÈ  r¢  s    r8   rÌ  z?Data2VecAudioForSequenceClassification.freeze_feature_extractor-  rÍ  r9   c                 óL   — | j                   j                  j                  «        yr   rÏ  r¢  s    r8   r£  z=Data2VecAudioForSequenceClassification.freeze_feature_encoder9  rÐ  r9   c                 óP   — | j                   j                  «       D ]	  }d|_        Œ y©zÒ
        Calling this function will disable the gradient computation for the base model so that its parameters will not
        be updated during training. Only the classification head will be updated.
        FN©r<  rp   rq   rr   s     r8   Úfreeze_base_modelz8Data2VecAudioForSequenceClassification.freeze_base_model@  ó*   € ð
 ×(Ñ(×3Ñ3Ó5ò 	(ˆEØ"'ˆEÕñ	(r9   r®  ©r¯  r°  rl  r±  ry   r¡   r£   r
  r  rÒ  r¤   c                 ó<  — |�|n| j                   j                  }| j                   j                  rdn|}| j                  |||||¬«      }| j                   j                  rr|t           }t        j                  |d¬«      }t        j                  j                  | j                  d¬«      }	||	j                  ddd«      z  j                  d¬«      }n|d   }| j                  |«      }|€|j                  d¬«      }
n‰| j                  |j                   d   |«      }|j#                  d«      j%                  dd|j                   d   «      }d	|| <   |j                  d¬«      |j                  d¬«      j                  dd«      z  }
| j'                  |
«      }d}|�Ft)        «       } ||j                  d| j                   j*                  «      |j                  d«      «      }|s|f|t        d z   }|�|f|z   S |S t-        |||j.                  |j0                  ¬
«      S )á�  
        labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
            config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
            `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
        NTr´  r   r§   r<   r   rK   r¿   rØ  )r5   r¶  rð  r<  rå  r®   Ústackr   r²   r³   rñ  r›   r�  ró  r@  rk  r­   r  r  rõ  r   rô  r   r?   r  )r4   ry   r¡   r£   r
  r  rÒ  r  r?   Únorm_weightsÚpooled_outputÚpadding_maskÚexpand_padding_maskrÚ  rÙ  Úloss_fctrê  s                    r8   r@   z.Data2VecAudioForSequenceClassification.forwardH  s!  € ð. &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆØ'+§{¡{×'IÒ'I™tÐOcÐà×%Ñ%ØØ)Ø/Ø!5Ø#ð &ó 
ˆð �;‰;×-Ò-Ø#Ô$AÑBˆMÜ!ŸK™K¨¸1Ô=ˆMÜŸ=™=×0Ñ0°×1CÑ1CÈÐ0ÓLˆLØ*¨\×->Ñ->¸rÀ1ÀaÓ-HÑH×MÑMÐRSÐMÓT‰Mà# A™JˆMàŸ™ }Ó5ˆØÐ!Ø)×.Ñ.°1Ð.Ó5‰Mà×BÑBÀ=×CVÑCVÐWXÑCYÐ[iÓjˆLØ".×"8Ñ"8¸Ó"<×"CÑ"CÀAÀqÈ-×J]ÑJ]Ð^_ÑJ`Ó"aÐØ25ˆMÐ.Ð.Ñ/Ø)×-Ñ-°!Ð-Ó4°|×7GÑ7GÈAÐ7GÓ7N×7SÑ7SÐTVÐXYÓ7ZÑZˆMà—‘ Ó/ˆàˆØÐÜ'Ó)ˆHÙ˜FŸK™K¨¨D¯K©K×,BÑ,BÓCÀVÇ[Á[ÐQSÃ_ÓUˆDáØ�Y Ô)FÐ)GÐ!HÑHˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä'ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
r9   r¹  )rC   rD   rE   r&   rÌ  r£  rý  r   r»  r   r¼  r   r½  r   r®   rÄ   rÃ   r   r   r@   rF   rG   s   @r8   rî  rî    sÓ   ø„ ôò"
&òCò(ñ +Ð+JÓKÙØ&Ø,Ø$Øô	ð 26Ø,0Ø/3Ø&*Ø)-ñ<
à˜uŸ|™|Ñ,ð<
ð ! §¡Ñ.ð<
ð $ D™>ð	<
ð
 ' t™nð<
ð ˜d‘^ð<
ð ˜Ÿ™Ñ&ð<
ð 
ˆuÐ.Ð.Ñ	/ò<
óó Lô<
r9   rî  zi
    Data2VecAudio Model with a frame classification head on top for tasks like Speaker Diarization.
    c                   óþ   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Z ee«       e	e
eed¬«      	 	 	 	 	 ddeej                     deej                     d	eej                     d
ee   dee   dee   deeef   fd„«       «       Zˆ xZS )Ú(Data2VecAudioForAudioFrameClassificationc                 óÀ  •— t         ‰| �  |«       t        |d«      r|j                  rt	        d«      ‚t        |«      | _        |j                  dz   }|j                  r0t        j                  t        j                  |«      |z  «      | _        t        j                  |j                  |j                   «      | _        |j                   | _        | j%                  «        y )NrT  zgAudio frame classification does not support the use of Data2VecAudio adapters (config.add_adapter=True)r   )r%   r&   rÕ   rT  r‘   r”  r<  r  rð  r   rš  r®   r†  rñ  r‚   rU   rô  rõ  Úinit_weightsrö  s      €r8   r&   z1Data2VecAudioForAudioFrameClassification.__init__•  s°   ø€ Ü‰Ñ˜Ô ä�6˜=Ô)¨f×.@Ò.@ÜØyóð ô 1°Ó8ˆÔØ×-Ñ-°Ñ1ˆ
Ø×(Ò(Ü!#§¡¬e¯j©j¸Ó.DÀzÑ.QÓ!RˆDÔÜŸ)™) F×$6Ñ$6¸×8IÑ8IÓJˆŒØ ×+Ñ+ˆŒà×ÑÕr9   c                 óX   — t        j                  dt        «       | j                  «        yrÆ  rÈ  r¢  s    r8   rÌ  zAData2VecAudioForAudioFrameClassification.freeze_feature_extractor¥  rÍ  r9   c                 óL   — | j                   j                  j                  «        yr   rÏ  r¢  s    r8   r£  z?Data2VecAudioForAudioFrameClassification.freeze_feature_encoder±  rÐ  r9   c                 óP   — | j                   j                  «       D ]	  }d|_        Œ yrû  rü  rr   s     r8   rý  z:Data2VecAudioForAudioFrameClassification.freeze_base_model¸  rþ  r9   r®  rÿ  ry   r¡   rÒ  r£   r
  r  r¤   c           	      óú  — |�|n| j                   j                  }| j                   j                  rdn|}| j                  |||||¬«      }| j                   j                  rr|t           }t        j                  |d¬«      }t        j                  j                  | j                  d¬«      }	||	j                  ddd«      z  j                  d¬«      }n|d   }| j                  |«      }
d}|�\t        «       } ||
j                  d| j                  «      t        j                   |j                  d| j                  «      d¬«      «      }|s|
f|t        d z   }|S t#        ||
|j$                  |j&                  ¬	«      S )
r  NTr´  r   r§   r<   r   )ÚaxisrØ  )r5   r¶  rð  r<  rå  r®   r  r   r²   r³   rñ  r›   r�  rõ  r   rô  Úargmaxr   r?   r  )r4   ry   r¡   rÒ  r£   r
  r  r  r?   r  rÚ  rÙ  r  rê  s                 r8   r@   z0Data2VecAudioForAudioFrameClassification.forwardÀ  sj  € ð. &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆØ'+§{¡{×'IÒ'I™tÐOcÐà×%Ñ%ØØ)Ø/Ø!5Ø#ð &ó 
ˆð �;‰;×-Ò-Ø#Ô$AÑBˆMÜ!ŸK™K¨¸1Ô=ˆMÜŸ=™=×0Ñ0°×1CÑ1CÈÐ0ÓLˆLØ*¨\×->Ñ->¸rÀ1ÀaÓ-HÑH×MÑMÐRSÐMÓT‰Mà# A™JˆMà—‘ Ó/ˆàˆØÐÜ'Ó)ˆHÙ˜FŸK™K¨¨D¯O©OÓ<¼e¿l¹lÈ6Ï;É;ÐWYÐ[_×[jÑ[jÓKkÐrsÔ>tÓuˆDáØ�Y Ô)FÐ)GÐ!HÑHˆFØˆMä$ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
r9   r¹  )rC   rD   rE   r&   rÌ  r£  rý  r   r»  r   r¼  r   r½  r   r®   rÄ   rÃ   r   r   r@   rF   rG   s   @r8   r	  r	  Ž  sÓ   ø„ ôò 
&òCò(ñ +Ð+JÓKÙØ&Ø)Ø$Øô	ð 26Ø)-Ø,0Ø/3Ø&*ñ3
à˜uŸ|™|Ñ,ð3
ð ! §¡Ñ.ð3
ð ˜Ÿ™Ñ&ð	3
ð
 $ D™>ð3
ð ' t™nð3
ð ˜d‘^ð3
ð 
ˆuÐ+Ð+Ñ	,ò3
óó Lô3
r9   r	  c                   ó&   ‡ — e Zd Zdˆ fd„	Zd„ Zˆ xZS )ÚAMSoftmaxLossc                 óæ   •— t         t        | �  «        || _        || _        || _        t        j                  t        j                  ||«      d¬«      | _
        t        j                  «       | _        y )NT)rq   )r%   r  r&   ÚscaleÚmarginrô  r   rš  r®   ÚrandnrÖ   r   rÙ  )r4   Ú	input_dimrô  r  r  r7   s        €r8   r&   zAMSoftmaxLoss.__init__þ  sS   ø€ ÜŒm˜TÑ+Ô-ØˆŒ
ØˆŒØ$ˆŒÜ—l‘l¤5§;¡;¨y¸*Ó#EÐUYÔZˆŒÜ×'Ñ'Ó)ˆ�	r9   c                 óä  — |j                  «       }t        j                  j                  | j                  d¬«      }t        j                  j                  |d¬«      }t        j                  ||«      }|| j                  z
  }t        j                  j                  || j                  «      }| j                  t        j                  |j                  «       ||«      z  }| j                  ||«      }|S )Nr   r§   r   )Úflattenr   r²   Ú	normalizerÖ   r®   Úmmr  Úone_hotrô  r  ÚwhererÃ   rÙ  )	r4   r?   rÒ  rÖ   Ú	cos_thetaÚpsiÚonehotrÚ  rÙ  s	            r8   r@   zAMSoftmaxLoss.forward  s²   € Ø—‘Ó!ˆÜ—‘×(Ñ(¨¯©¸!Ð(Ó<ˆÜŸ™×/Ñ/°À1Ð/ÓEˆÜ—H‘H˜]¨FÓ3ˆ	Ø˜$Ÿ+™+Ñ%ˆä—‘×&Ñ& v¨t¯©Ó?ˆØ—‘œeŸk™k¨&¯+©+«-¸¸iÓHÑHˆØ�y‰y˜ Ó(ˆàˆr9   )g      >@gš™™™™™Ù?rB   rG   s   @r8   r  r  ý  s   ø„ õ*ör9   r  c                   óX   ‡ — e Zd Zdˆ fd„	Zdej
                  dej
                  fd„Zˆ xZS )Ú	TDNNLayerc                 óš  •— t         ‰| �  «        |dkD  r|j                  |dz
     n|j                  |   | _        |j                  |   | _        |j
                  |   | _        |j                  |   | _        t        j                  | j                  | j                  z  | j                  «      | _        t        j                  «       | _        y )Nr   r   )r%   r&   Útdnn_dimr(   r)   Útdnn_kernelr    Útdnn_dilationÚdilationr   r‚   ÚkernelÚReLUr2   r3   s      €r8   r&   zTDNNLayer.__init__  s¡   ø€ Ü‰ÑÔØ<DÀqºL˜6Ÿ?™?¨8°a©<Ò8ÈfÏoÉoÐ^fÑNgˆÔØ"ŸO™O¨HÑ5ˆÔØ!×-Ñ-¨hÑ7ˆÔØ×,Ñ,¨XÑ6ˆŒä—i‘i × 0Ñ 0°4×3CÑ3CÑ CÀT×EVÑEVÓWˆŒÜŸ'™'›)ˆ�r9   r?   r¤   c                 ó&  — t        «       rddlm} t        «       r+t        | j                  «      rt        j                  d«       |j                  dd«      }| j                  j                  j                  | j                  | j                  | j                  «      j                  dd«      }t        j                  j                  ||| j                  j                   | j"                  ¬«      }|j                  dd«      }| j%                  |«      }|S )Nr   )Ú	LoraLayerz‡Detected LoRA on TDNNLayer. LoRA weights won't be applied due to optimization. You should exclude TDNNLayer from LoRA's target modules.r   rK   )r(  )r   Úpeft.tuners.lorar,  rë   r)  rÉ  rÊ  r=   rÖ   r›   r)   r    r(   r   r²   Úconv1dr"   r(  r2   )r4   r?   r,  rÖ   s       r8   r@   zTDNNLayer.forward  sØ   € ÜÔÝ2äÔÜ˜$Ÿ+™+ yÔ1Ü—‘ðOôð &×/Ñ/°°1Ó5ˆØ—‘×#Ñ#×(Ñ(¨×):Ñ):¸D×<LÑ<LÈd×N^ÑN^Ó_×iÑiÐjkÐmnÓoˆÜŸ™×,Ñ,¨]¸FÀDÇKÁK×DTÑDTÐ_c×_lÑ_lÐ,ÓmˆØ%×/Ñ/°°1Ó5ˆàŸ™¨Ó6ˆØÐr9   rA   )rC   rD   rE   r&   r®   rÄ   r@   rF   rG   s   @r8   r#  r#    s#   ø„ õ$ð U§\¡\ð °e·l±l÷ r9   r#  zq
    Data2VecAudio Model with an XVector feature extraction head on top for tasks like Speaker Verification.
    c                   ó(  ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Zdeej                  e
f   fd„Z ee«       eeeed¬«      	 	 	 	 	 dd	eej&                     d
eej&                     dee   dee   dee   deej&                     deeef   fd„«       «       Zˆ xZS )ÚData2VecAudioForXVectorc                 ó  •— t         ‰| �  |«       t        |«      | _        |j                  dz   }|j
                  r0t        j                  t        j                  |«      |z  «      | _
        t        j                  |j                  |j                  d   «      | _        t        t!        |j                  «      «      D �cg c]  }t#        ||«      ‘Œ }}t        j$                  |«      | _        t        j                  |j                  d   dz  |j(                  «      | _        t        j                  |j(                  |j(                  «      | _        t/        |j(                  |j0                  «      | _        | j5                  «        y c c}w )Nr   r   r<   rK   )r%   r&   r”  r<  r  rð  r   rš  r®   r†  rñ  r‚   rU   r%  ró  r`   r„  r#  r_   ÚtdnnÚxvector_output_dimr–  rõ  r  rô  Ú	objectiver  )r4   r5   r÷  rm   Útdnn_layersr7   s        €r8   r&   z Data2VecAudioForXVector.__init__;  s  ø€ Ü‰Ñ˜Ô ä0°Ó8ˆÔØ×-Ñ-°Ñ1ˆ
Ø×(Ò(Ü!#§¡¬e¯j©j¸Ó.DÀzÑ.QÓ!RˆDÔÜŸ™ 6×#5Ñ#5°v·±ÀqÑ7IÓJˆŒä5:¼3¸v¿¹Ó;OÓ5PÖQ°”y ¨Õ+ÐQˆÐQÜ—M‘M +Ó.ˆŒ	ä!#§¡¨6¯?©?¸2Ñ+>ÀÑ+BÀF×D]ÑD]Ó!^ˆÔÜŸ)™) F×$=Ñ$=¸v×?XÑ?XÓYˆŒä& v×'@Ñ'@À&×BSÑBSÓTˆŒà×ÑÕùò Rs   Â>Fc                 óX   — t        j                  dt        «       | j                  «        yrÆ  rÈ  r¢  s    r8   rÌ  z0Data2VecAudioForXVector.freeze_feature_extractorN  rÍ  r9   c                 óL   — | j                   j                  j                  «        yr   rÏ  r¢  s    r8   r£  z.Data2VecAudioForXVector.freeze_feature_encoderZ  rÐ  r9   c                 óP   — | j                   j                  «       D ]	  }d|_        Œ yrû  rü  rr   s     r8   rý  z)Data2VecAudioForXVector.freeze_base_modela  rþ  r9   rS  c                 óV   — d„ }| j                   j                  D ]  } |||d«      }Œ |S )z?
        Computes the output length of the TDNN layers
        c                 ó   — | |z
  |z  dz   S )Nr   r  rZ  s      r8   r\  zJData2VecAudioForXVector._get_tdnn_output_lengths.<locals>._conv_out_lengthn  s   € ð ! ;Ñ.°6Ñ9¸AÑ=Ð=r9   r   )r5   r&  )r4   rS  r\  r    s       r8   Ú_get_tdnn_output_lengthsz0Data2VecAudioForXVector._get_tdnn_output_lengthsi  s:   € ò
	>ð
  Ÿ;™;×2Ñ2ò 	LˆKÙ,¨]¸KÈÓK‰Mð	Lð Ðr9   r®  rÿ  ry   r¡   r£   r
  r  rÒ  r¤   c                 óö  — |�|n| j                   j                  }| j                   j                  rdn|}| j                  |||||¬«      }| j                   j                  rr|t           }t        j                  |d¬«      }t        j                  j                  | j                  d¬«      }	||	j                  ddd«      z  j                  d¬«      }n|d   }| j                  |«      }| j                  D ]
  }
 |
|«      }Œ |€%|j                  d¬«      }|j!                  d¬«      }nÃ| j#                  |j                  d¬«      «      }| j%                  |«      }g }g }t'        |«      D ]U  \  }}|j)                  ||d|…f   j                  d¬«      «       |j)                  ||d|…f   j!                  d¬«      «       ŒW t        j                  |«      }t        j                  |«      }t        j*                  ||gd¬«      }| j-                  |«      }| j/                  |«      }d}|�| j1                  ||«      }|s||f|t        d z   }|�|f|z   S |S t3        ||||j4                  |j6                  ¬«      S )	r  NTr´  r   r§   r<   r   )rÙ  rÚ  Ú
embeddingsr?   r  )r5   r¶  rð  r<  rå  r®   r  r   r²   r³   rñ  r›   r�  ró  r2  r@  rA  r^  r;  Ú	enumeraterˆ  r¯   r–  rõ  r4  r   r?   r  )r4   ry   r¡   r£   r
  r  rÒ  r  r?   r  Ú
tdnn_layerÚmean_featuresÚstd_featuresÚfeat_extract_output_lengthsÚtdnn_output_lengthsrm   ÚlengthÚstatistic_poolingÚoutput_embeddingsrÚ  rÙ  rê  s                         r8   r@   zData2VecAudioForXVector.forwardx  s›  € ð. &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆØ'+§{¡{×'IÒ'I™tÐOcÐà×%Ñ%ØØ)Ø/Ø!5Ø#ð &ó 
ˆð �;‰;×-Ò-Ø#Ô$AÑBˆMÜ!ŸK™K¨¸1Ô=ˆMÜŸ=™=×0Ñ0°×1CÑ1CÈÐ0ÓLˆLØ*¨\×->Ñ->¸rÀ1ÀaÓ-HÑH×MÑMÐRSÐMÓT‰Mà# A™JˆMàŸ™ }Ó5ˆàŸ)™)ò 	6ˆJÙ& }Ó5‰Mð	6ð Ð!Ø)×.Ñ.°1Ð.Ó5ˆMØ(×,Ñ,°Ð,Ó3‰Là*.×*OÑ*OÐP^×PbÑPbÐghÐPbÓPiÓ*jÐ'Ø"&×"?Ñ"?Ð@[Ó"\ÐØˆMØˆLÜ&Ð':Ó;ò J‘	��6Ø×$Ñ$ ]°1°g°v°g°:Ñ%>×%CÑ%CÈÐ%CÓ%JÔKØ×#Ñ# M°!°W°f°W°*Ñ$=×$AÑ$AÀaÐ$AÓ$HÕIðJô "ŸK™K¨Ó6ˆMÜ Ÿ;™; |Ó4ˆLÜ!ŸI™I }°lÐ&CÈÔLÐà ×2Ñ2Ð3DÓEÐØ—‘Ð!2Ó3ˆàˆØÐØ—>‘> &¨&Ó1ˆDáØÐ/Ð0°7Ô;XÐ;YÐ3ZÑZˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEäØØØ(Ø!×/Ñ/Ø×)Ñ)ô
ð 	
r9   r¹  )rC   rD   rE   r&   rÌ  r£  rý  r   r®   rr  rÁ   r;  r   r»  r   r¼  r   r½  r   rÄ   rÃ   r   r@   rF   rG   s   @r8   r0  r0  4  s÷   ø„ ôò&
&òCò(ð°e¸E×<LÑ<LÈcÐ<QÑ6Ró ñ +Ð+JÓKÙØ&Ø!Ø$Øô	ð 26Ø,0Ø/3Ø&*Ø)-ñI
à˜uŸ|™|Ñ,ðI
ð ! §¡Ñ.ðI
ð $ D™>ð	I
ð
 ' t™nðI
ð ˜d‘^ðI
ð ˜Ÿ™Ñ&ðI
ð 
ˆu�mÐ#Ñ	$òI
óó LôI
r9   r0  )r	  rÀ  rî  r0  r”  r;  rO   )QrB  rÉ  Útypingr   r   r   Únumpyr7  r®   r   Útorch.nnr   Úactivationsr	   Úintegrations.deepspeedr
   Úintegrations.fsdpr   Úmodeling_flash_attention_utilsr   r   Úmodeling_outputsr   r   r   r   r   r   Úmodeling_utilsr   Úutilsr   r   r   r   r   Úconfiguration_data2vec_audior   r   Ú
get_loggerrC   r×   r¼  r½  ÚModuler   rI   rQ   r\   rg   r}   rŠ   rÆ   rß   rå   rù   r÷   r  r(  r0  r;  rÁ   rÂ   rr  Úndarrayr’  r¾  ÚDATA2VEC_AUDIO_START_DOCSTRINGr»  r·  r”  rå  rë  rì  rÀ  rî  r	  r  r#  r0  Ú__all__r  r9   r8   ú<module>rW     s*  ðó Û ß )Ñ )ã Û Ý Ý %å !Ý @Ý 7ß h÷÷ õ .÷õ õ >ñ ÔÝJð 
ˆ×	Ñ	˜HÓ	%€ð :Ð ð (€ô˜RŸY™Yô ô6˜BŸI™Iô ô r§y¡yô ô6¨2¯9©9ô ô  "§)¡)ô  ôF1 R§Y¡Yô 1ô[B˜RŸY™Yô [Bô|{9Ð#9ô {9ô|g1Ð!7ô g1ôT˜rŸy™yô ð2 $Ø&Ø5ñ$Ð  ô  §	¡	ô  ôFR
˜2Ÿ9™9ô R
ôj §	¡	ô ô$˜2Ÿ9™9ô ô>O ?ô Oðl 26ØñtØ��c�‰?ðtàðtð ðtð ˜U×-Ñ-Ñ.ð	tð
 ðtð ‡Z�Zótòn 'Ð ð"Ð ð$"#Ð ðH  7Ð ñ ØmØ"óôA
Ð5ó A
ó	ðA
ðH !"Ð ð uÐ ØÐ ñ ØuØ"óôu
Ð6ó u
ó	ðu
ñp ðð #óôp
Ð-Ió p
óðp
ñf ðð #ó	ôf
Ð/Kó f
óðf
ôR�B—I‘Iô ô.�—	‘	ô ñ@ ðð #ó	ôN
Ð:ó N
óðN
òb�r9   