





import functools
import operator

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


lowerCAmelCase :					Optional[int] 							=logging.get_logger(__name__)

lowerCAmelCase :					Union[str, 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 				a_       (    __lowerCAmelCase							):
     __A								=      "sew-d"





     def __init__(			self		: Any     ,				lowercase		: List[str]=32     ,				lowercase		: Dict=768     ,				lowercase		: List[str]=12     ,				lowercase		: Tuple=12     ,				lowercase		: Dict=3_072     ,				lowercase		: List[str]=2     ,				lowercase		: Tuple=512     ,				lowercase		: List[Any]=256     ,				lowercase		: Union[str, Any]=True     ,				lowercase		: Optional[Any]=True     ,				lowercase		: Optional[Any]=("p2c", "c2p")     ,				lowercase		: Optional[int]="layer_norm"     ,				lowercase		: Any="gelu_python"     ,				lowercase		: Dict=0.1     ,				lowercase		: Optional[Any]=0.1     ,				lowercase		: Union[str, Any]=0.1     ,				lowercase		: Optional[Any]=0.0     ,				lowercase		: Tuple=0.1     ,				lowercase		: List[str]=0.02     ,				lowercase		: Optional[int]=1e-7     ,				lowercase		: Optional[int]=1e-5     ,				lowercase		: List[Any]="group"     ,				lowercase		: int="gelu"     ,				lowercase		: List[str]=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)     ,				lowercase		: List[str]=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)     ,				lowercase		: List[Any]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)     ,				lowercase		: Optional[Any]=False     ,				lowercase		: int=128     ,				lowercase		: Dict=16     ,				lowercase		: Tuple=True     ,				lowercase		: Tuple=0.05     ,				lowercase		: Union[str, Any]=10     ,				lowercase		: Union[str, Any]=2     ,				lowercase		: Optional[Any]=0.0     ,				lowercase		: Optional[int]=10     ,				lowercase		: List[str]=0     ,				lowercase		: List[str]="mean"     ,				lowercase		: str=False     ,				lowercase		: List[Any]=False     ,				lowercase		: Tuple=256     ,				lowercase		: str=0     ,				lowercase		: int=1     ,				lowercase		: Optional[int]=2     ,				**lowercase		: Optional[Any]     ,				):





        """simple docstring"""




        super().__init__(**lowerCamelCase__     ,				pad_token_id=lowerCamelCase__     ,				bos_token_id=lowerCamelCase__     ,				eos_token_id=lowerCamelCase__						)
        lowercase_      :List[str]         =			hidden_size
        lowercase_      :Optional[int]         =			feat_extract_norm
        lowercase_      :str         =			feat_extract_activation
        lowercase_      :Optional[int]         =			list(lowerCamelCase__						)
        lowercase_      :Optional[int]         =			list(lowerCamelCase__						)
        lowercase_      :str         =			list(lowerCamelCase__						)
        lowercase_      :List[Any]         =			conv_bias
        lowercase_      :Optional[int]         =			num_conv_pos_embeddings
        lowercase_      :Dict         =			num_conv_pos_embedding_groups
        lowercase_      :Any         =			len(self.conv_dim						)
        lowercase_      :List[str]         =			num_hidden_layers
        lowercase_      :Dict         =			intermediate_size
        lowercase_      :Optional[int]         =			squeeze_factor
        lowercase_      :List[str]         =			max_position_embeddings
        lowercase_      :Dict         =			position_buckets
        lowercase_      :List[Any]         =			share_att_key
        lowercase_      :Optional[Any]         =			relative_attention
        lowercase_      :Union[str, Any]         =			norm_rel_ebd
        lowercase_      :List[str]         =			list(lowerCamelCase__						)
        lowercase_      :Union[str, Any]         =			hidden_act
        lowercase_      :str         =			num_attention_heads
        lowercase_      :List[str]         =			hidden_dropout
        lowercase_      :Any         =			attention_dropout
        lowercase_      :Union[str, Any]         =			activation_dropout
        lowercase_      :List[Any]         =			feat_proj_dropout
        lowercase_      :List[Any]         =			final_dropout
        lowercase_      :str         =			layer_norm_eps
        lowercase_      :Union[str, Any]         =			feature_layer_norm_eps
        lowercase_      :int         =			initializer_range
        lowercase_      :Optional[Any]         =			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_      :Optional[int]         =			apply_spec_augment
        lowercase_      :str         =			mask_time_prob
        lowercase_      :int         =			mask_time_length
        lowercase_      :Optional[Any]         =			mask_time_min_masks
        lowercase_      :Dict         =			mask_feature_prob
        lowercase_      :List[Any]         =			mask_feature_length
        lowercase_      :Any         =			mask_feature_min_masks

        # ctc loss
        lowercase_      :Any         =			ctc_loss_reduction
        lowercase_      :Any         =			ctc_zero_infinity

        # sequence classification
        lowercase_      :List[Any]         =			use_weighted_layer_sum
        lowercase_      :str         =			classifier_proj_size







     @property
     def 							lowercase__				(			self		: Any						):





        """simple docstring"""




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









'''simple docstring'''


# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCAmelCase :					Dict 							={
    '''configuration_xmod''': [
        '''XMOD_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''XmodConfig''',
        '''XmodOnnxConfig''',
    ],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase :					Union[str, Any] 							=[
     '''XMOD_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''XmodForCausalLM''',
     '''XmodForMaskedLM''',
     '''XmodForMultipleChoice''',
     '''XmodForQuestionAnswering''',
     '''XmodForSequenceClassification''',
     '''XmodForTokenClassification''',
     '''XmodModel''',
     '''XmodPreTrainedModel''',
 ]

if TYPE_CHECKING:
 from .configuration_xmod import XMOD_PRETRAINED_CONFIG_ARCHIVE_MAP, XmodConfig, XmodOnnxConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_xmod import (
      XMOD_PRETRAINED_MODEL_ARCHIVE_LIST,
      XmodForCausalLM,
      XmodForMaskedLM,
      XmodForMultipleChoice,
      XmodForQuestionAnswering,
      XmodForSequenceClassification,
      XmodForTokenClassification,
      XmodModel,
      XmodPreTrainedModel,
  )

else:
 import sys

 lowerCAmelCase :					Optional[Any] 							=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)


