Ë
    ÜÓ^j	  ã                   ó|   — d Z ddlmZmZmZ ddlmZmZmZ ddl	m
Z
  G d„ ded¬«      Ze
 G d	„ d
e«      «       Zd
gZy)z%
Speech processor class for Wav2Vec2
é   )ÚProcessingKwargsÚProcessorMixinÚUnpack)Ú
AudioInputÚPreTokenizedInputÚ	TextInput)Úauto_docstringc                   ó   — e Zd Zi Zy)ÚWav2Vec2ProcessorKwargsN)Ú__name__Ú
__module__Ú__qualname__Ú	_defaults© ó    ú{/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/wav2vec2/processing_wav2vec2.pyr   r      s   „ Ø�Ir   r   F)Útotalc            	       ó‚   ‡ — e Zd Zˆ fd„Ze	 	 d	dedz  deee   z  ez  e	z  dz  de
e   fd„«       Zd„ Zed„ «       Zˆ xZS )
ÚWav2Vec2Processorc                 ó&   •— t         ‰| �  ||«       y )N)ÚsuperÚ__init__)ÚselfÚfeature_extractorÚ	tokenizerÚ	__class__s      €r   r   zWav2Vec2Processor.__init__   s   ø€ Ü‰ÑÐ*¨IÕ6r   NÚaudioÚtextÚkwargsc                 óþ   — |€|€t        d«      ‚ | j                  t        fd| j                  j                  i|¤Ž}|� | j
                  |fi |d   ¤Ž}|� | j                  |fi |d   ¤Ž}|€S |€S d   d<   |S )zª
        Returns:
            This method returns the results of each `call` method. If both are used, the output is a dictionary containing the results of both.
        zAYou need to specify either an `audio` or `text` input to process.Útokenizer_init_kwargsÚaudio_kwargsÚtext_kwargsÚ	input_idsÚlabels)Ú
ValueErrorÚ_merge_kwargsr   r   Úinit_kwargsr   )r   r   r   r   Úoutput_kwargsÚinputsÚ	encodingss          r   Ú__call__zWav2Vec2Processor.__call__    s·   € ð ˆ=˜T˜\ÜÐ`ÓaÐaà*˜×*Ñ*Ü#ñ
à"&§.¡.×"<Ñ"<ð
ð ñ
ˆð ÐØ+�T×+Ñ+¨EÑS°]À>Ñ5RÑSˆFØÐØ&˜Ÿ™ tÑL¨}¸]Ñ/KÑLˆIàˆ<ØˆMØˆ]ØÐà(¨Ñ5ˆF�8ÑØˆMr   c                 ó   — |j                  dd«      }|j                  dd«      }t        |«      dkD  r
|d   }|dd }|�  | j                  j                  |g|¢­i |¤Ž}|� | j                  j                  |fi |¤Ž}|€|S |€|S |d   |d<   |S )ag  
        This method operates on batches of extracted features and/or tokenized text. It forwards all arguments to
        [`Wav2Vec2FeatureExtractor.pad`] and/or [`PreTrainedTokenizer.pad`] depending on the input modality and returns their outputs. If both modalities are passed, [`Wav2Vec2FeatureExtractor.pad`] and [`PreTrainedTokenizer.pad`] are called.

        Args:
            input_features:
                When the first argument is a dictionary containing a batch of tensors, or the `input_features` argument is present, it is passed to [`Wav2Vec2FeatureExtractor.pad`].
            labels:
                When the `label` argument is present, it is passed to [`PreTrainedTokenizer.pad`].

        Returns:
            This method returns the results of each `pad` method. If both are used, the output is a dictionary containing the results of both.
        Úinput_featuresNr%   é    é   r$   )ÚpopÚlenr   Úpadr   )r   Úargsr   r.   r%   s        r   r3   zWav2Vec2Processor.padA   s¹   € ð  Ÿ™Ð$4°dÓ;ˆØ—‘˜H dÓ+ˆÜˆt‹9�qŠ=Ø! !™WˆNØ˜˜�8ˆDàÐ%Ø7˜T×3Ñ3×7Ñ7¸ÐXÈÒXÐQWÑXˆNØÐØ'�T—^‘^×'Ñ'¨Ñ9°&Ñ9ˆFàˆ>Ø!Ð!ØÐ#ØˆMà'-¨kÑ':ˆN˜8Ñ$Ø!Ð!r   c                 ó:   — | j                   j                  }|dgz   S )Nr%   )r   Úmodel_input_names)r   Úfeature_extractor_input_namess     r   r6   z#Wav2Vec2Processor.model_input_namesb   s#   € ð )-×(>Ñ(>×(PÑ(PÐ%Ø,°¨zÑ9Ð9r   )NN)r   r   r   r   r	   r   ÚstrÚlistr   r   r   r   r,   r3   Úpropertyr6   Ú__classcell__)r   s   @r   r   r      s~   ø„ ô7ð ð $(ØGKñà˜DÑ ðð �D˜‘I‰o 	Ñ)Ð,=Ñ=ÀÑDðð Ð0Ñ1ò	ó ðò@"ðB ñ:ó ô:r   r   N)Ú__doc__Úprocessing_utilsr   r   r   Útokenization_utils_baser   r   r   Úutilsr	   r   r   Ú__all__r   r   r   ú<module>rA      sT   ðñ÷ IÑ Hß OÑ OÝ #ôÐ.°eõ ð ôJ:˜ó J:ó ðJ:ðZ Ð
�r   