




"""simple docstring"""







import functools
import operator

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


SCREAMING_SNAKE_CASE_	     =       logging.get_logger(__name__)

SCREAMING_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 				snake_case_			(					lowerCamelCase_			):







   """simple docstring"""




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

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

       # ctc loss
       UpperCamelCase              =	ctc_loss_reduction
       UpperCamelCase              =	ctc_zero_infinity

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

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







   @property
   def   UpperCAmelCase__			(		self)				->   Optional[int]:
       return functools.reduce(operator.mul       ,					self.conv_stride       ,					1)







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


_UpperCamelCase			:	Optional[int]								=logging.get_logger(__name__)

_UpperCamelCase			:	Tuple								={
    'google/canine-s': 'https://huggingface.co/google/canine-s/resolve/main/config.json',
    # See all CANINE models at https://huggingface.co/models?filter=canine
}






class 						UpperCAmelCase__ (							__snake_case							):
		__snake_case      :       Any     =   "canine"







		def __init__(					self       ,A__=768       ,A__=12       ,A__=12       ,A__=3072       ,A__="gelu"       ,A__=0.1       ,A__=0.1       ,A__=16384       ,A__=16       ,A__=0.02       ,A__=1E-12       ,A__=0       ,A__=0xE_000       ,A__=0xE_001       ,A__=4       ,A__=4       ,A__=8       ,A__=16384       ,A__=128       ,**A__       ,):
						super().__init__(pad_token_id=A__       ,bos_token_id=A__       ,eos_token_id=A__       ,**A__		)

						_A	:				int   =      max_position_embeddings
						_A	:				Dict   =      hidden_size
						_A	:				List[str]   =      num_hidden_layers
						_A	:				Optional[Any]   =      num_attention_heads
						_A	:				Optional[Any]   =      intermediate_size
						_A	:				Optional[Any]   =      hidden_act
						_A	:				str   =      hidden_dropout_prob
						_A	:				Optional[int]   =      attention_probs_dropout_prob
						_A	:				Union[str, Any]   =      initializer_range
						_A	:				Dict   =      type_vocab_size
						_A	:				Optional[Any]   =      layer_norm_eps

						# Character config:
						_A	:				Union[str, Any]   =      downsampling_rate
						_A	:				List[str]   =      upsampling_kernel_size
						_A	:				str   =      num_hash_functions
						_A	:				Optional[Any]   =      num_hash_buckets
						_A	:				Optional[Any]   =      local_transformer_stride



