


'''simple docstring'''

from ...processing_utils import ProcessorMixin
class   __lowerCAmelCase						(lowercase_     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Tuple  					=							"""SpeechT5FeatureExtractor"""
      lowerCAmelCase__					:     Union[str, Any]  					=							"""SpeechT5Tokenizer"""



      def __init__(self    :    Any   ,						UpperCamelCase    :    List[str]   ,						UpperCamelCase    :    List[Any] ):

             '''simple docstring'''







             super().__init__(UpperCamelCase   ,						UpperCamelCase )



      def __call__(self    :    Optional[int]   ,						*UpperCamelCase    :    int   ,						**UpperCamelCase    :    Tuple ):

             '''simple docstring'''







             lowercase__      			= kwargs.pop('''audio'''   ,						UpperCamelCase )
             lowercase__      			= kwargs.pop('''text'''   ,						UpperCamelCase )
             lowercase__      			= kwargs.pop('''text_target'''   ,						UpperCamelCase )
             lowercase__      			= kwargs.pop('''audio_target'''   ,						UpperCamelCase )
             lowercase__      			= kwargs.pop('''sampling_rate'''   ,						UpperCamelCase )

             if audio is not None and text is not None:
                    raise ValueError(
                        '''Cannot process both `audio` and `text` inputs. Did you mean `audio_target` or `text_target`?''' )
             if audio_target is not None and text_target is not None:
                    raise ValueError(
                        '''Cannot process both `audio_target` and `text_target` inputs. Did you mean `audio` or `text`?''' )
             if audio is None and audio_target is None and text is None and text_target is None:
                    raise ValueError(
                        '''You need to specify either an `audio`, `audio_target`, `text`, or `text_target` input to process.''' )

             if audio is not None:
                    lowercase__      			= self.feature_extractor(UpperCamelCase   ,						*UpperCamelCase   ,						sampling_rate=UpperCamelCase   ,						**UpperCamelCase )
             elif text is not None:
                    lowercase__      			= self.tokenizer(UpperCamelCase   ,						**UpperCamelCase )
             else:
                    lowercase__      			= None

             if audio_target is not None:
                    lowercase__      			= self.feature_extractor(audio_target=UpperCamelCase   ,						*UpperCamelCase   ,						sampling_rate=UpperCamelCase   ,						**UpperCamelCase )
                    lowercase__      			= targets['''input_values''']
             elif text_target is not None:
                    lowercase__      			= self.tokenizer(UpperCamelCase   ,						**UpperCamelCase )
                    lowercase__      			= targets['''input_ids''']
             else:
                    lowercase__      			= None

             if inputs is None:
                    return targets

             if targets is not None:
                    lowercase__      			= labels

                    lowercase__      			= targets.get('''attention_mask''' )
                    if decoder_attention_mask is not None:
                           lowercase__      			= decoder_attention_mask

             return inputs



      def       UpperCamelCase__		(self    :    Tuple   ,						*UpperCamelCase    :    Optional[Any]   ,						**UpperCamelCase    :    str ):

             '''simple docstring'''







             lowercase__      			= kwargs.pop('''input_values'''   ,						UpperCamelCase )
             lowercase__      			= kwargs.pop('''input_ids'''   ,						UpperCamelCase )
             lowercase__      			= kwargs.pop('''labels'''   ,						UpperCamelCase )

             if input_values is not None and input_ids is not None:
                    raise ValueError('''Cannot process both `input_values` and `input_ids` inputs.''' )
             if input_values is None and input_ids is None and labels is None:
                    raise ValueError(
                        '''You need to specify either an `input_values`, `input_ids`, or `labels` input to be padded.''' )

             if input_values is not None:
                    lowercase__      			= self.feature_extractor.pad(UpperCamelCase   ,						*UpperCamelCase   ,						**UpperCamelCase )
             elif input_ids is not None:
                    lowercase__      			= self.tokenizer.pad(UpperCamelCase   ,						**UpperCamelCase )
             else:
                    lowercase__      			= None

             if labels is not None:
                    if "input_ids" in labels or (isinstance(UpperCamelCase   ,						UpperCamelCase ) and "input_ids" in labels[0]):
                           lowercase__      			= self.tokenizer.pad(UpperCamelCase   ,						**UpperCamelCase )
                           lowercase__      			= targets['''input_ids''']
                    else:
                           lowercase__      			= self.feature_extractor.feature_size
                           lowercase__      			= self.feature_extractor.num_mel_bins
                           lowercase__      			= self.feature_extractor.pad(UpperCamelCase   ,						*UpperCamelCase   ,						**UpperCamelCase )
                           lowercase__      			= feature_size_hack
                           lowercase__      			= targets['''input_values''']
             else:
                    lowercase__      			= None

             if inputs is None:
                    return targets

             if targets is not None:
                    lowercase__      			= labels

                    lowercase__      			= targets.get('''attention_mask''' )
                    if decoder_attention_mask is not None:
                           lowercase__      			= decoder_attention_mask

             return inputs



      def       UpperCamelCase__		(self    :    str   ,						*UpperCamelCase    :    int   ,						**UpperCamelCase    :    Any ):

             '''simple docstring'''







             return self.tokenizer.batch_decode(*UpperCamelCase   ,						**UpperCamelCase )






      def       UpperCamelCase__		(self    :    Union[str, Any]   ,						*UpperCamelCase    :    Optional[Any]   ,						**UpperCamelCase    :    Optional[int] ):

             '''simple docstring'''







             return self.tokenizer.decode(*UpperCamelCase   ,						**UpperCamelCase )








'''simple docstring'''

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase							:   Tuple  						=	logging.get_logger(__name__)

lowerCamelCase							:   Dict  						=	{
    'microsoft/cvt-13': 'https://huggingface.co/microsoft/cvt-13/resolve/main/config.json',
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}
class   __lowerCAmelCase						(lowercase_     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Tuple  					=							"""cvt"""



      def __init__(self    :    int   ,						UpperCamelCase    :    List[Any]=3   ,						UpperCamelCase    :    int=[7, 3, 3]   ,						UpperCamelCase    :    str=[4, 2, 2]   ,						UpperCamelCase    :    Dict=[2, 1, 1]   ,						UpperCamelCase    :    Dict=[64, 192, 384]   ,						UpperCamelCase    :    Dict=[1, 3, 6]   ,						UpperCamelCase    :    Dict=[1, 2, 10]   ,						UpperCamelCase    :    Any=[4.0, 4.0, 4.0]   ,						UpperCamelCase    :    Optional[int]=[0.0, 0.0, 0.0]   ,						UpperCamelCase    :    Optional[int]=[0.0, 0.0, 0.0]   ,						UpperCamelCase    :    int=[0.0, 0.0, 0.1]   ,						UpperCamelCase    :    Any=[True, True, True]   ,						UpperCamelCase    :    int=[False, False, True]   ,						UpperCamelCase    :    Union[str, Any]=["dw_bn", "dw_bn", "dw_bn"]   ,						UpperCamelCase    :    Optional[int]=[3, 3, 3]   ,						UpperCamelCase    :    Tuple=[1, 1, 1]   ,						UpperCamelCase    :    Any=[2, 2, 2]   ,						UpperCamelCase    :    Dict=[1, 1, 1]   ,						UpperCamelCase    :    List[str]=[1, 1, 1]   ,						UpperCamelCase    :    str=0.02   ,						UpperCamelCase    :    int=1E-12   ,						**UpperCamelCase    :    Union[str, Any]   ,						):

             '''simple docstring'''







             super().__init__(**UpperCamelCase )
             lowercase__      			= num_channels
             lowercase__      			= patch_sizes
             lowercase__      			= patch_stride
             lowercase__      			= patch_padding
             lowercase__      			= embed_dim
             lowercase__      			= num_heads
             lowercase__      			= depth
             lowercase__      			= mlp_ratio
             lowercase__      			= attention_drop_rate
             lowercase__      			= drop_rate
             lowercase__      			= drop_path_rate
             lowercase__      			= qkv_bias
             lowercase__      			= cls_token
             lowercase__      			= qkv_projection_method
             lowercase__      			= kernel_qkv
             lowercase__      			= padding_kv
             lowercase__      			= stride_kv
             lowercase__      			= padding_q
             lowercase__      			= stride_q
             lowercase__      			= initializer_range
             lowercase__      			= layer_norm_eps




