
'''simple docstring'''



import functools
import operator

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


UpperCamelCase__      :		Tuple       							=  logging.get_logger(__name__)

UpperCamelCase__      :		str       							=  {
    "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    _a				(_lowerCamelCase):





       """simple docstring"""




       SCREAMING_SNAKE_CASE      =  'unispeech-sat'






       def __init__(							self       ,							A__=32       ,							A__=7_68       ,							A__=12       ,							A__=12       ,							A__=30_72       ,							A__="gelu"       ,							A__=0.1       ,							A__=0.1       ,							A__=0.1       ,							A__=0.0       ,							A__=0.0       ,							A__=0.1       ,							A__=0.1       ,							A__=0.02       ,							A__=1E-5       ,							A__="group"       ,							A__="gelu"       ,							A__=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)       ,							A__=(5, 2, 2, 2, 2, 2, 2)       ,							A__=(10, 3, 3, 3, 3, 2, 2)       ,							A__=False       ,							A__=1_28       ,							A__=16       ,							A__=False       ,							A__=True       ,							A__=0.05       ,							A__=10       ,							A__=2       ,							A__=0.0       ,							A__=10       ,							A__=0       ,							A__=3_20       ,							A__=2       ,							A__=0.1       ,							A__=1_00       ,							A__=2_56       ,							A__=2_56       ,							A__=0.1       ,							A__="mean"       ,							A__=False       ,							A__=False       ,							A__=2_56       ,							A__=(5_12, 5_12, 5_12, 5_12, 15_00)       ,							A__=(5, 3, 3, 1, 1)       ,							A__=(1, 2, 3, 1, 1)       ,							A__=5_12       ,							A__=0       ,							A__=1       ,							A__=2       ,							A__=5_04       ,							**A__       ,							)    ->			List[str]:
          super().__init__(**A__       ,							pad_token_id=A__       ,							bos_token_id=A__       ,							eos_token_id=A__      )
          _SCREAMING_SNAKE_CASE      =				hidden_size
          _SCREAMING_SNAKE_CASE      =				feat_extract_norm
          _SCREAMING_SNAKE_CASE      =				feat_extract_activation
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				conv_bias
          _SCREAMING_SNAKE_CASE      =				num_conv_pos_embeddings
          _SCREAMING_SNAKE_CASE      =				num_conv_pos_embedding_groups
          _SCREAMING_SNAKE_CASE      =				len(self.conv_dim      )
          _SCREAMING_SNAKE_CASE      =				num_hidden_layers
          _SCREAMING_SNAKE_CASE      =				intermediate_size
          _SCREAMING_SNAKE_CASE      =				hidden_act
          _SCREAMING_SNAKE_CASE      =				num_attention_heads
          _SCREAMING_SNAKE_CASE      =				hidden_dropout
          _SCREAMING_SNAKE_CASE      =				attention_dropout
          _SCREAMING_SNAKE_CASE      =				activation_dropout
          _SCREAMING_SNAKE_CASE      =				feat_proj_dropout
          _SCREAMING_SNAKE_CASE      =				final_dropout
          _SCREAMING_SNAKE_CASE      =				layerdrop
          _SCREAMING_SNAKE_CASE      =				layer_norm_eps
          _SCREAMING_SNAKE_CASE      =				initializer_range
          _SCREAMING_SNAKE_CASE      =				vocab_size
          _SCREAMING_SNAKE_CASE      =				num_clusters
          _SCREAMING_SNAKE_CASE      =				do_stable_layer_norm
          _SCREAMING_SNAKE_CASE      =				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
          _SCREAMING_SNAKE_CASE      =				apply_spec_augment
          _SCREAMING_SNAKE_CASE      =				mask_time_prob
          _SCREAMING_SNAKE_CASE      =				mask_time_length
          _SCREAMING_SNAKE_CASE      =				mask_time_min_masks
          _SCREAMING_SNAKE_CASE      =				mask_feature_prob
          _SCREAMING_SNAKE_CASE      =				mask_feature_length
          _SCREAMING_SNAKE_CASE      =				mask_feature_min_masks

          # parameters for pretraining with codevector quantized representations
          _SCREAMING_SNAKE_CASE      =				num_codevectors_per_group
          _SCREAMING_SNAKE_CASE      =				num_codevector_groups
          _SCREAMING_SNAKE_CASE      =				contrastive_logits_temperature
          _SCREAMING_SNAKE_CASE      =				feat_quantizer_dropout
          _SCREAMING_SNAKE_CASE      =				num_negatives
          _SCREAMING_SNAKE_CASE      =				codevector_dim
          _SCREAMING_SNAKE_CASE      =				proj_codevector_dim
          _SCREAMING_SNAKE_CASE      =				diversity_loss_weight

          # ctc loss
          _SCREAMING_SNAKE_CASE      =				ctc_loss_reduction
          _SCREAMING_SNAKE_CASE      =				ctc_zero_infinity

          # SequenceClassification-specific parameter. Feel free to ignore for other classes.
          _SCREAMING_SNAKE_CASE      =				classifier_proj_size

          # XVector-specific parameters. Feel free to ignore for other classes.
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				xvector_output_dim






       @property
       def        UpperCamelCase				(							self      )    ->			Dict:
          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    _a				(_lowerCamelCase):





       """simple docstring"""




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






       def __init__(							self       ,							A__=None       ,							A__=None       ,							**A__      )    ->			int:
          _SCREAMING_SNAKE_CASE      =				None
          if "feature_extractor" in kwargs:
             warnings.warn(
                 """The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"""
                 """ instead."""       ,							A__       ,							)
             _SCREAMING_SNAKE_CASE      =				kwargs.pop("""feature_extractor"""      )

          _SCREAMING_SNAKE_CASE      =				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__(A__       ,							A__      )
          _SCREAMING_SNAKE_CASE      =				self.image_processor






       def __call__(							self       ,							A__=None       ,							A__=None       ,							A__=None       ,							**A__      )    ->			Optional[int]:

          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:
             _SCREAMING_SNAKE_CASE      =				self.tokenizer(A__       ,							return_tensors=A__       ,							**A__      )

          if images is not None:
             _SCREAMING_SNAKE_CASE      =				self.image_processor(A__       ,							return_tensors=A__       ,							**A__      )

          if text is not None and images is not None:
             _SCREAMING_SNAKE_CASE      =				image_features.pixel_values
             return encoding
          elif text is not None:
             return encoding
          else:
             return BatchEncoding(data=dict(**A__      )       ,							tensor_type=A__      )






       def        UpperCamelCase				(							self       ,							*A__       ,							**A__      )    ->			Dict:
          return self.tokenizer.batch_decode(*A__       ,							**A__      )






       def        UpperCamelCase				(							self       ,							*A__       ,							**A__      )    ->			Optional[Any]:
          return self.tokenizer.decode(*A__       ,							**A__      )






       @property
       def        UpperCamelCase				(							self      )    ->			List[Any]:
          _SCREAMING_SNAKE_CASE      =				self.tokenizer.model_input_names
          _SCREAMING_SNAKE_CASE      =				self.image_processor.model_input_names
          return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names      )      )






       @property
       def        UpperCamelCase				(							self      )    ->			Optional[int]:
          warnings.warn(
              """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""       ,							A__       ,							)
          return self.image_processor_class






