
    1i	                     |    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     l/mnt/e/genesis-system/.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SF&tL}]/KLI<M](5F8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      $4d;Hd+t9q=!!WN8D%7T3377XXQWXN'T^^''9&9F>!!#M'-k':N8$!!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Io	),==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   