


'''simple docstring'''
import functools
import operator

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


__snake_case				 =	logging.get_logger(__name__)

__snake_case				 =	{
    '''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   lowercase      (				A__   ):

		"""simple docstring"""

		_a       					=							'unispeech-sat'




		def __init__(						self       ,  UpperCamelCase_=32       ,  UpperCamelCase_=768       ,  UpperCamelCase_=12       ,  UpperCamelCase_=12       ,  UpperCamelCase_=3072       ,  UpperCamelCase_="gelu"       ,  UpperCamelCase_=0.1       ,  UpperCamelCase_=0.1       ,  UpperCamelCase_=0.1       ,  UpperCamelCase_=0.0       ,  UpperCamelCase_=0.0       ,  UpperCamelCase_=0.1       ,  UpperCamelCase_=0.1       ,  UpperCamelCase_=0.02       ,  UpperCamelCase_=1e-5       ,  UpperCamelCase_="group"       ,  UpperCamelCase_="gelu"       ,  UpperCamelCase_=(512, 512, 512, 512, 512, 512, 512)       ,  UpperCamelCase_=(5, 2, 2, 2, 2, 2, 2)       ,  UpperCamelCase_=(10, 3, 3, 3, 3, 2, 2)       ,  UpperCamelCase_=False       ,  UpperCamelCase_=128       ,  UpperCamelCase_=16       ,  UpperCamelCase_=False       ,  UpperCamelCase_=True       ,  UpperCamelCase_=0.05       ,  UpperCamelCase_=10       ,  UpperCamelCase_=2       ,  UpperCamelCase_=0.0       ,  UpperCamelCase_=10       ,  UpperCamelCase_=0       ,  UpperCamelCase_=320       ,  UpperCamelCase_=2       ,  UpperCamelCase_=0.1       ,  UpperCamelCase_=100       ,  UpperCamelCase_=256       ,  UpperCamelCase_=256       ,  UpperCamelCase_=0.1       ,  UpperCamelCase_="mean"       ,  UpperCamelCase_=False       ,  UpperCamelCase_=False       ,  UpperCamelCase_=256       ,  UpperCamelCase_=(512, 512, 512, 512, 1500)       ,  UpperCamelCase_=(5, 3, 3, 1, 1)       ,  UpperCamelCase_=(1, 2, 3, 1, 1)       ,  UpperCamelCase_=512       ,  UpperCamelCase_=0       ,  UpperCamelCase_=1       ,  UpperCamelCase_=2       ,  UpperCamelCase_=504       ,  **UpperCamelCase_       ,  ):

							'''simple docstring'''


							super().__init__(**UpperCamelCase_       ,  pad_token_id=UpperCamelCase_       ,  bos_token_id=UpperCamelCase_       ,  eos_token_id=UpperCamelCase_				)
							UpperCamelCase__  :int				   =					hidden_size
							UpperCamelCase__  :int				   =					feat_extract_norm
							UpperCamelCase__  :int				   =					feat_extract_activation
							UpperCamelCase__  :int				   =					list(UpperCamelCase_				)
							UpperCamelCase__  :Any				   =					list(UpperCamelCase_				)
							UpperCamelCase__  :int				   =					list(UpperCamelCase_				)
							UpperCamelCase__  :int				   =					conv_bias
							UpperCamelCase__  :List[Any]				   =					num_conv_pos_embeddings
							UpperCamelCase__  :Any				   =					num_conv_pos_embedding_groups
							UpperCamelCase__  :Union[str, Any]				   =					len(self.conv_dim				)
							UpperCamelCase__  :Union[str, Any]				   =					num_hidden_layers
							UpperCamelCase__  :str				   =					intermediate_size
							UpperCamelCase__  :int				   =					hidden_act
							UpperCamelCase__  :List[str]				   =					num_attention_heads
							UpperCamelCase__  :Tuple				   =					hidden_dropout
							UpperCamelCase__  :int				   =					attention_dropout
							UpperCamelCase__  :int				   =					activation_dropout
							UpperCamelCase__  :Union[str, Any]				   =					feat_proj_dropout
							UpperCamelCase__  :int				   =					final_dropout
							UpperCamelCase__  :List[Any]				   =					layerdrop
							UpperCamelCase__  :Tuple				   =					layer_norm_eps
							UpperCamelCase__  :Optional[Any]				   =					initializer_range
							UpperCamelCase__  :Optional[Any]				   =					vocab_size
							UpperCamelCase__  :str				   =					num_clusters
							UpperCamelCase__  :List[Any]				   =					do_stable_layer_norm
							UpperCamelCase__  :int				   =					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
							UpperCamelCase__  :List[str]				   =					apply_spec_augment
							UpperCamelCase__  :Any				   =					mask_time_prob
							UpperCamelCase__  :Optional[Any]				   =					mask_time_length
							UpperCamelCase__  :Union[str, Any]				   =					mask_time_min_masks
							UpperCamelCase__  :str				   =					mask_feature_prob
							UpperCamelCase__  :Any				   =					mask_feature_length
							UpperCamelCase__  :Optional[Any]				   =					mask_feature_min_masks

							# parameters for pretraining with codevector quantized representations
							UpperCamelCase__  :Tuple				   =					num_codevectors_per_group
							UpperCamelCase__  :Dict				   =					num_codevector_groups
							UpperCamelCase__  :Tuple				   =					contrastive_logits_temperature
							UpperCamelCase__  :Optional[int]				   =					feat_quantizer_dropout
							UpperCamelCase__  :Any				   =					num_negatives
							UpperCamelCase__  :Tuple				   =					codevector_dim
							UpperCamelCase__  :int				   =					proj_codevector_dim
							UpperCamelCase__  :Optional[int]				   =					diversity_loss_weight

							# ctc loss
							UpperCamelCase__  :Tuple				   =					ctc_loss_reduction
							UpperCamelCase__  :str				   =					ctc_zero_infinity

							# SequenceClassification-specific parameter. Feel free to ignore for other classes.
							UpperCamelCase__  :Optional[Any]				   =					classifier_proj_size

							# XVector-specific parameters. Feel free to ignore for other classes.
							UpperCamelCase__  :Optional[int]				   =					list(UpperCamelCase_				)
							UpperCamelCase__  :List[Any]				   =					list(UpperCamelCase_				)
							UpperCamelCase__  :Union[str, Any]				   =					list(UpperCamelCase_				)
							UpperCamelCase__  :Optional[int]				   =					xvector_output_dim




		@property
		def        lowerCAmelCase__							(						self				):

							'''simple docstring'''


							return functools.reduce(operator.mul       ,  self.conv_stride       ,  1				)



'''simple docstring'''
import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class   lowercase      (				A__   ):

		"""simple docstring"""

		_a       					=							['image_processor', 'tokenizer']
		_a       					=							'ChineseCLIPImageProcessor'
		_a       					=							('BertTokenizer', 'BertTokenizerFast')




		def __init__(						self       ,  UpperCamelCase_=None       ,  UpperCamelCase_=None       ,  **UpperCamelCase_				):

							'''simple docstring'''


							UpperCamelCase__  :List[Any]				   =					None
							if "feature_extractor" in kwargs:
												warnings.warn(
												    '''The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'''
												    ''' instead.'''       ,  UpperCamelCase_       ,  )
												UpperCamelCase__  :List[Any]				   =					kwargs.pop('''feature_extractor'''				)

							UpperCamelCase__  :List[str]				   =					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__(UpperCamelCase_       ,  UpperCamelCase_				)
							UpperCamelCase__  :Any				   =					self.image_processor




		def __call__(						self       ,  UpperCamelCase_=None       ,  UpperCamelCase_=None       ,  UpperCamelCase_=None       ,  **UpperCamelCase_				):

							'''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:
												UpperCamelCase__  :Tuple				   =					self.tokenizer(UpperCamelCase_       ,  return_tensors=UpperCamelCase_       ,  **UpperCamelCase_				)

							if images is not None:
												UpperCamelCase__  :Any				   =					self.image_processor(UpperCamelCase_       ,  return_tensors=UpperCamelCase_       ,  **UpperCamelCase_				)

							if text is not None and images is not None:
												UpperCamelCase__  :Optional[int]				   =					image_features.pixel_values
												return encoding
							elif text is not None:
												return encoding
							else:
												return BatchEncoding(data=dict(**UpperCamelCase_				)       ,  tensor_type=UpperCamelCase_				)




		def        lowerCAmelCase__							(						self       ,  *UpperCamelCase_       ,  **UpperCamelCase_				):

							'''simple docstring'''


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




		def        lowerCAmelCase__							(						self       ,  *UpperCamelCase_       ,  **UpperCamelCase_				):

							'''simple docstring'''


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




		@property
		def        lowerCAmelCase__							(						self				):

							'''simple docstring'''


							UpperCamelCase__  :int				   =					self.tokenizer.model_input_names
							UpperCamelCase__  :Any				   =					self.image_processor.model_input_names
							return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names				)				)




		@property
		def        lowerCAmelCase__							(						self				):

							'''simple docstring'''


							warnings.warn(
							    '''`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'''       ,  UpperCamelCase_       ,  )
							return self.image_processor_class