"""simple docstring"""






import functools
import operator

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


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

__lowerCAmelCase					: 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 				_A		( lowerCAmelCase			):
      snake_case__    :     List[str]													=			'sew-d'

      def __init__(		self	, __lowerCAmelCase=32	, __lowerCAmelCase=768	, __lowerCAmelCase=12	, __lowerCAmelCase=12	, __lowerCAmelCase=3072	, __lowerCAmelCase=2	, __lowerCAmelCase=512	, __lowerCAmelCase=256	, __lowerCAmelCase=True	, __lowerCAmelCase=True	, __lowerCAmelCase=("p2c", "c2p")	, __lowerCAmelCase="layer_norm"	, __lowerCAmelCase="gelu_python"	, __lowerCAmelCase=0.1	, __lowerCAmelCase=0.1	, __lowerCAmelCase=0.1	, __lowerCAmelCase=0.0	, __lowerCAmelCase=0.1	, __lowerCAmelCase=0.0_2	, __lowerCAmelCase=1E-7	, __lowerCAmelCase=1E-5	, __lowerCAmelCase="group"	, __lowerCAmelCase="gelu"	, __lowerCAmelCase=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)	, __lowerCAmelCase=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)	, __lowerCAmelCase=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)	, __lowerCAmelCase=False	, __lowerCAmelCase=128	, __lowerCAmelCase=16	, __lowerCAmelCase=True	, __lowerCAmelCase=0.0_5	, __lowerCAmelCase=10	, __lowerCAmelCase=2	, __lowerCAmelCase=0.0	, __lowerCAmelCase=10	, __lowerCAmelCase=0	, __lowerCAmelCase="mean"	, __lowerCAmelCase=False	, __lowerCAmelCase=False	, __lowerCAmelCase=256	, __lowerCAmelCase=0	, __lowerCAmelCase=1	, __lowerCAmelCase=2	, **__lowerCAmelCase	, ):







            """simple docstring"""



            super().__init__(**__lowerCAmelCase	, pad_token_id=__lowerCAmelCase	, bos_token_id=__lowerCAmelCase	, eos_token_id=__lowerCAmelCase		)
            lowercase														=			hidden_size
            lowercase														=			feat_extract_norm
            lowercase														=			feat_extract_activation
            lowercase														=			list(__lowerCAmelCase		)
            lowercase														=			list(__lowerCAmelCase		)
            lowercase														=			list(__lowerCAmelCase		)
            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(__lowerCAmelCase		)
            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        A__ (		self		):







            """simple docstring"""



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




"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


__lowerCAmelCase					: Dict        ={
    """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""],
    """tokenization_xlm""": ["""XLMTokenizer"""],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCAmelCase					: int        =[
           """XLM_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """XLMForMultipleChoice""",
           """XLMForQuestionAnswering""",
           """XLMForQuestionAnsweringSimple""",
           """XLMForSequenceClassification""",
           """XLMForTokenClassification""",
           """XLMModel""",
           """XLMPreTrainedModel""",
           """XLMWithLMHeadModel""",
       ]

try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCAmelCase					: Union[str, Any]        =[
           """TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """TFXLMForMultipleChoice""",
           """TFXLMForQuestionAnsweringSimple""",
           """TFXLMForSequenceClassification""",
           """TFXLMForTokenClassification""",
           """TFXLMMainLayer""",
           """TFXLMModel""",
           """TFXLMPreTrainedModel""",
           """TFXLMWithLMHeadModel""",
       ]


if TYPE_CHECKING:
       from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig, XLMOnnxConfig
       from .tokenization_xlm import XLMTokenizer

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_xlm import (
                  XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
                  XLMForMultipleChoice,
                  XLMForQuestionAnswering,
                  XLMForQuestionAnsweringSimple,
                  XLMForSequenceClassification,
                  XLMForTokenClassification,
                  XLMModel,
                  XLMPreTrainedModel,
                  XLMWithLMHeadModel,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_xlm import (
                  TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TFXLMForMultipleChoice,
                  TFXLMForQuestionAnsweringSimple,
                  TFXLMForSequenceClassification,
                  TFXLMForTokenClassification,
                  TFXLMMainLayer,
                  TFXLMModel,
                  TFXLMPreTrainedModel,
                  TFXLMWithLMHeadModel,
              )

else:
       import sys

       __lowerCAmelCase					: Optional[int]        =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



