+
    œ°³j‘^  ã                   ót  € ^ RI t ^ RIHt ^ RIHt ^ RIt^ RIHt ^RIHt ^RI	H
t
 ^RIHt ^RIHt ^R	IHtHtHt ^R
IHtHt ^RIHt ^RIHtHtHtHtHt ^RIHt ^RI H!t! ^RI"H#t# ^RI$H%t%H&t& ]PN                  ! ](4      t)R(R R llt* ! R R]PV                  4      t, ! R R]4      t-] ! R R]4      4       t.]! RR7       ! R R].4      4       t/ ! R R]PV                  4      t0]! RR7      ] ! R  R!]4      4       4       t1]! R"R7       ! R# R$].4      4       t2]! R%R7       ! R& R'].]4      4       t3. R)Ot4R# )*é    N)ÚCallable)Ú	dataclass)Únn)ÚACT2FN)ÚCache)ÚGenerationMixin)ÚGradientCheckpointingLayer)ÚBaseModelOutputWithPastÚBaseModelOutputWithPoolingÚCausalLMOutputWithPast)ÚALL_ATTENTION_FUNCTIONSÚPreTrainedModel)ÚUnpack)ÚTransformersKwargsÚauto_docstringÚcan_return_tupleÚloggingÚtorch_compilable_check)Úmerge_with_config_defaults)Úcapture_outputs)Ú	AutoModel)ÚVoxtralConfigÚVoxtralEncoderConfigc                óì   € V ^8„  d   QhR\         P                  R\        P                  R\        P                  R\        P                  R\        P                  R,          R\        R,          R\        /# )	é   ÚmoduleÚqueryÚkeyÚvalueÚattention_maskNÚscalingÚdropout)r   ÚModuleÚtorchÚTensorÚfloat)Úformats   "Úm/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/voxtral/modeling_voxtral.pyÚ__annotate__r)   .   sk   € ÷ %ñ %Ü�I‰Ið%ä�<‰<ð%ô 
�‰ð%ô �<‰<ð	%ô
 —L‘L 4Õ'ð%ô �T�\ð%ô ñ%ó    c                 ó¶  € Vf   VP                  R4      R,          p\        P                  ! WP                  ^^4      4      V,          pVe	   W„,           p\        P
                  P                  VRR7      p\        P
                  P                  W†V P                  R7      p\        P                  ! Wƒ4      p	V	P                  ^^4      P                  4       p	W˜3# )N)Údim©ÚpÚtrainingéÿÿÿÿç      à¿)
Úsizer$   ÚmatmulÚ	transposer   Ú
functionalÚsoftmaxr"   r/   Ú
contiguous)
r   r   r   r   r    r!   r"   ÚkwargsÚattn_weightsÚattn_outputs
   &&&&&&&,  r(   Úeager_attention_forwardr;   .   s¯   € ð ‚Ø—*‘*˜R“. DÕ(ˆä—<’< §}¡}°Q¸Ó':Ó;¸gÕE€LØÒ!Ø#Õ4ˆä—=‘=×(Ñ(¨¸2Ð(Ó>€Lä—=‘=×(Ñ(¨È6Ï?É?Ð(Ó[€LÜ—,’,˜|Ó3€KØ×'Ñ'¨¨1Ó-×8Ñ8Ó:€KàÐ$Ð$r*   c                   ón   a a€ ] tR t^Ht oRtR	V3R lV 3R llltV3R lR ltR
V3R lR lltRtVt	V ;t
# )ÚVoxtralAttentionz=Multi-headed attention from 'Attention Is All You Need' paperc                óf   <€ V ^8„  d   QhRS[ RS[ RS[RS[RS[RS[RS[ R,          R	S[R,          /# )
r   Ú	embed_dimÚ	num_headsr"   Ú
is_decoderÚbiasÚ	is_causalÚ	layer_idxNÚconfig)Úintr&   Úboolr   )r'   Ú__classdict__s   "€r(   r)   ÚVoxtralAttention.__annotate__K   sn   ø€ ÷ &Cñ &Cáð&Cñ ð&Cñ ð	&Cñ
 ð&Cñ ð&Cñ ð&Cñ ˜•:ð&Cñ  Õ$ñ&Cr*   c	                ó˜  <€ \         S	V `  4        Wn        W n        W0n        W,          V n        W€n        V P
                  V,          V P                  8w  d   \        R V P                   RV R24      hV P
                  R,          V n        W@n	        W`n
        Vf6   V'       d.   \        P                  RV P                  P                   R24       Wpn        \         P"                  ! WRR7      V n        \         P"                  ! WVR7      V n        \         P"                  ! WVR7      V n        \         P"                  ! WVR7      V n        R# )	z;embed_dim must be divisible by num_heads (got `embed_dim`: z and `num_heads`: z).NzInstantiating a decoder z³ without passing `layer_idx` is not recommended and will to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` when creating this class.F©rB   r1   )ÚsuperÚ__init__r?   r@   r"   Úhead_dimrE   Ú
ValueErrorr!   rA   rC   ÚloggerÚwarning_onceÚ	__class__Ú__name__rD   r   ÚLinearÚk_projÚv_projÚq_projÚout_proj)
Úselfr?   r@   r"   rA   rB   rC   rD   rE   rR   s
   &&&&&&&&&€r(   rM   ÚVoxtralAttention.__init__K   s  ø€ ô 	‰ÑÔØ"ŒØ"ŒØŒØ!Õ.ˆŒØŒà�M‰M˜IÕ%¨$¯.©.Ô8ÜØMÈdÏnÉnÐM]Ø$ Y K¨rð3óð ð —}‘} dÕ*ˆŒØ$ŒØ"ŒàÒ§Ü×ÑØ*¨4¯>©>×+BÑ+BÐ*Cð D,ð ,ôð
 #Œä—i’i 	¸5ÔAˆŒÜ—i’i 	¸4Ô@ˆŒÜ—i’i 	¸4Ô@ˆŒÜŸ	š	 )¸TÔBˆŽr*   c                ó@   <€ V ^8„  d   QhRS[ P                  RS[RS[/# )r   ÚtensorÚseq_lenÚbsz)r$   r%   rF   )r'   rH   s   "€r(   r)   rI   s   s+   ø€ ÷ eñ e™UŸ\™\ð e±Cð e¹cñ er*   c                óŒ   € VP                  W2V P                  V P                  4      P                  ^^4      P	                  4       # )é   )Úviewr@   rN   r4   r7   )rY   r\   r]   r^   s   &&&&r(   Ú_shapeÚVoxtralAttention._shapes   s5   € Ø�{‰{˜3¨¯©¸¿¹ÓG×QÑQÐRSÐUVÓW×bÑbÓdÐdr*   c                óê   <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[RS[S[ P                  S[ P                  R,          S[S[ P                  ,          R,          3,          /# )r   Úhidden_statesr    NÚoutput_attentionsÚreturn)r$   r%   rG   Útuple)r'   rH   s   "€r(   r)   rI   v   sg   ø€ ÷ ')ñ ')á—|‘|ð')ñ Ÿ™ tÕ+ð')ñ  ð	')ñ 
‰u�|‰|™UŸ\™\¨DÕ0±%¹¿¹Õ2EÈÕ2LÐLÕ	Mñ')r*   c           	     ó@  € VP                  4       w  rVpV P                  V P                  V4      V P                  ,          We4      pV P                  V P	                  V4      RV4      p	V P                  V P                  V4      RV4      p
\        P                  ! V P                  P                  \        4      pT! V VV	V
V3RV P                  '       g   RMV P                  RRRV/VB w  rÍVP                  WVR4      P                  4       pV P                  V4      pWÍ3# )z#Input shape: Batch x Time x Channelr"   ç        r!   ç      ð?rf   r0   )r2   rb   rW   r!   rU   rV   r   Úget_interfacerE   Ú_attn_implementationr;   r/   r"   Úreshaper7   rX   )rY   re   r    rf   r8   r^   Útgt_lenÚ_Úquery_statesÚ
key_statesÚvalue_statesÚattention_interfacer:   r9   s   &&&&,         r(   ÚforwardÚVoxtralAttention.forwardv   s  € ð (×,Ñ,Ó.‰ˆ�að —{‘{ 4§;¡;¨}Ó#=ÀÇÁÕ#LÈgÓ[ˆØ—[‘[ §¡¨]Ó!;¸RÀÓEˆ
Ø—{‘{ 4§;¡;¨}Ó#=¸rÀ3ÓGˆä(?×(MÒ(MØ�K‰K×,Ñ,Ô.Eó)
Ðñ %8ØØØØØñ
%
ð  $Ÿ}Ÿ}˜}‘C°$·,±,ð
%
ð ð
%
ð 0ð
%
ð ñ
%
Ñ!ˆð "×)Ñ)¨#¸Ó;×FÑFÓHˆØ—m‘m KÓ0ˆàÐ(Ð(r*   )rE   r"   r?   rN   rC   rA   rU   rD   r@   rX   rW   r!   rV   )rj   FTFNN)NF)rS   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rM   rb   ru   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©rR   rH   s   @@r(   r=   r=   H   s0   ù‡ € ÙG÷&Cõ &C÷Peð e÷')÷ ')ò ')r*   r=   c                   óP   a a€ ] tR t^ t oV3R lV 3R lltV3R lR ltRtVtV ;t# )ÚVoxtralEncoderLayerc                ó    <€ V ^8„  d   QhRS[ /# ©r   rE   ©r   )r'   rH   s   "€r(   r)   Ú VoxtralEncoderLayer.__annotate__¡   s   ø€ ÷ =ñ =™}ñ =r*   c                óz  <€ \         SV `  4        VP                  V n        \	        V P                  VP
                  VP                  VR 7      V n        \        P                  ! V P                  4      V n
        VP                  V n        \        VP                  ,          V n        VP                  V n        \        P                   ! V P                  VP"                  4      V n        \        P                   ! VP"                  V P                  4      V n        \        P                  ! V P                  4      V n        R# ))r?   r@   r"   rE   N)rL   rM   Úd_modelr?   r=   Úencoder_attention_headsÚattention_dropoutÚ	self_attnr   Ú	LayerNormÚself_attn_layer_normr"   r   Úactivation_functionÚactivation_fnÚactivation_dropoutrT   Úencoder_ffn_dimÚfc1Úfc2Úfinal_layer_norm©rY   rE   rR   s   &&€r(   rM   ÚVoxtralEncoderLayer.__init__¡   sÑ   ø€ Ü‰ÑÔØŸ™ˆŒä)Ø—n‘nØ×4Ñ4Ø×,Ñ,Øô	
ˆŒô %'§L¢L°·±Ó$@ˆÔ!Ø—~‘~ˆŒÜ# F×$>Ñ$>Õ?ˆÔØ"(×";Ñ";ˆÔÜ—9’9˜TŸ^™^¨V×-CÑ-CÓDˆŒÜ—9’9˜V×3Ñ3°T·^±^ÓDˆŒÜ "§¢¨T¯^©^Ó <ˆÖr*   c                ó~   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[S[,          RS[ P                  /# )r   re   r    r8   rg   )r$   r%   r   r   )r'   rH   s   "€r(   r)   r„   ³   sE   ø€ ÷ "ñ "á—|‘|ð"ñ Ÿ™ð"ñ Ñ+Õ,ð	"ñ
 
�‰ñ"r*   c                ó  € TpV P                  V4      pV P                  ! RRVRV/VB w  r\        P                  P	                  WP                  V P
                  R7      pWA,           pTpV P                  V4      pV P                  V P                  V4      4      p\        P                  P	                  WP                  V P
                  R7      pV P                  V4      p\        P                  P	                  WP                  V P
                  R7      pWA,           pVP                  \        P                  8X  dK   \        P                  ! VP                  4      P                  R,
          p\        P                   ! W) VR7      pV# )a  
Args:
    hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
    attention_mask (`torch.FloatTensor`): attention mask of size
        `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
re   r    r-   iè  )ÚminÚmax© )r‹   r‰   r   r5   r"   r/   r’   r�   r�   rŽ   r‘   Údtyper$   Úfloat16Úfinfor˜   Úclamp)rY   re   r    r8   Úresidualrp   Úclamp_values   &&&,   r(   ru   ÚVoxtralEncoderLayer.forward³   sI  € ð !ˆØ×1Ñ1°-Ó@ˆØŸ>š>ñ 
Ø'ð
à)ð
ð ñ
Ñˆô
 Ÿ™×-Ñ-¨m¿|¹|ÐVZ×VcÑVcÐ-ÓdˆØ Õ0ˆà ˆØ×-Ñ-¨mÓ<ˆØ×*Ñ*¨4¯8©8°MÓ+BÓCˆÜŸ™×-Ñ-¨m×?VÑ?VÐae×anÑanÐ-ÓoˆØŸ™ Ó/ˆÜŸ™×-Ñ-¨m¿|¹|ÐVZ×VcÑVcÐ-ÓdˆØ Õ0ˆà×Ñ¤%§-¡-Ô/ÜŸ+š+ m×&9Ñ&9Ó:×>Ñ>ÀÕEˆKÜ!ŸKšK¨¸<È[ÔYˆMàÐr*   )	rŽ   r�   r"   r?   r�   r‘   r’   r‰   r‹   ©	rS   rw   rx   ry   rM   ru   r{   r|   r}   r~   s   @@r(   r€   r€       s   ù‡ € ÷=ó =÷$"÷ "ð "r*   r€   c                   óZ   a € ] tR t^Øt o RtRtRtRtR.tRt	Rt
RtRtRtRtV 3R ltRtV tR# )ÚVoxtralPreTrainedModelÚmodelTNÚpast_key_valuesc                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # r‚   rƒ   )r'   rH   s   "€r(   r)   Ú#VoxtralPreTrainedModel.__annotate__Ø   s   ø‡ ‚ áÑò r*   r™   )ÚaudioÚtext)rS   rw   rx   ry   Úbase_model_prefixÚinput_modalitiesÚsupports_gradient_checkpointingÚ_no_split_modulesÚ_skip_keys_device_placementÚ_supports_flash_attnÚ_supports_sdpaÚ_supports_flex_attnÚ_supports_cache_classÚ_supports_attention_backendÚ_can_compile_fullgraphÚ__annotate_func__r{   r|   ©rH   s   @r(   r£   r£   Ø   sR   ø‡ € ð  ÐØ(ÐØ&*Ð#ØÐØ#4Ð"5ÐØÐØ€NØÐØ ÐØ"&ÐØ!Ð÷ ƒ r*   r£   z:
    The Voxtral encoder, which is a Whisper encoder.
    ©Úcustom_introc                   óÎ   a a€ ] tR t^èt oRtRtRtR.tR]R]	/t
V3R lV 3R lltR	 tV3R
 lR ltV3R lR lt]]RV3R lR ll4       4       tV3R lR ltV3R ltRtVtV ;t# )ÚVoxtralEncoderz£
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`VoxtralEncoderLayer`].

Args:
    config: VoxtralEncoderConfig
Úinput_featuresr¨   r€   Ú
attentionsre   c                ó    <€ V ^8„  d   QhRS[ /# r‚   ©r   )r'   rH   s   "€r(   r)   ÚVoxtralEncoder.__annotate__   s   ø€ ÷ ñ Ñ3ñ r*   c                ó€  <€ \         SV `  V4       VP                  V n        VP                  V n        VP
                  pVP                  V n        VP                  V n        VP                  '       d   \        P                  ! V4      MR V n        \        P                  ! V P                  V^^R7      V n        \        P                  ! W"^^^R7      V n        \        P                   ! V P                  V4      V n        V P"                  P%                  R4       \        P&                  ! \)        VP*                  4       Uu. uF  p\-        V4      NK  	  up4      V n        \        P0                  ! VP
                  4      V n        \        P4                  ! ^^R7      V n        RV n        V P;                  4        R# u upi )rk   )Úkernel_sizeÚpadding)rÁ   ÚstriderÂ   F)rÃ   N)rL   rM   r"   Úencoder_layerdropÚ	layerdropr†   Únum_mel_binsÚmax_source_positionsÚscale_embeddingÚmathÚsqrtÚembed_scaler   ÚConv1dÚconv1Úconv2Ú	EmbeddingÚembed_positionsÚrequires_grad_Ú
ModuleListÚrangeÚencoder_layersr€   ÚlayersrŠ   Ú
layer_normÚ	AvgPool1dÚ
avg_poolerÚgradient_checkpointingÚ	post_init)rY   rE   r?   rp   rR   s   &&  €r(   rM   ÚVoxtralEncoder.__init__   s=  ø€ Ü‰Ñ˜Ô Ø—~‘~ˆŒØ×1Ñ1ˆŒà—N‘Nˆ	Ø"×/Ñ/ˆÔØ$*×$?Ñ$?ˆÔ!Ø39×3I×3IÐ3Iœ4Ÿ9š9 YÔ/ÈsˆÔä—Y’Y˜t×0Ñ0°)ÈÐTUÔVˆŒ
Ü—Y’Y˜yÀÈ1ÐVWÔXˆŒ
ä!Ÿ|š|¨D×,EÑ,EÀyÓQˆÔØ×Ñ×+Ñ+¨EÔ2ä—m’mÌ%ÐPV×PeÑPeÔJfÓ$gÑJfÀQÔ%8¸Ö%@ÑJfÑ$gÓhˆŒÜŸ,š, v§~¡~Ó6ˆŒäŸ,š, q°Ô3ˆŒà&+ˆÔ#à�‰Öùò %hs   Å F;c                óP   € V P                  4        F
  pR Vn        K  	  R V n        R# )FN)Ú
parametersÚrequires_gradÚ_requires_grad)rY   Úparams   & r(   Ú_freeze_parametersÚ!VoxtralEncoder._freeze_parameters  s#   € Ø—_‘_Ö&ˆEØ"'ˆEÖñ 'à#ˆÖr*   c                ó4   <€ V ^8„  d   QhRS[ P                  /# )r   rg   ©r   r#   )r'   rH   s   "€r(   r)   r¿     s   ø€ ÷ ñ ¡b§i¡iñ r*   c                ó   € V P                   # ©N©rÍ   )rY   s   &r(   Úget_input_embeddingsÚ#VoxtralEncoder.get_input_embeddings  s   € Ø�z‰zÐr*   c                ó4   <€ V ^8„  d   QhRS[ P                  /# )r   r   rä   )r'   rH   s   "€r(   r)   r¿   !  s   ø€ ÷ ñ ©"¯)©)ñ r*   c                ó   € Wn         R # ræ   rç   )rY   r   s   &&r(   Úset_input_embeddingsÚ#VoxtralEncoder.set_input_embeddings!  s   € ØŽ
r*   c                óF   <€ V ^8„  d   QhRS[ S[,          RS[S[,          /# )r   r8   rg   )r   r   rh   r   )r'   rH   s   "€r(   r)   r¿   &  s-   ø€ ÷ +
ñ +
ñ Ñ+Õ,ð	+
ñ
 
Ñ+Õ	+ñ+
r*   c           	     ó  € V P                   P                  V P                  P                  ^ ,          ,          V P                  P                  ^ ,          ,          pVP
                  R	,          V8w  d'   \        RV RVP
                  R	,           RV R24      hVP                  V P                  P                  P                  V P                  P                  P                  R7      p\        P                  P                  V P                  V4      4      p\        P                  P                  V P	                  V4      4      pVP                  ^ ^^4      pV P                  P                  pWV,           P                  VP                  4      p\        P                  P!                  WpP                   V P"                  R7      p\%        V P&                  4       F  w  r‰V	! VVR7      pK  	  V P)                  V4      p\+        VR7      # )
a�  
Args:
    input_features (`torch.LongTensor` of shape `(batch_size, feature_size, sequence_length)`):
        Float values of mel features extracted from the raw speech waveform. Raw speech waveform 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_features`, the [`AutoFeatureExtractor`] should be used for extracting the mel features, padding
        and conversion into a tensor of type `torch.FloatTensor`. See [`~WhisperFeatureExtractor.__call__`]
    attention_mask (`torch.Tensor`)`, *optional*):
        Voxtral does not support masking of the `input_features`, this argument is preserved for compatibility,
        but it is not used. By default the silence in the input log mel spectrogram are ignored.
z7Voxtral expects the mel input features to be of length z, but found z-. Make sure to pad the input mel features to Ú.©rš   Údevicer-   )r    )Úlast_hidden_stater0   )rE   rÇ   rÍ   rÃ   rÎ   ÚshaperO   ÚtoÚweightrš   rò   r   r5   ÚgeluÚpermuterÐ   r"   r/   Ú	enumeraterÕ   rÖ   r   )
rY   r»   r    r8   Úexpected_seq_lengthÚinputs_embedsÚ	embed_posre   ÚidxÚencoder_layers
   &&&,      r(   ru   ÚVoxtralEncoder.forward$  sÊ  € ð( #Ÿk™k×>Ñ>ÀÇÁ×ARÑARÐSTÕAUÕUÐX\×XbÑXb×XiÑXiÐjkÕXlÕlÐØ×Ñ Õ#Ð':Ô:ÜØIÐJ]ÐI^Ð^jÐky×kÑkð  ACõ  lDð  kEð  Erð  sFð  rGð  GHð  Ióð ð (×*Ñ*°·±×1BÑ1B×1HÑ1HÐQU×Q[ÑQ[×QbÑQb×QiÑQiÐ*ÓjˆÜŸ™×*Ñ*¨4¯:©:°nÓ+EÓFˆÜŸ™×*Ñ*¨4¯:©:°mÓ+DÓEˆØ%×-Ñ-¨a°°AÓ6ˆà×(Ñ(×/Ñ/ˆ	Ø&Õ2×6Ñ6°}×7JÑ7JÓKˆÜŸ™×-Ñ-¨m¿|¹|ÐVZ×VcÑVcÐ-Ódˆä"+¨D¯K©KÖ"8ÑˆCÙ)ØØ-ôŠMñ #9ð Ÿ™¨Ó6ˆä)Ø+ô
ð 	
r*   c                ó4   <€ V ^8„  d   QhRS[ P                  /# )r   Úinput_lengths)r$   Ú
LongTensor)r'   rH   s   "€r(   r)   r¿   T  s   ø€ ÷ -ñ -¹e×>NÑ>Nñ -r*   c                ód   € V^,
          ^,          ^,           pV^,
          ^,          ^,           pW3# )zc
Computes the output length of the convolutional layers and the output length of the audio encoder
r™   )rY   r  Úoutput_lengthss   && r(   Ú _get_feat_extract_output_lengthsÚ/VoxtralEncoder._get_feat_extract_output_lengthsT  s5   € ð '¨Õ*¨qÕ0°1Õ4ˆØ'¨!Õ+°Õ1°AÕ5ˆØÐ,Ð,r*   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # r‚   r¾   )r'   rH   s   "€r(   r)   r¿   è   s   ø‡ ‚ ñ !Ñ ò r*   )rß   rØ   rÍ   rÎ   r"   rÐ   rË   rÙ   rÖ   rÅ   rÕ   rÇ   rÆ   ræ   )rS   rw   rx   ry   rz   Úmain_input_namer«   r­   r=   r€   Ú_can_record_outputsrM   rá   rè   rì   r   r   ru   r  rµ   r{   r|   r}   r~   s   @@r(   rº   rº   è   s‹   ù‡ € ñð '€OØÐØ.Ð/ÐàÐ&ØÐ,ðÐ÷
ó ò2$÷
ð ÷ð ð  Ø÷+
ñ +
ó ó  ð+
÷\-ð -÷Y … r*   rº   c                   óD   a a€ ] tR tRt oV3R lV 3R lltR tRtVtV ;t# )ÚVoxtralMultiModalProjectori]  c                ó    <€ V ^8„  d   QhRS[ /# r‚   rƒ   )r'   rH   s   "€r(   r)   Ú'VoxtralMultiModalProjector.__annotate__^  s   ø€ ÷ nñ n™}ñ nr*   c                ót  <€ \         SV `  4        \        P                  ! VP                  P
                  VP                  P                  R R7      V n        \        VP                  ,          V n        \        P                  ! VP                  P                  VP                  P                  R R7      V n        R# ©FrK   N)rL   rM   r   rT   Úaudio_configÚintermediate_sizeÚtext_configÚhidden_sizeÚlinear_1r   Úprojector_hidden_actÚactÚlinear_2r“   s   &&€r(   rM   Ú#VoxtralMultiModalProjector.__init__^  sz   ø€ Ü‰ÑÔÜŸ	š	 &×"5Ñ"5×"GÑ"GÈ×I[ÑI[×IgÑIgÐnsÔtˆŒÜ˜&×5Ñ5Õ6ˆŒÜŸ	š	 &×"4Ñ"4×"@Ñ"@À&×BTÑBT×B`ÑB`ÐglÔmˆŽr*   c                ól   € V P                  V4      pV P                  V4      pV P                  V4      pV# ræ   )r  r  r  )rY   Úaudio_featuresre   s   && r(   ru   Ú"VoxtralMultiModalProjector.forwardd  s2   € ØŸ™ nÓ5ˆØŸ™ Ó/ˆØŸ™ mÓ4ˆØÐr*   )r  r  r  r¡   r~   s   @@r(   r  r  ]  s   ù‡ € ÷nó n÷ò r*   r  zL
    Base class for Voxtral outputs, with hidden states and attentions.
    c                   ó4   a € ] tR tRt o RtRtV 3R ltRtV tR# )ÚVoxtralModelOutputWithPastik  z[
audio_hidden_states (`torch.FloatTensor`, *optional*):
    Projected audio hidden states.
Nc                óH   <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   # )r   NÚaudio_hidden_states)r$   ÚFloatTensor)r'   rH   s   "€r(   r)   Ú'VoxtralModelOutputWithPast.__annotate__k  s   ø‡ ‚ ñ ×*Ñ*¨TÕ1Ñ8ò r*   r™   )	rS   rw   rx   ry   rz   r  rµ   r{   r|   r¶   s   @r(   r  r  k  s   ø‡ € ñð
 59Ð÷ ƒ r*   r  z™
    The Voxtral model, which consists of Whisper encoder, a multi-modal projector and a Llama language model,
    without a language modeling head.
    c                   ó¢   a a€ ] tR tRt oV 3R lt]]! RR7      V3R lR l4       4       tV3R lR lt]]RV3R	 lR
 ll4       4       t	Rt
VtV ;t# )ÚVoxtralModeliz  c                óú   <€ \         SV `  V4       \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n        \        V4      V n	        V P                  4        R # ræ   )rL   rM   r   Úfrom_configr  Úaudio_towerr  Úlanguage_modelr  Úmulti_modal_projectorrÚ   r“   s   &&€r(   rM   ÚVoxtralModel.__init__�  sY   ø€ Ü‰Ñ˜Ô Ü$×0Ò0°×1DÑ1DÓEˆÔÜ'×3Ò3°F×4FÑ4FÓGˆÔÜ%?ÀÓ%GˆÔ"Ø�‰Ör*   zŸThis method is used to get the audio embeddings from input features (a log mel spectrogram), meaning inferring the audio encoder and the multi-modal projector.r·   c                ó`   <€ V ^8„  d   QhRS[ P                  RS[S[,          RS[S[,          /# )r   r»   r8   rg   )r$   r   r   r   rh   r   )r'   rH   s   "€r(   r)   ÚVoxtralModel.__annotate__Œ  s7   ø€ ÷ ñ Ù#×/Ñ/ðÙ;AÑBTÕ;Uðá	Ñ+Õ	+ñr*   c                óÖ   € V P                   ! V3RR/VB pVP                  pVP                  RV P                  P                  P
                  4      pV P                  V4      pWSn        V# )a)  
input_features (`torch.FloatTensor`):
    Float values of mel features extracted from the raw speech waveform. Raw speech waveform 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_features`, the [`AutoFeatureExtractor`] should be used for extracting the mel features, padding
    and conversion into a tensor of type `torch.FloatTensor`. See [`~WhisperFeatureExtractor.__call__`]
Úreturn_dictTr0   )r&  ró   rn   rE   r  r  r(  Úpooler_output)rY   r»   r8   Úaudio_outputsr  Úaudio_embedss   &&,   r(   Úget_audio_featuresÚVoxtralModel.get_audio_featuresˆ  sj   € ð ×(Ò(¨ÑTÀTÐTÈVÑTˆØ+×=Ñ=ÐØ1×9Ñ9¸"¸d¿k¹k×>VÑ>V×>hÑ>hÓiÐØ×1Ñ1Ð2EÓFˆØ&2Ô#àÐr*   c                óh   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  /# )r   Ú	input_idsrû   r  )r$   r  r   )r'   rH   s   "€r(   r)   r+  Ÿ  s7   ø€ ÷ "ñ "Ù×)Ñ)ð"Ù:?×:KÑ:Kð"Ù]b×]nÑ]nñ"r*   c           
     ó@  € Vfo   W P                  4       ! \        P                  ! RV P                  P                  \        P
                  VP                  R7      4      8H  pVP                  R4      pMWP                  P                  8H  pVP                  4       pVP                  ^ ,          pVP                  R4      P                  V4      P                  VP                  4      p\        W$,          P                  4       VP                  4       8H  RV RV 24       V# )z×
Obtains multimodal placeholder mask from `input_ids` or `inputs_embeds`, and checks that the placeholder token count is
equal to the length of multimodal features. If the lengths are different, an error is raised.
rñ   z6Audio features and audio tokens do not match, tokens: z, features: r™   r0   )rè   r$   ÚfullrE   Úaudio_token_idÚlongrò   ÚallÚsumrô   Ú	unsqueezeÚ	expand_asrõ   r   Únumel)rY   r4  rû   r  Úspecial_audio_maskÚn_audio_tokensÚn_audio_featuress   &&&&   r(   Úget_placeholder_maskÚ!VoxtralModel.get_placeholder_maskŸ  sþ   € ð ÒØ!.×2KÑ2KÔ2MÜ—
’
˜2˜tŸ{™{×9Ñ9ÄÇÁÐTa×ThÑThÔió3ñ "Ðð "4×!7Ñ!7¸Ó!;Ñà!*¯k©k×.HÑ.HÑ!HÐà+×/Ñ/Ó1ˆØ)×/Ñ/°Õ2ÐØ/×9Ñ9¸"Ó=×GÑGÈÓV×YÑYÐZg×ZnÑZnÓoÐÜØÕ-×3Ñ3Ó5¸×9MÑ9MÓ9OÑOØDÀ^ÐDTÐT`ÐaqÐ`rÐsô	
ð "Ð!r*   c                ó6  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[R,          RS[ P                  R,          RS[R,          R	S[S[,          R
S[S[	,          /	# )r   r4  Nr»   r    Úposition_idsr¥   rû   Ú	use_cacher8   rg   )
r$   r  r   r%   r   rG   r   r   rh   r  )r'   rH   s   "€r(   r)   r+  ¹  s®   ø€ ÷ )
ñ )
á×#Ñ# dÕ*ð)
ñ ×)Ñ)¨DÕ0ð)
ñ Ÿ™ tÕ+ð	)
ñ
 ×&Ñ&¨Õ-ð)
ñ  �ð)
ñ ×(Ñ(¨4Õ/ð)
ñ ˜$•;ð)
ñ Ñ+Õ,ð)
ñ 
Ñ+Õ	+ñ)
r*   c                ó¼  € Vf   V P                  4       ! V4      pR p	Vej   Vef   V P                  VRR7      P                  p	V P                  WV	R7      p
VP	                  W©P                  VP                  VP                  4      4      pV P                  ! R
RVRVRVRVRV/VB p\        VP                  VP                  VP                  VP                  V	R	7      # )NT)r-  )rû   r  r    rD  r¥   rû   rE  )ró   r¥   re   r¼   r  r™   )rè   r1  r.  rA  Úmasked_scatterrõ   rò   rš   r'  r  ró   r¥   re   r¼   )rY   r4  r»   r    rD  r¥   rû   rE  r8   r0  r>  Úoutputss   &&&&&&&&,   r(   ru   ÚVoxtralModel.forward·  s  € ð Ò Ø ×5Ñ5Ô7¸	ÓBˆMàˆØÒ%¨)Ò*?Ø×2Ñ2°>ÈtÐ2ÓT×bÑbˆLð "&×!:Ñ!:ØÀ|ð ";ó "Ðð *×8Ñ8Ø"§O¡O°M×4HÑ4HÈ-×J]ÑJ]Ó$^óˆMð ,0×+>Ò+>ñ ,
Ø)ð,
à%ð,
ð ,ð,
ð (ð	,
ð
  ð,
ð ñ,
ˆô *Ø%×7Ñ7Ø#×3Ñ3Ø!×/Ñ/Ø×)Ñ)Ø ,ô
ð 	
r*   )r&  r'  r(  )NNNNNNN)rS   rw   rx   ry   rM   r   r   r1  rA  ru   r{   r|   r}   r~   s   @@r(   r#  r#  z  sa   ù‡ € õð Ùð wô÷óó ð÷&"ð "ð0 Ø÷)
ñ )
ó ó ÷)
ð )
r*   r#  zs
    The Voxtral model, which consists of Whisper encoder, a multi-modal projector and a Llama language model.
    c                   óh   a a€ ] tR tRt oR.tV 3R ltR t]]RV3R lR ll4       4       t	Rt
VtV ;t# )	ÚVoxtralForConditionalGenerationiå  rÐ   c                óò   <€ \         SV `  V4       \        V4      V n        \        P
                  ! VP                  P                  VP                  P                  R R7      V n	        V P                  4        R# r  )rL   rM   r#  r¤   r   rT   r  r  Ú
vocab_sizeÚlm_headrÚ   r“   s   &&€r(   rM   Ú(VoxtralForConditionalGeneration.__init__í  sS   ø€ Ü‰Ñ˜Ô Ü! &Ó)ˆŒ
Ü—y’y ×!3Ñ!3×!?Ñ!?À×ASÑAS×A^ÑA^ÐejÔkˆŒØ�‰Ör*   c                ó:   € V P                   P                  ! V/ VB # ræ   )r¤   r1  )rY   Úargsr8   s   &*,r(   r1  Ú2VoxtralForConditionalGeneration.get_audio_featuresó  s   € Ø�z‰z×,Ò,¨dÐ=°fÑ=Ð=r*   c                óˆ  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[R,          RS[ P                  R,          RS[ P                  R,          R	S[R,          R
S[S[ P                  ,          RS[S[,          RS[	S[
,          /# )r   r4  Nr»   r    rD  r¥   rû   ÚlabelsrE  Úlogits_to_keepr8   rg   )r$   r  r   r%   r   rG   rF   r   r   rh   r   )r'   rH   s   "€r(   r)   Ú,VoxtralForConditionalGeneration.__annotate__ø  sã   ø€ ÷ I
ñ I
á×#Ñ# dÕ*ðI
ñ ×)Ñ)¨DÕ0ðI
ñ Ÿ™ tÕ+ð	I
ñ
 ×&Ñ&¨Õ-ðI
ñ  �ðI
ñ ×(Ñ(¨4Õ/ðI
ñ × Ñ  4Õ'ðI
ñ ˜$•;ðI
ñ ™eŸl™lÕ*ðI
ñ Ñ+Õ,ðI
ñ 
Ñ'Õ	'ñI
r*   c
                ó®  € V P                   ! RRVRVRVRVRVRVRV/V
B pVP                  p\        V	\        4      '       d   \	        V	) R4      MT	pV P                  VR	VR	3,          4      pRpVe7   V P                  ! RR
VRVRV P                  P                  P                  /V
B p\        VVVP                  VP                  VP                  R7      # )aš  
Example:

```python
>>> from transformers import VoxtralForConditionalGeneration, AutoProcessor
>>> import torch

>>> device = "cuda" if torch.cuda.is_available() else "cpu"
>>> repo_id = "mistralai/Voxtral-Mini-3B-2507"

>>> processor = AutoProcessor.from_pretrained(repo_id)
>>> model = VoxtralForConditionalGeneration.from_pretrained(repo_id, dtype=torch.bfloat16, device_map=device)

>>> conversation = [
    {
        "role": "user",
        "content": [
            {
                "type": "audio",
                "url": "https://huggingface.co/datasets/hf-internal-testing/dummy-audio-samples/resolve/main/dude_where_is_my_car.wav",
            },
            {"type": "text", "text": "What can you tell me about this audio?"},
        ],
    }
]

>>> inputs = processor.apply_chat_template(conversation)
>>> inputs = inputs.to(device, dtype=torch.bfloat16)

>>> outputs = model.generate(**inputs, max_new_tokens=30)
>>> processor.batch_decode(outputs[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)
["This audio is a humorous conversation between two friends, likely in English, where one of them is trying to figure out what the other's tattoo says."]
```r4  r»   r    rD  r¥   rû   rE  N:NNNÚlogitsrT  rM  )ÚlossrX  r¥   re   r¼   r™   )r¤   ró   Ú
isinstancerF   ÚslicerN  Úloss_functionrE   r  rM  r   r¥   re   r¼   )rY   r4  r»   r    rD  r¥   rû   rT  rE  rU  r8   rH  re   Úslice_indicesrX  rY  s   &&&&&&&&&&,     r(   ru   Ú'VoxtralForConditionalGeneration.forwardö  s  € ð` —*’*ñ 	
Øð	
à)ð	
ð *ð	
ð &ð		
ð
 ,ð	
ð (ð	
ð  ð	
ð ñ	
ˆð  ×1Ñ1ˆÜ8BÀ>ÔSV×8WÒ8Wœ˜~˜o¨tÔ4Ð]kˆØ—‘˜m¨A¨}¸aÐ,?Õ@ÓAˆàˆØÒØ×%Ò%ñ ØðØ&,ðØ9=¿¹×9PÑ9P×9[Ñ9[ðØ_eñˆDô &ØØØ#×3Ñ3Ø!×/Ñ/Ø×)Ñ)ô
ð 	
r*   )rN  r¤   )	NNNNNNNNr   )rS   rw   rx   ry   Ú_keep_in_fp32_modules_strictrM   r1  r   r   ru   r{   r|   r}   r~   s   @@r(   rK  rK  å  sD   ù‡ € ð %6Ð#6Ð õò>ð Ø÷I
ñ I
ó ó ÷I
ð I
r*   rK  )Nrj   )r£   rº   r#  rK  )5rÉ   Úcollections.abcr   Údataclassesr   r$   r   Úactivationsr   Úcache_utilsr   Ú
generationr   Úmodeling_layersr	   Úmodeling_outputsr
   r   r   Úmodeling_utilsr   r   Úprocessing_utilsr   Úutilsr   r   r   r   r   Úutils.genericr   Úutils.output_capturingr   Úautor   Úconfiguration_voxtralr   r   Ú
get_loggerrS   rP   r;   r#   r=   r€   r£   rº   r  r  r#  rK  Ú__all__r™   r*   r(   Ú<module>rp     s[  ðó, Ý $Ý !ã Ý å !Ý  Ý )Ý 9ß kÑ kß FÝ &ß jÕ jÝ 7Ý 5Ý ß Fð 
×	Ò	˜HÓ	%€÷%ô4U)�r—y‘yô U)ôp5Ð4ô 5ðp ô"˜_ó "ó ð"ñ ðôô
m-Ð+ó m-óð
m-ô` §¡ô ñ ðôð
 ô9Ð!8ó 9ó óð9ñ ðôôb
Ð)ó b
óðb
ñJ ðôô
W
Ð&<¸oó W
óð
W
òt j‚r*   