


import functools
import operator

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


_SCREAMING_SNAKE_CASE      :			Tuple      				=   logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE      :			int      				=   {
    "asapp/sew-d-tiny-100k": "https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json",
    # See all SEW-D models at https://huggingface.co/models?filter=sew-d
}

class   A__ (   snake_case__     ):







    """simple docstring"""

    __magic_name__        =		'sew-d'
    def __init__(	self      , __snake_case=3_2      , __snake_case=7_6_8      , __snake_case=1_2      , __snake_case=1_2      , __snake_case=3_0_7_2      , __snake_case=2      , __snake_case=5_1_2      , __snake_case=2_5_6      , __snake_case=True      , __snake_case=True      , __snake_case=("p2c", "c2p")      , __snake_case="layer_norm"      , __snake_case="gelu_python"      , __snake_case=0.1      , __snake_case=0.1      , __snake_case=0.1      , __snake_case=0.0      , __snake_case=0.1      , __snake_case=0.02      , __snake_case=1E-7      , __snake_case=1E-5      , __snake_case="group"      , __snake_case="gelu"      , __snake_case=(6_4, 1_2_8, 1_2_8, 1_2_8, 1_2_8, 2_5_6, 2_5_6, 2_5_6, 2_5_6, 5_1_2, 5_1_2, 5_1_2, 5_1_2)      , __snake_case=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)      , __snake_case=(1_0, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)      , __snake_case=False      , __snake_case=1_2_8      , __snake_case=1_6      , __snake_case=True      , __snake_case=0.05      , __snake_case=1_0      , __snake_case=2      , __snake_case=0.0      , __snake_case=1_0      , __snake_case=0      , __snake_case="mean"      , __snake_case=False      , __snake_case=False      , __snake_case=2_5_6      , __snake_case=0      , __snake_case=1      , __snake_case=2      , **__snake_case      , ):
         super().__init__(**__snake_case      , pad_token_id=__snake_case      , bos_token_id=__snake_case      , eos_token_id=__snake_case   )
         snake_case					=    hidden_size
         snake_case					=    feat_extract_norm
         snake_case					=    feat_extract_activation
         snake_case					=    list(__snake_case   )
         snake_case					=    list(__snake_case   )
         snake_case					=    list(__snake_case   )
         snake_case					=    conv_bias
         snake_case					=    num_conv_pos_embeddings
         snake_case					=    num_conv_pos_embedding_groups
         snake_case					=    len(self.conv_dim   )
         snake_case					=    num_hidden_layers
         snake_case					=    intermediate_size
         snake_case					=    squeeze_factor
         snake_case					=    max_position_embeddings
         snake_case					=    position_buckets
         snake_case					=    share_att_key
         snake_case					=    relative_attention
         snake_case					=    norm_rel_ebd
         snake_case					=    list(__snake_case   )
         snake_case					=    hidden_act
         snake_case					=    num_attention_heads
         snake_case					=    hidden_dropout
         snake_case					=    attention_dropout
         snake_case					=    activation_dropout
         snake_case					=    feat_proj_dropout
         snake_case					=    final_dropout
         snake_case					=    layer_norm_eps
         snake_case					=    feature_layer_norm_eps
         snake_case					=    initializer_range
         snake_case					=    vocab_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)`,'''
                  F'''but is `len(config.conv_dim) = {len(self.conv_dim   )}`, `len(config.conv_stride)'''
                  F'''= {len(self.conv_stride   )}`, `len(config.conv_kernel) = {len(self.conv_kernel   )}`.'''   )

         # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
         snake_case					=    apply_spec_augment
         snake_case					=    mask_time_prob
         snake_case					=    mask_time_length
         snake_case					=    mask_time_min_masks
         snake_case					=    mask_feature_prob
         snake_case					=    mask_feature_length
         snake_case					=    mask_feature_min_masks

         # ctc loss
         snake_case					=    ctc_loss_reduction
         snake_case					=    ctc_zero_infinity

         # sequence classification
         snake_case					=    use_weighted_layer_sum
         snake_case					=    classifier_proj_size




    @property
    def 		a_      (	self   ):
         return functools.reduce(operator.mul      , self.conv_stride      , 1   )








# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
_SCREAMING_SNAKE_CASE      :			Union[str, Any]      				=   abspath(join(dirname(dirname(dirname(__file__))), "src"))
sys.path.insert(1, git_repo_path)


# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action="ignore", category=FutureWarning)
def       UpperCAmelCase__						(UpperCamelCase_    ):



     """simple docstring"""






     from transformers.testing_utils import pytest_addoption_shared

     pytest_addoption_shared(UpperCamelCase_    )

def       UpperCAmelCase__						(UpperCamelCase_    ):



     """simple docstring"""






     from transformers.testing_utils import pytest_terminal_summary_main

     snake_case					=    terminalreporter.config.getoption('''--make-reports'''    )
     if make_reports:
          pytest_terminal_summary_main(UpperCamelCase_							,id=UpperCamelCase_    )




