





'''simple docstring'''






import os
import string
import sys


A__				:   str      =1 << 8

A__				:   Optional[int]      ={
    '''tab''': ord('''\t'''),
    '''newline''': ord('''\r'''),
    '''esc''': 27,
    '''up''': 65 + ARROW_KEY_FLAG,
    '''down''': 66 + ARROW_KEY_FLAG,
    '''right''': 67 + ARROW_KEY_FLAG,
    '''left''': 68 + ARROW_KEY_FLAG,
    '''mod_int''': 91,
    '''undefined''': sys.maxsize,
    '''interrupt''': 3,
    '''insert''': 50,
    '''delete''': 51,
    '''pg_up''': 53,
    '''pg_down''': 54,
}

A__				:   Optional[int]      =KEYMAP['''up''']
A__				:   Tuple      =KEYMAP['''left''']

if sys.platform == "win32":
      A__				:   int      =[]
      A__				:   int      ={
          b'''\xe0H''': KEYMAP['''up'''] - ARROW_KEY_FLAG,
          b'''\x00H''': KEYMAP['''up'''] - ARROW_KEY_FLAG,
          b'''\xe0P''': KEYMAP['''down'''] - ARROW_KEY_FLAG,
          b'''\x00P''': KEYMAP['''down'''] - ARROW_KEY_FLAG,
          b'''\xe0M''': KEYMAP['''right'''] - ARROW_KEY_FLAG,
          b'''\x00M''': KEYMAP['''right'''] - ARROW_KEY_FLAG,
          b'''\xe0K''': KEYMAP['''left'''] - ARROW_KEY_FLAG,
          b'''\x00K''': KEYMAP['''left'''] - ARROW_KEY_FLAG,
      }

for i in range(10):
      A__				:   List[Any]      =ord(str(i))
def    UpperCamelCase__      (		):





      """simple docstring"""


      if os.name == "nt":
            import msvcrt

            _lowerCAmelCase							     =							"""mbcs"""
            # Flush the keyboard buffer
            while msvcrt.kbhit():
                  msvcrt.getch()
            if len(lowerCAmelCase  ) == 0:
                  # Read the keystroke
                  _lowerCAmelCase							     =							msvcrt.getch()

                  # If it is a prefix char, get second part
                  if ch in (b"\x00", b"\xe0"):
                        _lowerCAmelCase							     =							ch + msvcrt.getch()
                        # Translate actual Win chars to bullet char types
                        try:
                              _lowerCAmelCase							     =							chr(WIN_KEYMAP[cha]  )
                              WIN_CH_BUFFER.append(chr(KEYMAP["""mod_int"""]  )  )
                              WIN_CH_BUFFER.append(lowerCAmelCase  )
                              if ord(lowerCAmelCase  ) in (
                                  KEYMAP["insert"] - 1 << 9,
                                  KEYMAP["delete"] - 1 << 9,
                                  KEYMAP["pg_up"] - 1 << 9,
                                  KEYMAP["pg_down"] - 1 << 9,
                              ):
                                    WIN_CH_BUFFER.append(chr(1_26  )  )
                              _lowerCAmelCase							     =							chr(KEYMAP["""esc"""]  )
                        except KeyError:
                              _lowerCAmelCase							     =							cha[1]
                  else:
                        _lowerCAmelCase							     =							ch.decode(lowerCAmelCase  )
            else:
                  _lowerCAmelCase							     =							WIN_CH_BUFFER.pop(0  )
      elif os.name == "posix":
            import termios
            import tty

            _lowerCAmelCase							     =							sys.stdin.fileno()
            _lowerCAmelCase							     =							termios.tcgetattr(lowerCAmelCase  )
            try:
                  tty.setraw(lowerCAmelCase  )
                  _lowerCAmelCase							     =							sys.stdin.read(1  )
            finally:
                  termios.tcsetattr(lowerCAmelCase							,	termios.TCSADRAIN							,	lowerCAmelCase  )
      return ch





def    UpperCamelCase__      (		):





      """simple docstring"""


      _lowerCAmelCase							     =							get_raw_chars()
      if ord(lowerCAmelCase  ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
            return char

      elif ord(lowerCAmelCase  ) == KEYMAP["esc"]:
            _lowerCAmelCase							     =							get_raw_chars()
            if ord(lowerCAmelCase  ) == KEYMAP["mod_int"]:
                  _lowerCAmelCase							     =							get_raw_chars()
                  if ord(lowerCAmelCase  ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(lowerCAmelCase  ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
                        return chr(ord(lowerCAmelCase  ) + ARROW_KEY_FLAG  )
                  else:
                        return KEYMAP["undefined"]
            else:
                  return get_raw_chars()

      else:
            if char in string.printable:
                  return char
            else:
                  return KEYMAP["undefined"]












"""simple docstring"""




import functools
import operator

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


lowerCAmelCase							:			int     							=							logging.get_logger(__name__)

lowerCAmelCase							:			List[str]     							=							{
    """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     __magic_name__							(       UpperCAmelCase__				):






				'''simple docstring'''
				__UpperCamelCase			  =						"sew-d"





				def __init__(       self		, _a=32		, _a=768		, _a=12		, _a=12		, _a=3_072		, _a=2		, _a=512		, _a=256		, _a=True		, _a=True		, _a=("p2c", "c2p")		, _a="layer_norm"		, _a="gelu_python"		, _a=0.1		, _a=0.1		, _a=0.1		, _a=0.0		, _a=0.1		, _a=0.02		, _a=1e-7		, _a=1e-5		, _a="group"		, _a="gelu"		, _a=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)		, _a=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)		, _a=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)		, _a=False		, _a=128		, _a=16		, _a=True		, _a=0.05		, _a=10		, _a=2		, _a=0.0		, _a=10		, _a=0		, _a="mean"		, _a=False		, _a=False		, _a=256		, _a=0		, _a=1		, _a=2		, **_a		, ):





							"""simple docstring"""
							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			      =					squeeze_factor
							lowerCamelCase			      =					max_position_embeddings
							lowerCamelCase			      =					position_buckets
							lowerCamelCase			      =					share_att_key
							lowerCamelCase			      =					relative_attention
							lowerCamelCase			      =					norm_rel_ebd
							lowerCamelCase			      =					list(_a )
							lowerCamelCase			      =					hidden_act
							lowerCamelCase			      =					num_attention_heads
							lowerCamelCase			      =					hidden_dropout
							lowerCamelCase			      =					attention_dropout
							lowerCamelCase			      =					activation_dropout
							lowerCamelCase			      =					feat_proj_dropout
							lowerCamelCase			      =					final_dropout
							lowerCamelCase			      =					layer_norm_eps
							lowerCamelCase			      =					feature_layer_norm_eps
							lowerCamelCase			      =					initializer_range
							lowerCamelCase			      =					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
							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

							# ctc loss
							lowerCamelCase			      =					ctc_loss_reduction
							lowerCamelCase			      =					ctc_zero_infinity

							# sequence classification
							lowerCamelCase			      =					use_weighted_layer_sum
							lowerCamelCase			      =					classifier_proj_size





				@property
				def    _lowerCAmelCase				(       self ):





							"""simple docstring"""
							return functools.reduce(operator.mul		, self.conv_stride		, 1 )



