Ë
    ÜÓ^jý  ã                   óF   — d Z ddlmZ ddlmZ e G d„ de«      «       ZdgZy)z$Speech processor class for SpeechT5.é   )ÚProcessorMixin)Úauto_docstringc                   ó4   ‡ — e Zd Zˆ fd„Zed„ «       Zd„ Zˆ xZS )ÚSpeechT5Processorc                 ó&   •— t         ‰| �  ||«       y )N)ÚsuperÚ__init__)ÚselfÚfeature_extractorÚ	tokenizerÚ	__class__s      €ú{/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/speecht5/processing_speecht5.pyr	   zSpeechT5Processor.__init__   s   ø€ Ü‰ÑÐ*¨IÕ6ó    c                 ó<  — |j                  dd «      }|j                  dd «      }|j                  dd «      }|j                  dd «      }|j                  dd «      }|�|�t        d«      ‚|�|�t        d«      ‚|€|€|€|€t        d«      ‚|� | j                  |g|¢­d|i|¤Ž}n|� | j                  |fi |¤Ž}nd }|� | j                  |||d	œ|¤Ž}	|	d
   }
n|� | j                  |fi |¤Ž}	|	d   }
nd }	|€|	S |	�
|d<   |	j	                  d«      }|�||d<   |S )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__zSpeechT5Processor.__call__   s�  € à—
‘
˜7 DÓ)ˆØ�z‰z˜& $Ó'ˆØ—j‘j °Ó5ˆØ—z‘z .°$Ó7ˆØŸ
™
 ?°DÓ9ˆàÐ Ð!1ÜØnóð ð Ð#¨Ð(?ÜØnóð ð ˆ=˜\Ð1°d°lÀ{ÐGZÜØsóð ð ÐØ+�T×+Ñ+¨EÐ`°DÒ`ÈÐ`ÐY_Ñ`‰FØÐØ#�T—^‘^ DÑ3¨FÑ3‰FàˆFàÐ#Ø,�d×,Ñ,È¸,Ð]jÑuÐntÑuˆGØ˜^Ñ,‰FØÐ$Ø$�d—n‘n [Ñ;°FÑ;ˆGØ˜[Ñ)‰FàˆGàˆ>ØˆNàÐØ%ˆF�8Ñà%,§[¡[Ð1AÓ%BÐ"Ø%Ð1Ø3I�Ð/Ñ0àˆr   c                 óê  — |j                  dd«      }|j                  dd«      }|j                  dd«      }|�|�t        d«      ‚|€|€|€t        d«      ‚|�! | j                  j                  |g|¢­i |¤Ž}n"|� | j                  j                  |fi |¤Ž}nd}|�°d|v st        |t        «      r*d|d   v r# | j                  j                  |fi |¤Ž}|d   }nt| j                  j                  }| j                  j                  | j                  _         | j                  j                  |g|¢­i |¤Ž}|| j                  _        |d   }nd}|€|S |�||d<   |j                  d«      }	|	�|	|d	<   |S )
au  
        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%   zSpeechT5Processor.padJ   s¯  € ð" —z‘z .°$Ó7ˆØ—J‘J˜{¨DÓ1ˆ	Ø—‘˜H dÓ+ˆàÐ#¨	Ð(=ÜÐYÓZÐZØÐ IÐ$5¸&¸.ÜØlóð ð Ð#Ø/�T×+Ñ+×/Ñ/°ÐN¸tÒNÀvÑN‰FØÐ"Ø'�T—^‘^×'Ñ'¨	Ñ<°VÑ<‰FàˆFàÐØ˜fÑ$¬°F¼DÔ)AÀkÐU[Ð\]ÑU^ÑF^Ø,˜$Ÿ.™.×,Ñ,¨VÑ>°vÑ>�Ø  Ñ-‘à$(×$:Ñ$:×$GÑ$GÐ!Ø6:×6LÑ6L×6YÑ6Y�×&Ñ&Ô3Ø4˜$×0Ñ0×4Ñ4°VÐM¸dÒMÀfÑM�Ø6G�×&Ñ&Ô3Ø  Ñ0‘àˆGàˆ>ØˆNàÐØ%ˆF�8Ñà%,§[¡[Ð1AÓ%BÐ"Ø%Ð1Ø3I�Ð/Ñ0àˆr   )Ú__name__Ú
__module__Ú__qualname__r	   r   r"   r%   Ú__classcell__)r   s   @r   r   r      s"   ø„ ô7ð ñ.ó ð.ö`:r   r   N)Ú__doc__Úprocessing_utilsr   Úutilsr   r   Ú__all__© r   r   ú<module>r4      s9   ðñ +å .Ý #ð ôo˜ó oó ðoðd Ð
�r   