
    Z j                     F    S r SSKJr  SSKJr  \ " S S\5      5       rS/rg)z$Speech processor class for SpeechT5.   )ProcessorMixin)auto_docstringc                   >   ^  \ rS rSrU 4S jr\S 5       rS rSrU =r	$ )SpeechT5Processor   c                 $   > [         TU ]  X5        g )N)super__init__)selffeature_extractor	tokenizer	__class__s      ځ/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/speecht5/processing_speecht5.pyr
   SpeechT5Processor.__init__   s    *6    c                 V   UR                  SS 5      nUR                  SS 5      nUR                  SS 5      nUR                  SS 5      nUR                  SS 5      nUb  Ub  [        S5      eUb  Ub  [        S5      eUc  Uc  Uc  Uc  [        S5      eUb  U R                  " U/UQ7SU0UD6nOUb  U R                  " U40 UD6nOS nUb  U R                  " XUS	.UD6n	U	S
   n
OUb  U R                  " U40 UD6n	U	S   n
OS n	Uc  U	$ U	b  W
US'   U	R	                  S5      nUb  XS'   U$ )Naudiotexttext_targetaudio_targetsampling_ratez\Cannot process both `audio` and `text` inputs. Did you mean `audio_target` or `text_target`?z\Cannot process both `audio_target` and `text_target` inputs. Did you mean `audio` or `text`?zaYou need to specify either an `audio`, `audio_target`, `text`, or `text_target` input to process.)r   r   input_values	input_idslabelsattention_maskdecoder_attention_mask)pop
ValueErrorr   r   get)r   argskwargsr   r   r   r   r   inputstargetsr   r   s               r   __call__SpeechT5Processor.__call__   s   

7D)zz&$'jj5zz.$7

?D9!1n  #(?n  =\1dl{GZs  ++E`D``Y_`F^^D3F3FF#,,]juntuG^,F$nn[;F;G[)FG>N%F8%,[[1A%B"%13I/0r   c                    UR                  SS5      nUR                  SS5      nUR                  SS5      nUb  Ub  [        S5      eUc  Uc  Uc  [        S5      eUb!  U R                  R                  " U/UQ70 UD6nO#Ub  U R                  R                  " U40 UD6nOSnUb  SU;   d  [        U[        5      (       a,  SUS   ;   a#  U R                  R                  " U40 UD6nUS   nOsU R                  R                  nU R                  R                  U R                  l        U R                  R                  " U/UQ70 UD6nXR                  l        US   nOSnUc  U$ Ub  XVS'   UR                  S5      n	U	b  XS	'   U$ )
a  
Collates the audio and text inputs, as well as their targets, into a padded batch.

Audio inputs are padded by SpeechT5FeatureExtractor's [`~SpeechT5FeatureExtractor.pad`]. Text inputs are padded
by SpeechT5Tokenizer's [`~SpeechT5Tokenizer.pad`].

Valid input combinations are:

- `input_ids` only
- `input_values` only
- `labels` only, either log-mel spectrograms or text tokens
- `input_ids` and log-mel spectrogram `labels`
- `input_values` and text `labels`

Please refer to the docstring of the above two methods for more information.
r   Nr   r   z:Cannot process both `input_values` and `input_ids` inputs.zZYou need to specify either an `input_values`, `input_ids`, or `labels` input to be padded.    r   r   )
r   r   r   padr   
isinstancelistfeature_sizenum_mel_binsr   )
r   r    r!   r   r   r   r"   r#   feature_size_hackr   s
             r   r(   SpeechT5Processor.padJ   s   " zz.$7JJ{D1	Hd+#	(=YZZI$5&.l  #++//NtNvNF"^^''	<V<FFf$FD)A)AkU[\]U^F^..,,V>v> -$($:$:$G$G!6:6L6L6Y6Y&&30044VMdMfM6G&&3 0G>N%8%,[[1A%B"%13I/0r    )
__name__
__module____qualname____firstlineno__r
   r   r$   r(   __static_attributes____classcell__)r   s   @r   r   r      s'    7 . .`: :r   r   N)__doc__processing_utilsr   utilsr   r   __all__r/   r   r   <module>r:      s9    + . # o o od 
r   