+
    œ°³jˆ:  ã                   óÐ   € ^ RI 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Ht ^RIHt ]
! 4       '       d   ^ RIt^RIHt ^R	IHt R
t ! R R]RR7      t ! R R]4      tR# )é    N)ÚAnyÚ	TypedDictÚoverload)Ú
AudioInput)ÚGenerationConfig)Úis_torch_available)ÚChatÚChatType)ÚPipeline)Ú%MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING)ÚSpeechT5HifiGanzmicrosoft/speecht5_hifiganc                   ó0   a € ] tR t^"t o RtV 3R ltRtV tR# )ÚAudioOutputz‡
audio (`AudioInput`):
    The generated audio waveform.
sampling_rate (`int`):
    The sampling rate of the generated audio waveform.
c                ó2   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   # )é   ÚaudioÚsampling_rate)r   Úint)ÚformatÚ__classdict__s   "€Úe/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/pipelines/text_to_audio.pyÚ__annotate__ÚAudioOutput.__annotate__"   s   ø‡ ‚ ñ Ññ ñ Ñò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r   "   s   ø‡ € ñ÷ ƒ r   r   F)Útotalc                   ó  a a€ ] tR t^.t oRtRtRtRtRtRt	]
! RR7      tRRRRR	R/V 3R
 lltR tR t]V3R lR l4       t]V3R lR l4       t]V3R lR l4       t]V3R lR l4       tV 3R ltRR ltR tRtVtV ;t# )ÚTextToAudioPipelineaŒ  
Text-to-audio generation pipeline using any `AutoModelForTextToWaveform` or `AutoModelForTextToSpectrogram`. This
pipeline generates an audio file from an input text and optional other conditional inputs.

Unless the model you're using explicitly sets generation parameters in `generation_config.json`, the default values
from `generation.configuration_utils.py._get_default_generation_params()` will be used.
- max_new_tokens: 256

Example:

```python
>>> from transformers import pipeline

>>> pipe = pipeline(model="suno/bark-small")
>>> output = pipe("Hey it's HuggingFace on the phone!")

>>> audio = output["audio"]
>>> sampling_rate = output["sampling_rate"]
```

Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)

<Tip>

You can specify parameters passed to the model by using [`TextToAudioPipeline.__call__.forward_params`] or
[`TextToAudioPipeline.__call__.generate_kwargs`].

Example:

```python
>>> from transformers import pipeline

>>> music_generator = pipeline(task="text-to-audio", model="facebook/musicgen-small")

>>> # diversify the music generation by adding randomness with a high temperature and set a maximum music length
>>> generate_kwargs = {
...     "do_sample": True,
...     "temperature": 0.7,
...     "max_new_tokens": 35,
... }

>>> outputs = music_generator("Techno music with high melodic riffs", generate_kwargs=generate_kwargs)
```

</Tip>

This pipeline can currently be loaded from [`pipeline`] using the following task identifiers: `"text-to-speech"` or
`"text-to-audio"`.

See the list of available models on [huggingface.co/models](https://huggingface.co/models?filter=text-to-speech).
TNFé   )Úmax_new_tokensÚvocoderr   Únoise_schedulerc               ó®  <€ Ve   W5R&   W0n         \        SV `  ! V/ VB  R V n        V P                  P
                  \        P                  ! 4       9   dI   Vf>   \        P                  ! \        4      P                  V P                  P                  4      MTV n        V P                  P                  P                  R9   d   R V n        W n        V P                  e&   V P                  P                  P                   V n        V P                   fÝ   V P                  P                  pV P                  P"                  P%                  RR 4      pVeH   TP'                  VP)                  4       P+                  4        UU	u/ uF  w  r‰V	f   K  W‰bK  	  up	p4       R FO  p
\-        WjR 4      pVe	   W n        K  \-        VRR 4      f   K,  \-        VP.                  V
R 4      pVf   KI  W n        KQ  	  V P                   fV   V P                  eF   \1        V P                  R4      '       d(   V P                  P2                  P                   V n        R # R # R # R # u up	pi )Nr*   Úgeneration_configÚcodec_configÚfeature_extractor)ÚmusicgenÚspeecht5)Úsample_rater   )r*   ÚsuperÚ__init__r)   ÚmodelÚ	__class__r   Úvaluesr   Úfrom_pretrainedÚDEFAULT_VOCODER_IDÚtoÚdeviceÚconfigÚ
model_typeÚ	processorr   Ú__dict__ÚgetÚupdateÚto_dictÚitemsÚgetattrr-   Úhasattrr.   )Úselfr)   r   r*   ÚargsÚkwargsr;   Ú
gen_configÚkÚvÚsampling_rate_namer5   s   &$$$*,     €r   r3   ÚTextToAudioPipeline.__init__l   sñ  ø€ àÒ&Ø(7Ð$Ñ%Ø.Ôä‰Ò˜$Ð) &Ò)àˆŒØ�:‰:×ÑÔ#H×#OÒ#OÓ#QÔQð ’?ô  ×/Ò/Ô0BÓC×FÑFÀtÇzÁz×GXÑGXÔYàð ŒLð �:‰:×Ñ×'Ñ'Ð+CÔCà!ˆDŒNà*ÔØ�<‰<Ò#Ø!%§¡×!4Ñ!4×!BÑ!BˆDÔà×ÑÒ%ð —Z‘Z×&Ñ&ˆFØŸ™×,Ñ,×0Ñ0Ð1DÀdÓKˆJØÒ%Ø—‘°
×0BÑ0BÓ0D×0JÑ0JÔ0LÔ^Ñ0L©¨ÐPQœt˜qštÑ0LÒ^Ô_ã&FÐ"Ü '¨ÀDÓ I�Ø Ò,Ø)6Ö&Ü˜V ^°TÓ:ÔFÜ$+¨F×,?Ñ,?ÐASÐUYÓ$Z�MØ$Ô0Ø-:Ö*ñ 'Gð ×ÑÒ%¨$¯.©.Ò*DÌÐQU×Q_ÑQ_Ðat×IuÒIuØ!%§¡×!AÑ!A×!OÑ!OˆDÖñ JvÑ*DÑ%ùó _s   Å<I
Æ	I
c                ó   € \        V\        4      '       d   V.pV P                  P                  P                  R 8X  d]   Rp\        V P                  R4      '       d"   \        V P                  P                  RR4      pRVRRRRR	R/pVP                  V4       TpV P                  e   V P                  MV P                  p\        V\        4      '       dG   VP                  RR
4      ;'       g    / pRRRRRRRV/VCpVP                  ! VP                  3/ VB pMÁV P                  P                  P                  R8X  d?   V U	u. uF   q™P!                  R4      '       g   RV	 2MT	NK"  	  pp	VP#                  RR4       V P                  P                  P                  R8X  d-   V U	u. uF   q™P!                  R4      '       g   RV	 2MT	NK"  	  pp	V! V3/ VBRR/B pVP%                  V P                  P&                  R7      pV# u up	i u up	i )Úbarkr'   Úsemantic_configÚmax_input_semantic_lengthÚ
max_lengthÚadd_special_tokensFÚreturn_attention_maskTÚreturn_token_type_idsNÚprocessor_kwargsÚtokenizeÚreturn_dictÚadd_generation_promptÚcsmÚ[z[0]Údiaz[S1] Úreturn_tensorsÚpt)Údtype)Ú
isinstanceÚstrr4   r;   r<   rD   r,   rC   rO   r@   r=   Ú	tokenizerr	   ÚpopÚapply_chat_templateÚmessagesÚ
startswithÚ
setdefaultr9   r^   )
rE   ÚtextrG   rQ   Ú
new_kwargsÚpreprocessorrU   Úchat_template_kwargsÚoutputÚts
   &&,       r   Ú
preprocessÚTextToAudioPipeline.preprocess™   sô  € Ü�dœC× Ò Ø�6ˆDà�:‰:×Ñ×'Ñ'¨6Ô1ð ˆJÜ�t×-Ñ-Ð/@×AÒAÜ$ T×%;Ñ%;×%KÑ%KÐMhÐjmÓn�
à˜jØ$ eØ'¨Ø'¨ð	ˆJð ×Ñ˜fÔ%ØˆFà)-¯©Ò)C�t—~’~ÈÏÉˆÜ�dœD×!Ò!à%Ÿz™zÐ*<¸dÓC×IÐIÀrÐà˜DØ˜tØ'¨Ø"Ð$4ð	$ð
 ð$Ð ð "×5Ò5Ø—‘ñà&ñ‰Fð �z‰z× Ñ ×+Ñ+¨uÔ4ÙKOÓPÉ4Àa¯©°c×):Ò):˜#˜a˜S™	ÀÒAÉ4�ÐPØ×!Ñ!Ð"6¸Ô=Ø�z‰z× Ñ ×+Ñ+¨uÔ4ÙMQÓRÉTÈ¯<©<¸×+<Ò+<˜% ˜s™À!ÒCÉT�ÐRÙ! $ÑF¨&ÑFÀÒFˆFØ—‘ §¡×!1Ñ!1�Ó2ˆàˆùò Qùò Ss   Å&HÆ)&Hc                óâ  € V P                  W P                  R 7      pVR,          pVR,          pV P                  P                  4       '       Ed9   V P                  W@P                  R 7      pRV9   d   VP	                  R4      pM \
        P                  ! V P                  4      pRVn        VP                  e   RVn
        / pVP                  4        F(  w  rx\        WW4      '       d   \        WWV4       K$  W†V&   K*  	  WSR&   VP                  V4       V P                  P                  P                   R	9   d   RV9  d   RVR&   V P"                  e   RV9  d   V P"                  VR&   V P                  P$                  ! R
/ VBVB p	MH\'        V4      '       d   \)        RVP+                  4        24      hV P                  ! R
/ VBVB ^ ,          p	V P,                  e   V P-                  V	4      p	V	# ))r:   Úforward_paramsÚgenerate_kwargsr,   TNÚoutput_audior*   zñYou're using the `TextToAudioPipeline` with a forward-only model, but `generate_kwargs` is non empty. For forward-only TTA models, please use `forward_params` instead of `generate_kwargs`. For reference, the `generate_kwargs` used here are: )rY   r   )Ú_ensure_tensor_on_devicer:   r4   Úcan_generaterb   ÚcopyÚdeepcopyr,   Úreturn_dict_in_generater(   rQ   rB   rD   Úsetattrr@   r;   r<   r*   ÚgenerateÚlenÚ
ValueErrorÚkeysr)   )
rE   Úmodel_inputsrG   rp   rq   r,   Úmodel_specific_kwargsrI   rJ   rk   s
   &&,       r   Ú_forwardÚTextToAudioPipeline._forwardÉ   sß  € à×.Ñ.¨v¿k¹kÐ.ÓJˆØÐ 0Õ1ˆØ Ð!2Õ3ˆà�:‰:×"Ñ"×$Ó$à"×;Ñ;¸O×T_ÑT_Ð;Ó`ˆOð # oÔ5Ø$3×$7Ñ$7Ð8KÓ$LÑ!ä$(§M¢M°$×2HÑ2HÓ$IÐ!ð 9=ÐÔ5ð !×/Ñ/Ò;Ø/3Ð!Ô,ð %'Ð!Ø'×-Ñ-Ö/‘�ÜÐ,×0Ò0ÜÐ-°!Ö4à/0¨!Ó,ñ	 0ð
 3DÐ.Ñ/Ø×!Ñ!Ð"7Ô8à�z‰z× Ñ ×+Ñ+¨wÔ6ð "¨Ô7Ø59�N >Ñ2à×#Ñ#Ò/Ð4EÈ^Ô4[Ø48×4HÑ4H�Ð0Ñ1à—Z‘Z×(Ò(ÑJ¨<ÐJ¸>ÑJ‰Fä�?×#Ò#Ü ðKàKZ×K_ÑK_ÓKaÐJbðdóð ð
 —Z’ZÑA ,ÐA°.ÑAÀ!ÕDˆFà�<‰<Ò#à—\‘\ &Ó)ˆFàˆr   c                ó,   <€ V ^8„  d   QhRS[ RS[RS[/# ©r   Útext_inputsrp   Úreturn)r`   r   r   )r   r   s   "€r   r   Ú TextToAudioPipeline.__annotate__  s   ø€ ×SÑS¡CÐS¹3ÐSÁ;ÑSr   c                ó   € R # ©Nr   ©rE   rƒ   rp   s   &&,r   Ú__call__ÚTextToAudioPipeline.__call__  s   € ÙPSr   c                óL   <€ V ^8„  d   QhRS[ S[,          RS[RS[ S[,          /# r‚   )Úlistr`   r   r   )r   r   s   "€r   r   r…     s!   ø€ ×_Ñ_¡D©¥IÐ_ÁÐ_ÉÉkÕIZÑ_r   c                ó   € R # r‡   r   rˆ   s   &&,r   r‰   rŠ     s   € Ù\_r   c                ó,   <€ V ^8„  d   QhRS[ RS[RS[/# r‚   )r
   r   r   )r   r   s   "€r   r   r…     s   ø€ ×XÑX¡HÐXÁÐXÉÑXr   c                ó   € R # r‡   r   rˆ   s   &&,r   r‰   rŠ   
  s   € ÙUXr   c                óL   <€ V ^8„  d   QhRS[ S[,          RS[RS[ S[,          /# r‚   )rŒ   r
   r   r   )r   r   s   "€r   r   r…     s"   ø€ ×dÑd¡D©¥NÐdÁcÐdÉdÑS^ÕN_Ñdr   c                ó   € R # r‡   r   rˆ   s   &&,r   r‰   rŠ     s   € Ùadr   c                ó&   <€ \         SV `  ! V3/ VB # )a¬  
Generates speech/audio from the inputs. See the [`TextToAudioPipeline`] documentation for more information.

Args:
    text_inputs (`str`, `list[str]`, `ChatType`, or `list[ChatType]`):
        One or several texts to generate. If strings or a list of string are passed, this pipeline will
        generate the corresponding text. Alternatively, a "chat", in the form of a list of dicts with "role"
        and "content" keys, can be passed, or a list of such chats. When chats are passed, the model's chat
        template will be used to format them before passing them to the model.
    forward_params (`dict`, *optional*):
        Parameters passed to the model generation/forward method. `forward_params` are always passed to the
        underlying model.
    generate_kwargs (`dict`, *optional*):
        The dictionary of ad-hoc parametrization of `generate_config` to be used for the generation call. For a
        complete overview of generate, check the [following
        guide](https://huggingface.co/docs/transformers/en/main_classes/text_generation). `generate_kwargs` are
        only passed to the underlying model if the latter is a generative model.

Return:
    `AudioOutput` or a list of `AudioOutput`, which is a `TypedDict` with two keys:

    - **audio** (`np.ndarray` of shape `(nb_channels, audio_length)`) -- The generated audio waveform.
    - **sampling_rate** (`int`) -- The sampling rate of the generated audio waveform.
)r2   r‰   )rE   rƒ   rp   r5   s   &&,€r   r‰   rŠ     s   ø€ ô2 ‰wÒ Ñ>¨~Ñ>Ð>r   c                óô   € \        V R R4      e   V P                  VR &   \        V RR4      e   V P                  VR&   V P                  VR&   RV'       d   TM/ RV'       d   TM/ /pVf   / pVe   WAR&   / pWV3# )Úassistant_modelNÚassistant_tokenizerra   rp   rq   rU   )rC   r”   ra   r•   )rE   Úpreprocess_paramsrp   rq   rU   ÚparamsÚpostprocess_paramss   &&&&&  r   Ú_sanitize_parametersÚ(TextToAudioPipeline._sanitize_parameters+  sž   € ô �4Ð*¨DÓ1Ò=Ø15×1EÑ1EˆOÐ-Ñ.Ü�4Ð.°Ó5ÒAØ+/¯>©>ˆO˜KÑ(Ø59×5MÑ5MˆOÐ1Ñ2ð ·™nÀBØ·/™Àrð
ˆð
 Ò$Ø "ÐØÒ'Ø4DÐ0Ñ1ØÐà Ð*<Ð<Ð<r   c                ó¸  € R p\        V\        4      '       d   RV9   d   VR,          pM+RpVR,          pM\        V\        4      '       d
   V^ ,          pV'       d*   V P                  e   V P                  P	                  V4      p\        V\
        4      '       dh   V Uu. uF?  q3P                  R\        P                  R7      P                  4       P                  4       NKA  	  pp\        V4      ^8”  d   TMV^ ,          pM=VP                  R\        P                  R7      P                  4       P                  4       p\        VV P                  R7      # u upi )Fr   TÚ	sequencesÚcpu)r:   r^   )r   r   )r_   ÚdictÚtupler=   ÚdecoderŒ   r9   ÚtorchÚfloatÚnumpyÚsqueezerz   r   r   )rE   r   Úneeds_decodingÚels   &&  r   ÚpostprocessÚTextToAudioPipeline.postprocessE  s  € ØˆÜ�eœT×"Ò"Ø˜%ÔØ˜g�‘à!%�Ø˜kÕ*‘Ü˜œu×%Ò%Ø˜!•HˆEç˜dŸn™nÒ8Ø—N‘N×)Ñ)¨%Ó0ˆEä�eœT×"Ò"ÙX]Ó^ÑX]ÐRT—U‘U %¬u¯{©{�UÓ;×AÑAÓC×KÑKÖMÑX]ˆEÐ^Ü  ›Z¨!œ^‘E°°qµ‰Eà—H‘H E´·±�HÓ=×CÑCÓE×MÑMÓOˆEäØØ×,Ñ,ô
ð 	
ùò _s   Â AE)r*   r=   r   r)   )NNNN)r   r   r   r   r    Ú_pipeline_calls_generateÚ_load_processorÚ_load_image_processorÚ_load_feature_extractorÚ_load_tokenizerr   Ú_default_generation_configr3   rm   r   r   r‰   r™   r§   r"   r#   Ú__classcell__)r5   r   s   @@r   r&   r&   .   s°   ù‡ € ñ2ðh  $ÐØ€OØ!ÐØ#ÐØ€Oñ "2ÀÔ!EÐð+P dð +P¸$ð +PÐPT÷ +PòZ.ò`9ðv ßSó ØSàß_ó Ø_àßXó ØXàßdó Ødõ?ô6=÷4
ò 
r   r&   )ru   Útypingr   r   r   Úaudio_utilsr   Ú
generationr   Úutilsr   Úutils.chat_template_utilsr	   r
   Úbaser   r¡   Úmodels.auto.modeling_autor   Ú!models.speecht5.modeling_speecht5r   r8   r   r&   r   r   r   Ú<module>r¸      sU   ðó ß +Ñ +å $Ý )Ý &ß 6Ý ñ ×ÒÛåQÝCà1Ð ô	�) 5õ 	ôn
˜(ö n
r   