






import functools
import operator

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


lowerCamelCase      :       Union[str, Any]    =						logging.get_logger(__name__)

lowerCamelCase      :       Tuple    =						{
    '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 				_UpperCamelCase      (a__      ):
      snake_case_	=				"""unispeech-sat"""


      def __init__(						self       ,    __UpperCamelCase=3_2       ,    __UpperCamelCase=7_6_8       ,    __UpperCamelCase=1_2       ,    __UpperCamelCase=1_2       ,    __UpperCamelCase=3_0_7_2       ,    __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.0_2       ,    __UpperCamelCase=1e-5       ,    __UpperCamelCase="group"       ,    __UpperCamelCase="gelu"       ,    __UpperCamelCase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)       ,    __UpperCamelCase=(5, 2, 2, 2, 2, 2, 2)       ,    __UpperCamelCase=(1_0, 3, 3, 3, 3, 2, 2)       ,    __UpperCamelCase=False       ,    __UpperCamelCase=1_2_8       ,    __UpperCamelCase=1_6       ,    __UpperCamelCase=False       ,    __UpperCamelCase=True       ,    __UpperCamelCase=0.0_5       ,    __UpperCamelCase=1_0       ,    __UpperCamelCase=2       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=1_0       ,    __UpperCamelCase=0       ,    __UpperCamelCase=3_2_0       ,    __UpperCamelCase=2       ,    __UpperCamelCase=0.1       ,    __UpperCamelCase=1_0_0       ,    __UpperCamelCase=2_5_6       ,    __UpperCamelCase=2_5_6       ,    __UpperCamelCase=0.1       ,    __UpperCamelCase="mean"       ,    __UpperCamelCase=False       ,    __UpperCamelCase=False       ,    __UpperCamelCase=2_5_6       ,    __UpperCamelCase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)       ,    __UpperCamelCase=(5, 3, 3, 1, 1)       ,    __UpperCamelCase=(1, 2, 3, 1, 1)       ,    __UpperCamelCase=5_1_2       ,    __UpperCamelCase=0       ,    __UpperCamelCase=1       ,    __UpperCamelCase=2       ,    __UpperCamelCase=5_0_4       ,    **__UpperCamelCase       ,    )->						Dict:
           super().__init__(**__a       ,    pad_token_id=__a       ,    bos_token_id=__a       ,    eos_token_id=__a						)
           __lowerCAmelCase             =       hidden_size
           __lowerCAmelCase             =       feat_extract_norm
           __lowerCAmelCase             =       feat_extract_activation
           __lowerCAmelCase             =       list(__a						)
           __lowerCAmelCase             =       list(__a						)
           __lowerCAmelCase             =       list(__a						)
           __lowerCAmelCase             =       conv_bias
           __lowerCAmelCase             =       num_conv_pos_embeddings
           __lowerCAmelCase             =       num_conv_pos_embedding_groups
           __lowerCAmelCase             =       len(self.conv_dim						)
           __lowerCAmelCase             =       num_hidden_layers
           __lowerCAmelCase             =       intermediate_size
           __lowerCAmelCase             =       hidden_act
           __lowerCAmelCase             =       num_attention_heads
           __lowerCAmelCase             =       hidden_dropout
           __lowerCAmelCase             =       attention_dropout
           __lowerCAmelCase             =       activation_dropout
           __lowerCAmelCase             =       feat_proj_dropout
           __lowerCAmelCase             =       final_dropout
           __lowerCAmelCase             =       layerdrop
           __lowerCAmelCase             =       layer_norm_eps
           __lowerCAmelCase             =       initializer_range
           __lowerCAmelCase             =       vocab_size
           __lowerCAmelCase             =       num_clusters
           __lowerCAmelCase             =       do_stable_layer_norm
           __lowerCAmelCase             =       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
           __lowerCAmelCase             =       apply_spec_augment
           __lowerCAmelCase             =       mask_time_prob
           __lowerCAmelCase             =       mask_time_length
           __lowerCAmelCase             =       mask_time_min_masks
           __lowerCAmelCase             =       mask_feature_prob
           __lowerCAmelCase             =       mask_feature_length
           __lowerCAmelCase             =       mask_feature_min_masks

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

           # ctc loss
           __lowerCAmelCase             =       ctc_loss_reduction
           __lowerCAmelCase             =       ctc_zero_infinity

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

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


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










class   SCREAMING_SNAKE_CASE_			:




       '''simple docstring'''



       def __init__(						self				:				Tuple		,				__a				:				int							)					->Optional[int]:
          lowerCamelCase_						:   Optional[Any]		= n
          lowerCamelCase_						:   Dict		= [None] * self.n
          lowerCamelCase_						:   int		= 0  # index of the first element
          lowerCamelCase_						:   str		= 0
          lowerCamelCase_						:   Optional[Any]		= 0



       def __len__(						self				:				List[str]							)					->int:
          return self.size



       def 				_lowerCAmelCase							(						self				:				str							)					->bool:
          return self.size == 0



       def 				_lowerCAmelCase							(						self				:				str							)					->Any:
          return False if self.is_empty() else self.array[self.front]



       def 				_lowerCAmelCase							(						self				:				Union[str, Any]		,				__a				:				int							)					->List[Any]:
          if self.size >= self.n:
             raise Exception("""QUEUE IS FULL"""							)

          lowerCamelCase_						:   Tuple		= data
          lowerCamelCase_						:   Tuple		= (self.rear + 1) % self.n
          self.size += 1
          return self




       def 				_lowerCAmelCase							(						self				:				Tuple							)					->int:
          if self.size == 0:
             raise Exception("""UNDERFLOW"""							)

          lowerCamelCase_						:   str		= self.array[self.front]
          lowerCamelCase_						:   str		= None
          lowerCamelCase_						:   Optional[Any]		= (self.front + 1) % self.n
          self.size -= 1
          return temp





