






import functools
import operator

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


SCREAMING_SNAKE_CASE__   :      Tuple				=		logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__   :      Optional[Any]				=		{
    """microsoft/unispeech-sat-base-100h-libri-ft""": (
        """https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json"""
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}
class     lowerCamelCase_					(   lowerCamelCase			):
				a__       							=	'''unispeech-sat'''







				def __init__(    self							,       __lowerCAmelCase=3_2							,       __lowerCAmelCase=7_6_8							,       __lowerCAmelCase=1_2							,       __lowerCAmelCase=1_2							,       __lowerCAmelCase=3_0_7_2							,       __lowerCAmelCase="gelu"							,       __lowerCAmelCase=0.1							,       __lowerCAmelCase=0.1							,       __lowerCAmelCase=0.1							,       __lowerCAmelCase=0.0							,       __lowerCAmelCase=0.0							,       __lowerCAmelCase=0.1							,       __lowerCAmelCase=0.1							,       __lowerCAmelCase=0.02							,       __lowerCAmelCase=1E-5							,       __lowerCAmelCase="group"							,       __lowerCAmelCase="gelu"							,       __lowerCAmelCase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)							,       __lowerCAmelCase=(5, 2, 2, 2, 2, 2, 2)							,       __lowerCAmelCase=(1_0, 3, 3, 3, 3, 2, 2)							,       __lowerCAmelCase=False							,       __lowerCAmelCase=1_2_8							,       __lowerCAmelCase=1_6							,       __lowerCAmelCase=False							,       __lowerCAmelCase=True							,       __lowerCAmelCase=0.05							,       __lowerCAmelCase=1_0							,       __lowerCAmelCase=2							,       __lowerCAmelCase=0.0							,       __lowerCAmelCase=1_0							,       __lowerCAmelCase=0							,       __lowerCAmelCase=3_2_0							,       __lowerCAmelCase=2							,       __lowerCAmelCase=0.1							,       __lowerCAmelCase=1_0_0							,       __lowerCAmelCase=2_5_6							,       __lowerCAmelCase=2_5_6							,       __lowerCAmelCase=0.1							,       __lowerCAmelCase="mean"							,       __lowerCAmelCase=False							,       __lowerCAmelCase=False							,       __lowerCAmelCase=2_5_6							,       __lowerCAmelCase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)							,       __lowerCAmelCase=(5, 3, 3, 1, 1)							,       __lowerCAmelCase=(1, 2, 3, 1, 1)							,       __lowerCAmelCase=5_1_2							,       __lowerCAmelCase=0							,       __lowerCAmelCase=1							,       __lowerCAmelCase=2							,       __lowerCAmelCase=5_0_4							,       **__lowerCAmelCase							,       ):
								"""simple docstring"""
								super().__init__(**__lowerCAmelCase							,       pad_token_id=__lowerCAmelCase							,       bos_token_id=__lowerCAmelCase							,       eos_token_id=__lowerCAmelCase  )
								__magic_name__		:Optional[int]   =   hidden_size
								__magic_name__		:Any   =   feat_extract_norm
								__magic_name__		:int   =   feat_extract_activation
								__magic_name__		:str   =   list(__lowerCAmelCase  )
								__magic_name__		:Dict   =   list(__lowerCAmelCase  )
								__magic_name__		:Tuple   =   list(__lowerCAmelCase  )
								__magic_name__		:Dict   =   conv_bias
								__magic_name__		:Dict   =   num_conv_pos_embeddings
								__magic_name__		:int   =   num_conv_pos_embedding_groups
								__magic_name__		:Any   =   len(self.conv_dim  )
								__magic_name__		:Optional[Any]   =   num_hidden_layers
								__magic_name__		:List[Any]   =   intermediate_size
								__magic_name__		:Union[str, Any]   =   hidden_act
								__magic_name__		:List[str]   =   num_attention_heads
								__magic_name__		:Tuple   =   hidden_dropout
								__magic_name__		:Tuple   =   attention_dropout
								__magic_name__		:List[str]   =   activation_dropout
								__magic_name__		:Any   =   feat_proj_dropout
								__magic_name__		:List[str]   =   final_dropout
								__magic_name__		:Tuple   =   layerdrop
								__magic_name__		:List[Any]   =   layer_norm_eps
								__magic_name__		:List[Any]   =   initializer_range
								__magic_name__		:Optional[Any]   =   vocab_size
								__magic_name__		:Tuple   =   num_clusters
								__magic_name__		:str   =   do_stable_layer_norm
								__magic_name__		:Dict   =   use_weighted_layer_sum

								if (
								    (len(self.conv_stride  ) != self.num_feat_extract_layers)
								    or (len(self.conv_kernel  ) != self.num_feat_extract_layers)
								    or (len(self.conv_dim  ) != self.num_feat_extract_layers)
								):
												raise ValueError(
												    '''Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =='''
												    ''' `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ='''
												    F''' {len(self.conv_dim  )}`, `len(config.conv_stride) = {len(self.conv_stride  )}`,'''
												    F''' `len(config.conv_kernel) = {len(self.conv_kernel  )}`.'''  )

								# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
								__magic_name__		:Dict   =   apply_spec_augment
								__magic_name__		:List[Any]   =   mask_time_prob
								__magic_name__		:Tuple   =   mask_time_length
								__magic_name__		:Any   =   mask_time_min_masks
								__magic_name__		:Optional[Any]   =   mask_feature_prob
								__magic_name__		:int   =   mask_feature_length
								__magic_name__		:Optional[int]   =   mask_feature_min_masks

								# parameters for pretraining with codevector quantized representations
								__magic_name__		:Any   =   num_codevectors_per_group
								__magic_name__		:Dict   =   num_codevector_groups
								__magic_name__		:List[str]   =   contrastive_logits_temperature
								__magic_name__		:List[Any]   =   feat_quantizer_dropout
								__magic_name__		:List[str]   =   num_negatives
								__magic_name__		:Union[str, Any]   =   codevector_dim
								__magic_name__		:Optional[int]   =   proj_codevector_dim
								__magic_name__		:Optional[Any]   =   diversity_loss_weight

								# ctc loss
								__magic_name__		:Tuple   =   ctc_loss_reduction
								__magic_name__		:Tuple   =   ctc_zero_infinity

								# SequenceClassification-specific parameter. Feel free to ignore for other classes.
								__magic_name__		:Tuple   =   classifier_proj_size

								# XVector-specific parameters. Feel free to ignore for other classes.
								__magic_name__		:Any   =   list(__lowerCAmelCase  )
								__magic_name__		:str   =   list(__lowerCAmelCase  )
								__magic_name__		:str   =   list(__lowerCAmelCase  )
								__magic_name__		:Union[str, Any]   =   xvector_output_dim







				@property
				def       A						(    self  ):
								"""simple docstring"""
								return functools.reduce(operator.mul							,       self.conv_stride							,       1  )














import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class     lowerCamelCase_					(   lowerCamelCase			):
				a__       							=	['''image_processor''', '''tokenizer''']
				a__       							=	'''ChineseCLIPImageProcessor'''
				a__       							=	('''BertTokenizer''', '''BertTokenizerFast''')







				def __init__(    self							,       __lowerCAmelCase=None							,       __lowerCAmelCase=None							,       **__lowerCAmelCase  ):
								"""simple docstring"""
								__magic_name__		:Tuple   =   None
								if "feature_extractor" in kwargs:
												warnings.warn(
												    '''The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'''
												    ''' instead.'''							,       __lowerCAmelCase							,       )
												__magic_name__		:Optional[Any]   =   kwargs.pop('''feature_extractor'''  )

								__magic_name__		:Tuple   =   image_processor if image_processor is not None else feature_extractor
								if image_processor is None:
												raise ValueError('''You need to specify an `image_processor`.'''  )
								if tokenizer is None:
												raise ValueError('''You need to specify a `tokenizer`.'''  )

								super().__init__(__lowerCAmelCase							,       __lowerCAmelCase  )
								__magic_name__		:List[Any]   =   self.image_processor







				def __call__(    self							,       __lowerCAmelCase=None							,       __lowerCAmelCase=None							,       __lowerCAmelCase=None							,       **__lowerCAmelCase  ):
								"""simple docstring"""

								if text is None and images is None:
												raise ValueError('''You have to specify either text or images. Both cannot be none.'''  )

								if text is not None:
												__magic_name__		:int   =   self.tokenizer(__lowerCAmelCase							,       return_tensors=__lowerCAmelCase							,       **__lowerCAmelCase  )

								if images is not None:
												__magic_name__		:Dict   =   self.image_processor(__lowerCAmelCase							,       return_tensors=__lowerCAmelCase							,       **__lowerCAmelCase  )

								if text is not None and images is not None:
												__magic_name__		:Union[str, Any]   =   image_features.pixel_values
												return encoding
								elif text is not None:
												return encoding
								else:
												return BatchEncoding(data=dict(**__lowerCAmelCase  )							,       tensor_type=__lowerCAmelCase  )







				def       A						(    self							,       *__lowerCAmelCase							,       **__lowerCAmelCase  ):
								"""simple docstring"""
								return self.tokenizer.batch_decode(*__lowerCAmelCase							,       **__lowerCAmelCase  )







				def       A						(    self							,       *__lowerCAmelCase							,       **__lowerCAmelCase  ):
								"""simple docstring"""
								return self.tokenizer.decode(*__lowerCAmelCase							,       **__lowerCAmelCase  )







				@property
				def       A						(    self  ):
								"""simple docstring"""
								__magic_name__		:List[Any]   =   self.tokenizer.model_input_names
								__magic_name__		:Any   =   self.image_processor.model_input_names
								return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names  )  )







				@property
				def       A						(    self  ):
								"""simple docstring"""
								warnings.warn(
								    '''`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'''							,       __lowerCAmelCase							,       )
								return self.image_processor_class






