+
    œ°³jàF  ã                   óÚ  € ^ RI t ^ RIHt ^ RIt^ RIHt ^ RIHu Ht ^RI	H
t ^RIHt ^RIHtHt ^RIHt ^RIHt ^RIHtHt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& ]! RR7      ] ! R R]4      4       4       t']! RR7      ] ! R R]4      4       4       t( ! R R] 4      t) ! R R]PT                  4      t+ ! R R]4      t, ! R R]4      t- ! R R]PT                  4      t. ! R  R!]PT                  4      t/ ! R" R#]PT                  4      t0 ! R$ R%]#4      t1] ! R& R']$4      4       t2]! R(R7       ! R) R*]"4      4       t3]! R+R7       ! R, R-]2]&4      4       t4. R.Ot5R# )/é    N)Ú	dataclass)Úinitialization)ÚACT2FN)ÚBaseModelOutputWithPastÚBaseModelOutputWithPooling)ÚPreTrainedModel)ÚUnpack)ÚTransformersKwargsÚauto_docstringÚcan_return_tuple)Ú	AutoModel)ÚCLIPMLP)ÚLlamaMLP)ÚQwen2RMSNorm)ÚVoxtralModelÚVoxtralMultiModalProjectorÚVoxtralPreTrainedModel)ÚVibeVoiceGenerationMixinzDBase class for VibeVoice outputs, with hidden states and attentions.©Úcustom_introc                   ó4   a € ] tR t^(t o RtRtV 3R ltRtV tR# )Ú VibeVoiceBaseModelOutputWithPastz½
audio_features (`torch.FloatTensor` of shape `(batch_size, sequence_length, feature_size)`, *optional*):
    Extracted audio features that can be used for conditioning the language model.
Nc                óH   <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   # )é   NÚaudio_features©ÚtorchÚFloatTensor)ÚformatÚ__classdict__s   "€Úp/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/vibevoice/modular_vibevoice.pyÚ__annotate__Ú-VibeVoiceBaseModelOutputWithPast.__annotate__(   s   ø‡ ‚ ñ ×%Ñ%¨Õ,Ñ3ò ó    © )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r    s   @r!   r   r   (   s   ø‡ € ñð
 04€N÷ ƒ r$   r   z(VibeVoice causal language model outputs.c                   ó<   a € ] tR t^3t o RtRtRtRtV 3R ltRt	V t
R# )ÚVibeVoiceCausalLMOutputWithPasta  
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    Language modeling loss (for next-token prediction).
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
    Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
audio_features (`torch.FloatTensor` of shape `(batch_size, sequence_length, feature_size)`, *optional*):
    Extracted audio features that can be used for conditioning the language model.
Nc                ó¤   <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[ P                  R,          ;R&   # )r   NÚlossÚlogitsr   r   )r   r    s   "€r!   r"   Ú,VibeVoiceCausalLMOutputWithPast.__annotate__3   sM   ø‡ ‚ ñ ×
Ñ
˜dÕ
"Ñ)ñ ñ ×Ñ Õ$Ñ+ñ ñ ×%Ñ%¨Õ,Ñ3ò r$   r%   )r&   r'   r(   r)   r*   r2   r3   r   r+   r,   r-   r.   s   @r!   r0   r0   3   s"   ø‡ € ñð &*€DØ'+€FØ/3€N÷ ƒ r$   r0   c                   ó   € ] tR t^DtRtR# )ÚVibeVoiceRMSNormr%   N©r&   r'   r(   r)   r,   r%   r$   r!   r6   r6   D   ó   † Ûr$   r6   c                   óH   a a€ ] tR t^Ht oV 3R lt]R 4       tR tRtVt	V ;t
# )Ú)VibeVoiceDiffusionHeadSinusoidalEmbeddingc                óˆ   <€ \         SV `  4        Wn        \        P                  ! V P                  V4      R R7      V n        R# )F)Ú
persistentN)ÚsuperÚ__init__ÚconfigÚnnÚBufferÚcompute_default_freqÚfreq©Úselfr?   Ú	__class__s   &&€r!   r>   Ú2VibeVoiceDiffusionHeadSinusoidalEmbedding.__init__I   s0   ø€ Ü‰ÑÔØŒÜ—I’I˜d×7Ñ7¸Ó?ÈEÔRˆŽ	r$   c                óö   € V P                   ^,          p\        P                  ! \        P                  ! V P
                  4      ) \        P                  ! V\        P                  R7      ,          V,          4      # )r   )Údtype)Úfrequency_embedding_sizer   ÚexpÚmathÚlogÚdiffusion_max_periodÚarangeÚfloat32)r?   Údims   & r!   rB   Ú>VibeVoiceDiffusionHeadSinusoidalEmbedding.compute_default_freqN   sP   € à×-Ñ-°Õ2ˆÜ�yŠyœ$Ÿ(š( 6×#>Ñ#>Ó?Ð?Ä%Ç,Â,ÈsÔZ_×ZgÑZgÔBhÕhÐknÕnÓoÐor$   c                ó  € VR,          P                  4       V P                  R,          P                  VP                  4      ,          p\        P
                  ! \        P                  ! V4      \        P                  ! V4      .RR7      pV# )ºNNNN©rQ   ©rT   Néÿÿÿÿ)ÚfloatrC   ÚtoÚdevicer   ÚcatÚcosÚsin)rE   Ú	timestepsrC   Ú	embeddings   &&  r!   ÚforwardÚ1VibeVoiceDiffusionHeadSinusoidalEmbedding.forwardS   s^   € Ø˜Õ!×'Ñ'Ó)¨D¯I©I°d­O×,>Ñ,>¸y×?OÑ?OÓ,PÕPˆÜ—I’IœuŸyšy¨›´·	²	¸$³Ð@ÀbÔIˆ	ØÐr$   )r?   rC   )r&   r'   r(   r)   r>   ÚstaticmethodrB   r`   r,   r-   Ú__classcell__©rF   r    s   @@r!   r:   r:   H   s+   ù‡ € õSð
 ñpó ðp÷ò r$   r:   c                   ó2   a a€ ] tR t^Yt oV 3R ltRtVtV ;t# )ÚVibeVoiceDiffusionHeadMLPc                ó$  <€ \         SV `  4        \        P                  ! VP                  VP
                  R R7      V n        \        VP                  ,          V n	        \        P                  ! VP
                  VP
                  R R7      V n
        R# ©F©ÚbiasN)r=   r>   r@   ÚLinearrJ   Úhidden_sizeÚfc1r   Ú
hidden_actÚactivation_fnÚfc2rD   s   &&€r!   r>   Ú"VibeVoiceDiffusionHeadMLP.__init__Z   sb   ø€ Ü‰ÑÔÜ—9’9˜V×<Ñ<¸f×>PÑ>PÐW\Ô]ˆŒÜ# F×$5Ñ$5Õ6ˆÔÜ—9’9˜V×/Ñ/°×1CÑ1CÈ%ÔPˆŽr$   )ro   rm   rp   ©r&   r'   r(   r)   r>   r,   r-   rc   rd   s   @@r!   rf   rf   Y   s   ù‡ € ÷Qõ Qr$   rf   c                   ó   € ] tR t^atRtR# )ÚVibeVoiceMLPr%   Nr7   r%   r$   r!   rt   rt   a   r8   r$   rt   c                   ó8   a a€ ] tR t^et oV 3R ltR tRtVtV ;t# )Ú"VibeVoiceDiffusionHeadAdaLayerNormc                ó\  <€ \         SV `  4        ^V n        \        V4      V n        \        VP                  VP                  R7      V n        \        VP                  ,          V n        \        P                  ! VP                  VP                  V P                  ,          RR7      V n        R# )é   ©ÚepsFri   N)r=   r>   Ú
num_chunksrt   Úffnr6   rl   Úrms_norm_epsÚnormr   rn   Úact_fnr@   rk   ÚlinearrD   s   &&€r!   r>   Ú+VibeVoiceDiffusionHeadAdaLayerNorm.__init__f   sw   ø€ Ü‰ÑÔØˆŒÜ Ó'ˆŒÜ$ V×%7Ñ%7¸V×=PÑ=PÔQˆŒ	Ü˜V×.Ñ.Õ/ˆŒÜ—i’i × 2Ñ 2°F×4FÑ4FÈÏÉÕ4XÐ_dÔeˆŽr$   c                ó
  € V P                  V P                  V4      4      P                  V P                  RR7      w  r4pV P	                  V4      ^V,           ,          V,           pWV P                  V4      ,          ,           pV# )é   rU   rW   )r€   r   Úchunkr{   r~   r|   )rE   Úhidden_statesÚ	conditionÚ	shift_ffnÚ	scale_ffnÚgate_ffnÚmodulated_hidden_statess   &&&    r!   r`   Ú*VibeVoiceDiffusionHeadAdaLayerNorm.forwardn   sp   € Ø)-¯©°T·[±[ÀÓ5KÓ)L×)RÑ)RÐSW×SbÑSbÐhjÐ)RÓ)kÑ&ˆ	˜hØ"&§)¡)¨MÓ":¸aÀ)½mÕ"LÈyÕ"XÐØ%°4·8±8Ð<SÓ3TÕ(TÕTˆØÐr$   )r   r|   r€   r~   r{   ©	r&   r'   r(   r)   r>   r`   r,   r-   rc   rd   s   @@r!   rv   rv   e   s   ù‡ € õf÷ò r$   rv   c                   ó8   a a€ ] tR t^ut oV 3R ltR tRtVtV ;t# )Ú VibeVoiceDiffusionHeadFinalLayerc                ób  <€ \         SV `  4        ^V n        VP                  V n        \        P
                  ! VP                  V P                  VP                  ,          RR7      V n        \        VP                  ,          V n
        \        P
                  ! VP                  VRR7      V n        R# )r   Fri   N)r=   r>   r{   r}   r@   rk   rl   Úlinear_1r   rn   r   Úlinear_2)rE   r?   Úoutput_sizerF   s   &&&€r!   r>   Ú)VibeVoiceDiffusionHeadFinalLayer.__init__v   sy   ø€ Ü‰ÑÔØˆŒØ"×/Ñ/ˆÔÜŸ	š	 &×"4Ñ"4°d·o±oÈ×HZÑHZÕ6ZÐafÔgˆŒÜ˜V×.Ñ.Õ/ˆŒÜŸ	š	 &×"4Ñ"4°kÈÔNˆŽr$   c                ó8  € V P                  V P                  V4      4      P                  V P                  RR7      w  r4\        P
                  ! WP                  R,          3V P                  R7      pV^V,           ,          V,           pV P                  V4      pV# )rƒ   rU   ry   rW   )	r�   r   r„   r{   ÚFÚrms_normÚshaper}   r‘   )rE   r…   r†   ÚshiftÚscaleÚnormeds   &&&   r!   r`   Ú(VibeVoiceDiffusionHeadFinalLayer.forward~   s{   € Ø—}‘} T§[¡[°Ó%;Ó<×BÑBÀ4Ç?Á?ÐXZÐBÓ[‰ˆÜ—’˜M×,?Ñ,?ÀÕ,CÐ+EÈ4×K\ÑK\Ô]ˆØ ! e¥)Õ,¨uÕ4ˆØŸ™ mÓ4ˆØÐr$   )r   r�   r‘   r{   r}   rŒ   rd   s   @@r!   rŽ   rŽ   u   s   ù‡ € õO÷ò r$   rŽ   c                   ó8   a a€ ] tR t^†t oV 3R ltR tRtVtV ;t# )ÚVibeVoiceDiffusionHeadc                óú  <€ \         SV `  4        \        P                  ! VP                  VP
                  R R7      V n        \        P                  ! VP
                  VP
                  R R7      V n        \        V4      V n	        \        V4      V n        \        P                  ! \        VP                  4       Uu. uF  p\        V4      NK  	  up4      V n        \#        WP                  R7      V n        R# u upi )Fri   )r’   N)r=   r>   r@   rk   Úlatent_sizerl   Únoisy_images_projÚ	cond_projr:   Útimestep_embeddingrf   Útimestep_projÚ
ModuleListÚrangeÚnum_hidden_layersrv   ÚlayersrŽ   Úfinal_layer)rE   r?   Ú_rF   s   && €r!   r>   ÚVibeVoiceDiffusionHead.__init__‡   s»   ø€ Ü‰ÑÔÜ!#§¢¨6×+=Ñ+=¸v×?QÑ?QÐX]Ô!^ˆÔÜŸš 6×#5Ñ#5°v×7IÑ7IÐPUÔVˆŒÜ"KÈFÓ"SˆÔÜ6°vÓ>ˆÔÜ—m’mÜAFÀv×G_ÑG_ÔA`ÓaÑA`¸AÔ/°Ö7ÑA`Ñaó
ˆŒô <¸F×PbÑPbÔcˆÖùò bs   Â;C8c                ó(  € V P                  V4      pV P                  V4      P                  VP                  4      pV P	                  V4      pV P                  V4      pW5,           pV P                   F  pV! WC4      pK  	  V P                  WC4      pV# )zL
Forward pass of the prediction head. Returns the predicted noise/velocity.
)r    r¢   rY   rI   r£   r¡   r§   r¨   )rE   Únoisy_imagesr^   r†   r…   Úembedded_timestepsÚlayers   &&&&   r!   r`   ÚVibeVoiceDiffusionHead.forward’   sŠ   € ð ×.Ñ.¨|Ó<ˆØ!×4Ñ4°YÓ?×BÑBÀ9Ç?Á?ÓSÐØ!×/Ñ/Ð0BÓCÐØ—N‘N 9Ó-ˆ	ØÕ2ˆ	Ø—[”[ˆEÙ! -Ó;ŠMñ !à×(Ñ(¨ÓBˆØÐr$   )r¡   r¨   r§   r    r¢   r£   rŒ   rd   s   @@r!   r�   r�   †   s   ù‡ € õ	d÷ò r$   r�   c                   ó2   a a€ ] tR t^¡t oV 3R ltRtVtV ;t# )ÚVibeVoiceMultiModalProjectorc                ó´   <€ \         SV `  4        \        P                  ! W4      V n        \        VR R7      V n        \        P                  ! W"4      V n        R# )g�íµ ÷Æ°>ry   N)r=   r>   r@   rk   r�   r6   Úactr‘   )rE   Ú	input_dimÚ
output_dimrF   s   &&&€r!   r>   Ú%VibeVoiceMultiModalProjector.__init__¢   s<   ø€ Ü‰ÑÔÜŸ	š	 )Ó8ˆŒÜ# J°DÔ9ˆŒÜŸ	š	 *Ó9ˆŽr$   )r³   r�   r‘   rr   rd   s   @@r!   r±   r±   ¡   s   ù‡ € ÷:õ :r$   r±   c                   ó,   a € ] tR t^©t o R.tR tRtV tR# )ÚVibeVoicePreTrainedModelr�   c                ó¢  € \         P                  ! W4       \        VR 4      '       d"   \        P                  ! VP
                  R4       \        VR4      '       d"   \        P                  ! VP                  R4       \        V\        4      '       d=   \        P                  ! VP                  VP                  VP                  4      4       R# R# )Úlatent_scaling_factorç      ð?Úlatent_bias_factorç        N)r   Ú_init_weightsÚhasattrÚinitÚ	constant_rº   r¼   Ú
isinstancer:   Úcopy_rC   rB   r?   )rE   Úmodules   &&r!   r¾   Ú&VibeVoicePreTrainedModel._init_weights­   s‰   € Ü×%Ò% dÔ3Ü�6Ð2×3Ò3Ü�NŠN˜6×7Ñ7¸Ô=Ü�6Ð/×0Ò0Ü�NŠN˜6×4Ñ4°cÔ:Ü�fÔG×HÒHÜ�JŠJ�v—{‘{ F×$?Ñ$?ÀÇÁÓ$NÖOñ Ir$   r%   N)r&   r'   r(   r)   Ú_no_split_modulesr¾   r,   r-   r.   s   @r!   r¸   r¸   ©   s   ø‡ € à1Ð2Ð÷Pð Pr$   r¸   zw
    The VibeVoice model which consists of audio tokenizers and an LLM backbone, without a language modeling head.
    c                   ó|   a a€ ] tR t^·t oV 3R lt]]! RR7      V3R lR l4       4       tR	V3R lR lltRt	Vt
V ;t# )
ÚVibeVoiceModelc                ód  <€ \         SV `  V4       \        VP                  P                  VP
                  P                  4      V n        \        P                  ! VP                  4      V n
        \        VP                  P                  VP
                  P                  4      V n        \        VP                  4      V n        \        P                   ! \"        P$                  ! R 4      4      V n        \        P                   ! \"        P$                  ! R4      4      V n        V P+                  4        R# )r»   r½   N)r=   r>   r±   Úaudio_configrl   Útext_configÚmulti_modal_projectorr   Úfrom_configÚsemantic_model_configÚsemantic_tokenizer_encoderÚsemantic_connectorr�   Údiffusion_head_configÚdiffusion_headr@   Ú	Parameterr   Útensorrº   r¼   Ú	post_initrD   s   &&€r!   r>   ÚVibeVoiceModel.__init__½   sÒ   ø€ Ü‰Ñ˜Ô Ü%AØ×Ñ×+Ñ+¨V×-?Ñ-?×-KÑ-Kó&
ˆÔ"ô +4×*?Ò*?À×@\Ñ@\Ó*]ˆÔ'Ü">Ø×(Ñ(×4Ñ4°f×6HÑ6H×6TÑ6Tó#
ˆÔô 5°V×5QÑ5QÓRˆÔÜ%'§\¢\´%·,²,¸sÓ2CÓ%DˆÔ"Ü"$§,¢,¬u¯|ª|¸CÓ/@Ó"AˆÔØ�‰Ör$   zÁThis method is used to get the audio embeddings (that replace placeholder audio tokens in the input sequence) and the acoustic features (used as diffusion target) from the input audio waveform.r   c          	      óz   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[S[,          RS[S[,          /# )r   Úinput_valuesÚpadding_maskÚkwargsÚreturn)r   r   ÚTensorr	   r
   Útupler   )r   r    s   "€r!   r"   ÚVibeVoiceModel.__annotate__Ð   sI   ø€ ÷ 
ñ 
á×'Ñ'ð
ñ —l‘lð
ñ Ñ+Õ,ð	
ñ
 
Ñ+Õ	+ñ
r$   c                ón  € \         P                  ! 4       ;_uu_ 4        V P                  P                  VRR7      P                  pRRR4       XV P
                  P                  VP                  4      ,          pW@P                  P                  VP                  4      ,          p\         P                  ! VP                  RR7      V P                  P                  P                  ,          4      P                  \         P                  4      p\         P                  ! VP!                  4       VP                  R7      VR,          8  pV P#                  V4      p\%        WBP                  VP                  4      ,          WbP                  VP                  4      ,          R7      #   + '       g   i     ELf; i)	zÔ
input_values (`torch.FloatTensor`):
    Float values of (normalized) audio waveform.
padding_mask (`torch.Tensor` of shape `(batch_size, padded_audio_length)`):
    Padding mask to remove padded parts of audio.
T)ÚsampleNrU   )rZ   )Úlast_hidden_stateÚpooler_outputrW   rV   )r   Úno_gradÚaudio_towerÚencodeÚlatentsr¼   rY   rZ   rº   ÚceilÚsumr?   rÊ   Ú
hop_lengthÚint64rO   ÚmaxrÌ   r   )rE   rØ   rÙ   rÚ   Úacoustic_featuresÚnum_audio_tokensrâ   s   &&&,   r!   Úget_audio_featuresÚ!VibeVoiceModel.get_audio_featuresË   s@  € ô& �]Š]�_�_Ø $× 0Ñ 0× 7Ñ 7¸ÈTÐ 7Ó R× ZÑ ZÐ÷ à˜T×4Ñ4×7Ñ7Ð8I×8PÑ8PÓQÕQÐØ×7Ñ7×:Ñ:Ð;L×;SÑ;SÓTÕTÐô !Ÿ:š: l×&6Ñ&6¸2Ð&6Ó&>ÀÇÁ×AYÑAY×AdÑAdÕ&dÓe×hÑhÔin×itÑitÓuÐÜ—|’|Ð$4×$8Ñ$8Ó$:ÐCS×CZÑCZÔ[Ð^nÐovÕ^wÑwˆà×2Ñ2Ð3DÓEˆÜ)Ø/·±Ð@Q×@XÑ@XÓ0YÕZØ'¯©¸×8LÑ8LÓ(MÕNô
ð 	
÷ �_ˆ_ús   ž(F#Æ#F4	c                óØ   <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[S[,          RS[S[,          /# )r   Ú	input_idsÚinputs_embedsNrØ   rÙ   rÚ   rÛ   )r   Ú
LongTensorr   Ú
BoolTensorr	   r
   rÝ   r   )r   r    s   "€r!   r"   rÞ   í   s‚   ø€ ÷ Zñ Zá×#Ñ#ðZñ ×(Ñ(¨4Õ/ðZñ ×'Ñ'¨$Õ.ð	Zñ
 ×&Ñ&¨Õ-ðZñ Ñ+Õ,ðZñ 
Ñ(Õ	(ñZr$   c                óP  € Vf   V P                  4       ! V4      pRpVeg   V P                  W44      pVP                  pVP                  pV P	                  WVR7      p	VP                  W˜P                  VP                  4      4      pV P                  ! RRV/VB p
\        RRV/V
B # )z
padding_mask (`torch.Tensor` of shape `(batch_size, padded_audio_length)`):
    Padding mask to remove padded parts of audio.
N)rò   r   rò   r   r%   )
Úget_input_embeddingsrî   râ   rá   Úget_placeholder_maskÚmasked_scatterrY   rZ   Úlanguage_modelr   )rE   rñ   rò   rØ   rÙ   rÚ   r   Úaudio_outputsÚaudio_embedsÚspecial_audio_maskÚoutputss   &&&&&,     r!   r`   ÚVibeVoiceModel.forwardí   sº   € ð Ò Ø ×5Ñ5Ô7¸	ÓBˆMàˆØÒ#Ø ×3Ñ3°LÓOˆMØ(×6Ñ6ˆLØ*×<Ñ<ˆNð "&×!:Ñ!:ØÀ|ð ";ó "Ðð *×8Ñ8Ð9KÏ_É_Ð]j×]qÑ]qÓMrÓsˆMà×%Ò%ÑL°MÐLÀVÑLˆÜ/ÑY¸~ÐYÐQXÑYÐYr$   )rÒ   r¼   rº   rÌ   rÐ   rÏ   )NNNN)r&   r'   r(   r)   r>   r   r   rî   r`   r,   r-   rc   rd   s   @@r!   rÈ   rÈ   ·   sC   ù‡ € õð Ùðnô÷
ó	ó ð

÷:Z÷ Zò Zr$   rÈ   zv
    The VibeVoice model, which consists of a language model, audio tokenizers, connectors, and a diffusion head.
    c                   óˆ   a a€ ] tR tRt oRR/tRR/tV 3R lt]V3R lR l4       t]	]
RV3R	 lR
 ll4       4       tRtVtV ;t# )Ú!VibeVoiceForConditionalGenerationi  zlm_head.weightz(model.language_model.embed_tokens.weightÚlm_headÚcolwise_gather_outputc                óò   <€ \         SV `  V4       \        V4      V n        \        P
                  ! VP                  P                  VP                  P                  R R7      V n	        V P                  4        R# rh   )r=   r>   rÈ   Úmodelr@   rk   rË   rl   Ú
vocab_sizer  rÕ   rD   s   &&€r!   r>   Ú*VibeVoiceForConditionalGeneration.__init__  sS   ø€ Ü‰Ñ˜Ô Ü# FÓ+ˆŒ
Ü—y’y ×!3Ñ!3×!?Ñ!?À×ASÑAS×A^ÑA^ÐejÔkˆŒØ�‰Ör$   c                ó”   <€ V ^8„  d   QhRS[ P                  RS[P                  RS[P                  RS[RS[RS[RS[P                  /# )r   rÒ   r   Úcondition_featuresÚnoise_schedulerÚddpm_batch_multiplierÚnum_diffusion_stepsrÛ   )r@   ÚModuler   r   ÚobjectÚint)r   r    s   "€r!   r"   Ú.VibeVoiceForConditionalGeneration.__annotate__  se   ø€ ÷ *ñ *ÙŸ	™	ð*á×)Ñ)ð*ñ "×-Ñ-ð*ñ  ð	*ñ
  #ð*ñ !ð*ñ 
×	Ñ	ñ*r$   c                ó¾  € VP                   w  rgVP                  V^ R7      pVP                  V^ R7      p	\        P                  ! Wd,          V3VP                  VP
                  R7      p
\        P                  ! \        P                  ! V4      Wd,          RR7      P                  VP                  4      pVP                  WŠV4      pV ! WËP                  V4      V	4      pVP                  P                  VP                  VP
                  R7      pVP                  P                  VP                  VP
                  R7      pWë,          P                  4       P                  R	4      pWû,          P                  4       P                  R	4      pWê,          Wø,          ,
          P                  VP                  4      p\        P                  P                   P#                  VP%                  4       VP%                  4       RR7      pV^ 8”  d'   V^ 8”  d    V^ 8”  d   VWt,          V,          ,          pV# \        P&                  ! R
RVP
                  VP                  R7      pV# )r   rU   )rZ   rI   T)Úreplacementrè   )Ú	reductionr½   )rI   rZ   rW   r%   )r—   Úrepeat_interleaver   ÚrandnrZ   rI   ÚmultinomialÚonesrY   Ú	add_noiseÚtype_asÚalpha_tÚsigma_tÚflattenÚ	unsqueezer@   Ú
functionalÚmse_lossrX   Úfull)rÒ   r   r  r	  r
  r  Ú	audio_lenrŸ   Úaudio_features_repeatedÚcondition_features_repeatedÚnoiser^   Únoisy_audio_featuresÚmodel_outputr  r  ÚtargetÚdiffusion_losss   &&&&&&            r!   Úcompute_diffusion_lossÚ8VibeVoiceForConditionalGeneration.compute_diffusion_loss  s  € ð "0×!5Ñ!5Ñˆ	Ø"0×"BÑ"BÐCXÐ^_Ð"BÓ"`ÐØ&8×&JÑ&JÐK`ÐfgÐ&JÓ&hÐ#ô —’ØÕ.°Ð<Ø!×(Ñ(Ø ×&Ñ&ô
ˆô
 ×%Ò%Ü�JŠJÐ*Ó+ØÕ-Øô
÷ ‰"ˆ^×"Ñ"Ó
#ð	 	ð
  /×8Ñ8Ð9PÐYbÓcÐñ &Ø ×"3Ñ"3°NÓ"CÐE`ó
ˆð
 "×)Ñ)×,Ñ,°N×4IÑ4IÐQ_×QeÑQeÐ,ÓfˆØ!×)Ñ)×,Ñ,°N×4IÑ4IÐQ_×QeÑQeÐ,ÓfˆØÕ$×,Ñ,Ó.×8Ñ8¸Ó<ˆØÕ$×,Ñ,Ó.×8Ñ8¸Ó<ˆØ•/ GÕ$EÕE×IÑIÈ,×J]ÑJ]Ó^ˆäŸ™×,Ñ,×5Ñ5°l×6HÑ6HÓ6JÈFÏLÉLËNÐfkÐ5ÓlˆØ˜Œ?Ð4°qÔ8¸YÈ¼]Ø+¨{Õ/RÐU^Õ/^Õ_ˆNð Ðô #ŸZšZ¨¨C°~×7KÑ7KÐTb×TiÑTiÔjˆNØÐr$   c                óH  <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[ P                  R,          RS[S[,          RS[ P                  R,          RS[ P
                  R,          RS[ P
                  R,          R	S[R,          R
S[RS[RS[S[,          /# )r   rñ   rò   NÚlabelsÚlogits_to_keeprØ   rÙ   Úacoustic_loss_maskr	  r
  r  rÛ   )	r   ró   r   r  Úslicerô   r  rÝ   r0   )r   r    s   "€r!   r"   r  J  sÞ   ø€ ÷ HTñ HTá×#Ñ#ðHTñ ×(Ñ(¨4Õ/ðHTñ × Ñ  4Õ'ð	HTñ
 ™e�ðHTñ ×'Ñ'¨$Õ.ðHTñ ×&Ñ&¨Õ-ðHTñ "×,Ñ,¨tÕ3ðHTñ   $�ðHTñ  #ðHTñ !ðHTñ 
Ñ0Õ	0ñHTr$   c                óŠ  € V P                   ! R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e-   V P                  ! RRVRVR	V P                  P                  /VB pVEe   VP                  Ee
   V P                  P                  R
8”  dï   Vf   V P                  V P                  4      pVP                  pW×P                  VP                  4      ,          P                  VP                  4      pV P                  V P                   P                   VVVV	V
4      p^V P                  P                  ,
          V,          V P                  P                  VP                  VP                  4      ,          ,           p\#        RRVRV/VB # )aZ  
input_values (`torch.FloatTensor`, *optional*):
    Preprocessed audio waveform for voice cloning.
padding_mask (`torch.BoolTensor`, *optional*):
    Masks indicating valid input frames.
acoustic_loss_mask (`torch.BoolTensor`, *optional*):
    Mask to compute diffusion loss only on specific acoustic tokens.
noise_scheduler (*optional*):
    Needed for training to compute noise targets for the diffusion loss. By default, uses the noise scheduler
    configuration specified in the model's `generation_config`.
ddpm_batch_multiplier (`int`, *optional*, defaults to 4):
    For training, number of noise samples to generate per audio token for diffusion loss computation, which can
    help stabilize training.
num_diffusion_steps (`int`, *optional*, defaults to 10):
    For training, the number of diffusion steps to use. Defaults to 10 if not provided.
rñ   rò   rØ   rÙ   NrT   r3   r+  r  r½   r2   r%   )r  rá   rÂ   r  r.  r  Úloss_functionr?   r  r   Údiffusion_loss_weightÚ_build_default_noise_schedulerÚgeneration_configrY   rZ   r(  rÒ   r0   )rE   rñ   rò   r+  r,  rØ   rÙ   r-  r	  r
  r  rÚ   rý   r…   Úslice_indicesr3   r2   r   r  r'  s   &&&&&&&&&&&,        r!   r`   Ú)VibeVoiceForConditionalGeneration.forwardH  sÂ  € ðB —*’*ñ 
Øð
à'ð
ð &ð
ð &ð	
ð
 ñ
ˆð  ×1Ñ1ˆÜ8BÀ>ÔSV×8WÒ8Wœ˜~˜o¨tÔ4Ð]kˆØ—‘˜m¨A¨}¸aÐ,?Õ@ÓAˆàˆØÒØ×%Ò%Ñp¨VÐp¸FÐpÈtÏ{É{×OeÑOeÐpÐioÑpˆDð
 Ó*Ø×&Ñ&Ó2Ø—‘×1Ñ1°CÔ7àÒ&à"&×"EÑ"EÀd×F\ÑF\Ó"]�à$×3Ñ3ˆNØ!.×/DÑ/DÀ]×EYÑEYÓ/ZÕ![×!^Ñ!^Ð_m×_tÑ_tÓ!uÐØ!×8Ñ8Ø—
‘
×)Ñ)ØØ"ØØ%Ø#óˆNð �D—K‘K×5Ñ5Õ5Øõà—{‘{×8Ñ8¸>×;LÑ;LÈTÏ[É[Ó;YÕYõZˆDô /ÑS°DÐSÀÐSÈ7ÑSÐSr$   )r  r  )
NNNr   NNNNé   é
   )r&   r'   r(   r)   Ú_tied_weights_keysÚ_tp_planr>   rb   r(  r   r   r`   r,   r-   rc   rd   s   @@r!   r   r     sf   ù‡ € ð +Ð,VÐWÐØÐ2Ð3€Hõð ÷*ó ð*ðX Ø÷HTñ HTó ó ÷HTð HTr$   r   )r   r¸   rÈ   )6rL   Údataclassesr   r   Útorch.nnr@   Útorch.nn.functionalr  r•   Ú r   rÀ   Úactivationsr   Úmodeling_outputsr   r   Úmodeling_utilsr   Úprocessing_utilsr	   Úutilsr
   r   r   Úautor   Úclip.modeling_clipr   Úllama.modeling_llamar   Úqwen2.modeling_qwen2r   Úvoxtral.modeling_voxtralr   r   r   Úgeneration_vibevoicer   r   r0   r6   r  r:   rf   rt   rv   rŽ   r�   r±   r¸   rÈ   r   Ú__all__r%   r$   r!   Ú<module>rJ     s”  ðó Ý !ã Ý ß Ð å &Ý !ß SÝ -Ý &ß IÑ IÝ Ý (Ý +Ý /÷ñ õ
 ;ñ ÐgÔhØ
ô4Ð'>ó 4ó ó ið4ñ ÐKÔLØ
ô4Ð&=ó 4ó ó Mð4ô	�|ô 	ô°·	±	ô ô"Q ô Qô	�8ô 	ô¨¯©ô ô  r§y¡yô ô"˜RŸY™Yô ô6:Ð#=ô :ð ô
PÐ5ó 
Pó ð
Pñ ðôô
MZ�\ó MZóð
MZñ` ðôô
ATÐ(@ÐBZó ATóð
ATòH‚r$   