






import functools
import operator

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


lowerCamelCase      :       Tuple    =						logging.get_logger(__name__)

lowerCamelCase      :       List[Any]    =						{
    '''microsoft/unispeech-large-1500h-cv''': (
        '''https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json'''
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}



class 				_UpperCamelCase      (a_      ):
      snake_case_	=				"""unispeech"""


      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=8_0       ,    __UpperCamelCase=0       ,    __UpperCamelCase=1       ,    __UpperCamelCase=2       ,    __UpperCamelCase=0.5       ,    **__UpperCamelCase       ,    )->						List[str]:
           super().__init__(**__UpperCamelCase       ,    pad_token_id=__UpperCamelCase       ,    bos_token_id=__UpperCamelCase       ,    eos_token_id=__UpperCamelCase						)
           __lowerCAmelCase             =       hidden_size
           __lowerCAmelCase             =       feat_extract_norm
           __lowerCAmelCase             =       feat_extract_activation
           __lowerCAmelCase             =       list(__UpperCamelCase						)
           __lowerCAmelCase             =       list(__UpperCamelCase						)
           __lowerCAmelCase             =       list(__UpperCamelCase						)
           __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             =       num_ctc_classes
           __lowerCAmelCase             =       vocab_size
           __lowerCAmelCase             =       do_stable_layer_norm
           __lowerCAmelCase             =       use_weighted_layer_sum
           __lowerCAmelCase             =       classifier_proj_size

           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

           # pretraining loss
           __lowerCAmelCase             =       replace_prob


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














from __future__ import annotations





def    __lowerCAmelCase   (    __snake_case							):
     __lowerCAmelCase             =       len(__snake_case							)
     # We need to create solution object to save path.
     __lowerCAmelCase             =       [[0 for _ in range(__snake_case							)] for _ in range(__snake_case							)]
     __lowerCAmelCase             =       run_maze(__snake_case       ,			0       ,			0       ,			__snake_case							)
     if solved:
          print("\n".join(str(__snake_case							) for row in solutions							)							)
     else:
          print("No solution exists!"							)
     return solved





def    __lowerCAmelCase   (    __snake_case       ,			__snake_case       ,			__snake_case       ,			__snake_case							):
     __lowerCAmelCase             =       len(__snake_case							)
     # Final check point.
     if i == j == (size - 1):
          __lowerCAmelCase             =       1
          return True

     __lowerCAmelCase             =       (not i < 0) and (not j < 0)  # Check lower bounds
     __lowerCAmelCase             =       (i < size) and (j < size)  # Check upper bounds

     if lower_flag and upper_flag:
          # check for already visited and block points.
          __lowerCAmelCase             =       (not solutions[i][j]) and (not maze[i][j])
          if block_flag:
               # check visited
               __lowerCAmelCase             =       1

               # check for directions
               if (
                   run_maze(__snake_case       ,			i + 1       ,			__snake_case       ,			__snake_case							)
                   or run_maze(__snake_case       ,			__snake_case       ,			j + 1       ,			__snake_case							)
                   or run_maze(__snake_case       ,			i - 1       ,			__snake_case       ,			__snake_case							)
                   or run_maze(__snake_case       ,			__snake_case       ,			j - 1       ,			__snake_case							)
               ):
                    return True

               __lowerCAmelCase             =       0
               return False
     return False


if __name__ == "__main__":
 import doctest

 doctest.testmod()






