






import functools
import operator

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


a__      :				Optional[Any]   	=			logging.get_logger(__name__)

a__      :				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       UpperCAmelCase__(							_lowercase	):

   '''simple docstring'''




   A    :  Union[str, Any]       				=    '''sew-d'''


   def __init__(						self  :			List[str]			,				lowerCAmelCase  :			Dict=32			,				lowerCAmelCase  :			Optional[int]=7_68			,				lowerCAmelCase  :			Optional[Any]=12			,				lowerCAmelCase  :			Optional[int]=12			,				lowerCAmelCase  :			Tuple=30_72			,				lowerCAmelCase  :			Any=2			,				lowerCAmelCase  :			List[Any]=5_12			,				lowerCAmelCase  :			Tuple=2_56			,				lowerCAmelCase  :			Optional[int]=True			,				lowerCAmelCase  :			List[str]=True			,				lowerCAmelCase  :			List[Any]=("p2c", "c2p")			,				lowerCAmelCase  :			Dict="layer_norm"			,				lowerCAmelCase  :			List[str]="gelu_python"			,				lowerCAmelCase  :			int=0.1			,				lowerCAmelCase  :			Tuple=0.1			,				lowerCAmelCase  :			Dict=0.1			,				lowerCAmelCase  :			List[str]=0.0			,				lowerCAmelCase  :			List[str]=0.1			,				lowerCAmelCase  :			Optional[Any]=0.02			,				lowerCAmelCase  :			Optional[int]=1E-7			,				lowerCAmelCase  :			Optional[Any]=1E-5			,				lowerCAmelCase  :			Optional[int]="group"			,				lowerCAmelCase  :			Union[str, Any]="gelu"			,				lowerCAmelCase  :			Tuple=(64, 1_28, 1_28, 1_28, 1_28, 2_56, 2_56, 2_56, 2_56, 5_12, 5_12, 5_12, 5_12)			,				lowerCAmelCase  :			Dict=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)			,				lowerCAmelCase  :			int=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)			,				lowerCAmelCase  :			Union[str, Any]=False			,				lowerCAmelCase  :			str=1_28			,				lowerCAmelCase  :			Tuple=16			,				lowerCAmelCase  :			List[Any]=True			,				lowerCAmelCase  :			Tuple=0.05			,				lowerCAmelCase  :			List[Any]=10			,				lowerCAmelCase  :			List[str]=2			,				lowerCAmelCase  :			str=0.0			,				lowerCAmelCase  :			Union[str, Any]=10			,				lowerCAmelCase  :			Tuple=0			,				lowerCAmelCase  :			Tuple="mean"			,				lowerCAmelCase  :			Union[str, Any]=False			,				lowerCAmelCase  :			Dict=False			,				lowerCAmelCase  :			str=2_56			,				lowerCAmelCase  :			int=0			,				lowerCAmelCase  :			Dict=1			,				lowerCAmelCase  :			List[str]=2			,				**lowerCAmelCase  :			Tuple			,				)	->				Any:




         """simple docstring"""

         super().__init__(**A_			,				pad_token_id=A_			,				bos_token_id=A_			,				eos_token_id=A_)
         lowercase__     =  hidden_size
         lowercase__     =  feat_extract_norm
         lowercase__     =  feat_extract_activation
         lowercase__     =  list(A_)
         lowercase__     =  list(A_)
         lowercase__     =  list(A_)
         lowercase__     =  conv_bias
         lowercase__     =  num_conv_pos_embeddings
         lowercase__     =  num_conv_pos_embedding_groups
         lowercase__     =  len(self.conv_dim)
         lowercase__     =  num_hidden_layers
         lowercase__     =  intermediate_size
         lowercase__     =  squeeze_factor
         lowercase__     =  max_position_embeddings
         lowercase__     =  position_buckets
         lowercase__     =  share_att_key
         lowercase__     =  relative_attention
         lowercase__     =  norm_rel_ebd
         lowercase__     =  list(A_)
         lowercase__     =  hidden_act
         lowercase__     =  num_attention_heads
         lowercase__     =  hidden_dropout
         lowercase__     =  attention_dropout
         lowercase__     =  activation_dropout
         lowercase__     =  feat_proj_dropout
         lowercase__     =  final_dropout
         lowercase__     =  layer_norm_eps
         lowercase__     =  feature_layer_norm_eps
         lowercase__     =  initializer_range
         lowercase__     =  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
         lowercase__     =  apply_spec_augment
         lowercase__     =  mask_time_prob
         lowercase__     =  mask_time_length
         lowercase__     =  mask_time_min_masks
         lowercase__     =  mask_feature_prob
         lowercase__     =  mask_feature_length
         lowercase__     =  mask_feature_min_masks

         # ctc loss
         lowercase__     =  ctc_loss_reduction
         lowercase__     =  ctc_zero_infinity

         # sequence classification
         lowercase__     =  use_weighted_layer_sum
         lowercase__     =  classifier_proj_size



   @property
   def 			UpperCAmelCase		(						self  :			int)	->				Optional[int]:




         """simple docstring"""

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





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
)


a__      :				Any   	=			{"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "ReformerConfig"]}

try:
       if not is_sentencepiece_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a__      :				Optional[int]   	=			["ReformerTokenizer"]

try:
       if not is_tokenizers_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a__      :				Union[str, Any]   	=			["ReformerTokenizerFast"]

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a__      :				Any   	=			[
           "REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
           "ReformerAttention",
           "ReformerForMaskedLM",
           "ReformerForQuestionAnswering",
           "ReformerForSequenceClassification",
           "ReformerLayer",
           "ReformerModel",
           "ReformerModelWithLMHead",
           "ReformerPreTrainedModel",
       ]


if TYPE_CHECKING:
       from .configuration_reformer import REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, ReformerConfig

       try:
              if not is_sentencepiece_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_reformer import ReformerTokenizer

       try:
              if not is_tokenizers_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_reformer_fast import ReformerTokenizerFast

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_reformer import (
                  REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
                  ReformerAttention,
                  ReformerForMaskedLM,
                  ReformerForQuestionAnswering,
                  ReformerForSequenceClassification,
                  ReformerLayer,
                  ReformerModel,
                  ReformerModelWithLMHead,
                  ReformerPreTrainedModel,
              )

else:
       import sys

       a__      :				Tuple   	=			_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
