





import functools
import operator

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


UpperCamelCase__      =logging.get_logger(__name__)

UpperCamelCase__      ={
    'asapp/sew-tiny-100k': 'https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json',
    # See all SEW models at https://huggingface.co/models?filter=sew
}





class 			lowerCAmelCase__( __lowercase    ):






       '''simple docstring'''


       __snake_case 			=    'sew'




       def __init__(      self    ,						__lowerCamelCase=3_2    ,						__lowerCamelCase=7_6_8    ,						__lowerCamelCase=1_2    ,						__lowerCamelCase=1_2    ,						__lowerCamelCase=3_0_7_2    ,						__lowerCamelCase=2    ,						__lowerCamelCase="gelu"    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.0    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.02    ,						__lowerCamelCase=1E-5    ,						__lowerCamelCase="group"    ,						__lowerCamelCase="gelu"    ,						__lowerCamelCase=(6_4, 1_2_8, 1_2_8, 1_2_8, 1_2_8, 2_5_6, 2_5_6, 2_5_6, 2_5_6, 5_1_2, 5_1_2, 5_1_2, 5_1_2)    ,						__lowerCamelCase=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)    ,						__lowerCamelCase=(1_0, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)    ,						__lowerCamelCase=False    ,						__lowerCamelCase=1_2_8    ,						__lowerCamelCase=1_6    ,						__lowerCamelCase=True    ,						__lowerCamelCase=0.05    ,						__lowerCamelCase=1_0    ,						__lowerCamelCase=2    ,						__lowerCamelCase=0.0    ,						__lowerCamelCase=1_0    ,						__lowerCamelCase=0    ,						__lowerCamelCase="mean"    ,						__lowerCamelCase=False    ,						__lowerCamelCase=False    ,						__lowerCamelCase=2_5_6    ,						__lowerCamelCase=0    ,						__lowerCamelCase=1    ,						__lowerCamelCase=2    ,						**__lowerCamelCase    ,						)			->     List[str]:
            super().__init__(**__lowerCamelCase    ,						pad_token_id=__lowerCamelCase    ,						bos_token_id=__lowerCamelCase    ,						eos_token_id=__lowerCamelCase							)
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							hidden_size
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							feat_extract_norm
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							feat_extract_activation
            _SCREAMING_SNAKE_CASE       :	int						    =							list(__lowerCamelCase							)
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							list(__lowerCamelCase							)
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							list(__lowerCamelCase							)
            _SCREAMING_SNAKE_CASE       :	str						    =							conv_bias
            _SCREAMING_SNAKE_CASE       :	Any						    =							num_conv_pos_embeddings
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							num_conv_pos_embedding_groups
            _SCREAMING_SNAKE_CASE       :	Dict						    =							len(self.conv_dim							)
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							num_hidden_layers
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							intermediate_size
            _SCREAMING_SNAKE_CASE       :	int						    =							squeeze_factor
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							hidden_act
            _SCREAMING_SNAKE_CASE       :	str						    =							num_attention_heads
            _SCREAMING_SNAKE_CASE       :	Any						    =							hidden_dropout
            _SCREAMING_SNAKE_CASE       :	str						    =							attention_dropout
            _SCREAMING_SNAKE_CASE       :	int						    =							activation_dropout
            _SCREAMING_SNAKE_CASE       :	str						    =							feat_proj_dropout
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							final_dropout
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							layerdrop
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							layer_norm_eps
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							initializer_range
            _SCREAMING_SNAKE_CASE       :	str						    =							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       :	Dict						    =							apply_spec_augment
            _SCREAMING_SNAKE_CASE       :	Any						    =							mask_time_prob
            _SCREAMING_SNAKE_CASE       :	int						    =							mask_time_length
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							mask_time_min_masks
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							mask_feature_prob
            _SCREAMING_SNAKE_CASE       :	str						    =							mask_feature_length
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							mask_feature_min_masks

            # ctc loss
            _SCREAMING_SNAKE_CASE       :	Any						    =							ctc_loss_reduction
            _SCREAMING_SNAKE_CASE       :	str						    =							ctc_zero_infinity

            # sequence classification
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							use_weighted_layer_sum
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							classifier_proj_size







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






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCamelCase__      ={
    'configuration_lilt': ['LILT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LiltConfig'],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCamelCase__      =[
           'LILT_PRETRAINED_MODEL_ARCHIVE_LIST',
           'LiltForQuestionAnswering',
           'LiltForSequenceClassification',
           'LiltForTokenClassification',
           'LiltModel',
           'LiltPreTrainedModel',
       ]

if TYPE_CHECKING:
       from .configuration_lilt import LILT_PRETRAINED_CONFIG_ARCHIVE_MAP, LiltConfig

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_lilt import (
                  LILT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  LiltForQuestionAnswering,
                  LiltForSequenceClassification,
                  LiltForTokenClassification,
                  LiltModel,
                  LiltPreTrainedModel,
              )

else:
       import sys

       UpperCamelCase__      =_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)