

import functools
import operator

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


__A			:					List[str]						=			logging.get_logger(__name__)

__A			:					List[Any]						=			{
    '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 			_SCREAMING_SNAKE_CASE (   __snake_case		):







   '''simple docstring'''




   lowerCamelCase__				=      "sew-d"





   def __init__(       self					:			Any     , __lowerCamelCase					:			Union[str, Any]=32     , __lowerCamelCase					:			List[str]=768     , __lowerCamelCase					:			List[Any]=12     , __lowerCamelCase					:			Union[str, Any]=12     , __lowerCamelCase					:			List[Any]=3072     , __lowerCamelCase					:			Any=2     , __lowerCamelCase					:			Optional[Any]=512     , __lowerCamelCase					:			Optional[int]=256     , __lowerCamelCase					:			Any=True     , __lowerCamelCase					:			List[str]=True     , __lowerCamelCase					:			Optional[int]=("p2c", "c2p")     , __lowerCamelCase					:			Optional[int]="layer_norm"     , __lowerCamelCase					:			Dict="gelu_python"     , __lowerCamelCase					:			Optional[int]=0.1     , __lowerCamelCase					:			Dict=0.1     , __lowerCamelCase					:			Tuple=0.1     , __lowerCamelCase					:			str=0.0     , __lowerCamelCase					:			str=0.1     , __lowerCamelCase					:			List[Any]=0.02     , __lowerCamelCase					:			Tuple=1e-7     , __lowerCamelCase					:			str=1e-5     , __lowerCamelCase					:			Optional[Any]="group"     , __lowerCamelCase					:			Optional[int]="gelu"     , __lowerCamelCase					:			List[str]=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)     , __lowerCamelCase					:			Dict=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)     , __lowerCamelCase					:			List[Any]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)     , __lowerCamelCase					:			List[str]=False     , __lowerCamelCase					:			str=128     , __lowerCamelCase					:			Optional[Any]=16     , __lowerCamelCase					:			List[str]=True     , __lowerCamelCase					:			List[str]=0.05     , __lowerCamelCase					:			List[Any]=10     , __lowerCamelCase					:			List[str]=2     , __lowerCamelCase					:			Union[str, Any]=0.0     , __lowerCamelCase					:			Union[str, Any]=10     , __lowerCamelCase					:			Dict=0     , __lowerCamelCase					:			Optional[int]="mean"     , __lowerCamelCase					:			Dict=False     , __lowerCamelCase					:			Any=False     , __lowerCamelCase					:			Optional[Any]=256     , __lowerCamelCase					:			Union[str, Any]=0     , __lowerCamelCase					:			Dict=1     , __lowerCamelCase					:			Optional[Any]=2     , **__lowerCamelCase					:			Tuple     , ):
       super().__init__(**__lowerCamelCase     , pad_token_id=__lowerCamelCase     , bos_token_id=__lowerCamelCase     , eos_token_id=__lowerCamelCase			)
       SCREAMING_SNAKE_CASE										=   hidden_size
       SCREAMING_SNAKE_CASE										=   feat_extract_norm
       SCREAMING_SNAKE_CASE										=   feat_extract_activation
       SCREAMING_SNAKE_CASE										=   list(__lowerCamelCase			)
       SCREAMING_SNAKE_CASE										=   list(__lowerCamelCase			)
       SCREAMING_SNAKE_CASE										=   list(__lowerCamelCase			)
       SCREAMING_SNAKE_CASE										=   conv_bias
       SCREAMING_SNAKE_CASE										=   num_conv_pos_embeddings
       SCREAMING_SNAKE_CASE										=   num_conv_pos_embedding_groups
       SCREAMING_SNAKE_CASE										=   len(self.conv_dim			)
       SCREAMING_SNAKE_CASE										=   num_hidden_layers
       SCREAMING_SNAKE_CASE										=   intermediate_size
       SCREAMING_SNAKE_CASE										=   squeeze_factor
       SCREAMING_SNAKE_CASE										=   max_position_embeddings
       SCREAMING_SNAKE_CASE										=   position_buckets
       SCREAMING_SNAKE_CASE										=   share_att_key
       SCREAMING_SNAKE_CASE										=   relative_attention
       SCREAMING_SNAKE_CASE										=   norm_rel_ebd
       SCREAMING_SNAKE_CASE										=   list(__lowerCamelCase			)
       SCREAMING_SNAKE_CASE										=   hidden_act
       SCREAMING_SNAKE_CASE										=   num_attention_heads
       SCREAMING_SNAKE_CASE										=   hidden_dropout
       SCREAMING_SNAKE_CASE										=   attention_dropout
       SCREAMING_SNAKE_CASE										=   activation_dropout
       SCREAMING_SNAKE_CASE										=   feat_proj_dropout
       SCREAMING_SNAKE_CASE										=   final_dropout
       SCREAMING_SNAKE_CASE										=   layer_norm_eps
       SCREAMING_SNAKE_CASE										=   feature_layer_norm_eps
       SCREAMING_SNAKE_CASE										=   initializer_range
       SCREAMING_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
       SCREAMING_SNAKE_CASE										=   apply_spec_augment
       SCREAMING_SNAKE_CASE										=   mask_time_prob
       SCREAMING_SNAKE_CASE										=   mask_time_length
       SCREAMING_SNAKE_CASE										=   mask_time_min_masks
       SCREAMING_SNAKE_CASE										=   mask_feature_prob
       SCREAMING_SNAKE_CASE										=   mask_feature_length
       SCREAMING_SNAKE_CASE										=   mask_feature_min_masks

       # ctc loss
       SCREAMING_SNAKE_CASE										=   ctc_loss_reduction
       SCREAMING_SNAKE_CASE										=   ctc_zero_infinity

       # sequence classification
       SCREAMING_SNAKE_CASE										=   use_weighted_layer_sum
       SCREAMING_SNAKE_CASE										=   classifier_proj_size





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


import logging
from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional, Union

from .generation.configuration_utils import GenerationConfig
from .training_args import TrainingArguments
from .utils import add_start_docstrings


__A			:					Optional[Any]						=			logging.getLogger(__name__)





@dataclass
@add_start_docstrings(TrainingArguments.__doc__		)
class 			_SCREAMING_SNAKE_CASE (   __snake_case		):







   '''simple docstring'''




   lowerCamelCase__				=      field(default=__snake_case					,       metadata={"help": "Whether to use SortishSampler or not."}		)
   lowerCamelCase__				=      field(
       default=__snake_case					,       metadata={"help": "Whether to use generate to calculate generative metrics (ROUGE, BLEU)."}		)
   lowerCamelCase__				=      field(
       default=__snake_case					,       metadata={
           "help": (
               "The `max_length` to use on each evaluation loop when `predict_with_generate=True`. Will default "
               "to the `max_length` value of the model configuration."
           )
       }					,       )
   lowerCamelCase__				=      field(
       default=__snake_case					,       metadata={
           "help": (
               "The `num_beams` to use on each evaluation loop when `predict_with_generate=True`. Will default "
               "to the `num_beams` value of the model configuration."
           )
       }					,       )
   lowerCamelCase__				=      field(
       default=__snake_case					,       metadata={
           "help": "Model id, file path or url pointing to a GenerationConfig json file, to use during prediction."
       }					,       )





   def      _snake_case		(       self					:			Union[str, Any]			):
       SCREAMING_SNAKE_CASE										=   super().to_dict()
       for k, v in d.items():
           if isinstance(__lowerCamelCase     , __lowerCamelCase			):
               SCREAMING_SNAKE_CASE										=   v.to_dict()
       return d