
'''simple docstring'''





import functools
import operator

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


lowercase        =  logging.get_logger(__name__)

lowercase        =  {
    '''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       __A(				UpperCAmelCase       ):
					SCREAMING_SNAKE_CASE			    =    '''sew'''

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

												# ctc loss
												lowerCamelCase_							  =					ctc_loss_reduction
												lowerCamelCase_							  =					ctc_zero_infinity

												# sequence classification
												lowerCamelCase_							  =					use_weighted_layer_sum
												lowerCamelCase_							  =					classifier_proj_size



					@property
					def    lowercase__      (	self					:     Union[str, Any]   ):
												return functools.reduce(operator.mul   ,					self.conv_stride   ,					1   )







from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


lowercase        =  {'''configuration_deit''': ['''DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DeiTConfig''', '''DeiTOnnxConfig''']}

try:
		if not is_vision_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase        =  ['''DeiTFeatureExtractor''']
		lowercase        =  ['''DeiTImageProcessor''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase        =  [
		    '''DEIT_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''DeiTForImageClassification''',
		    '''DeiTForImageClassificationWithTeacher''',
		    '''DeiTForMaskedImageModeling''',
		    '''DeiTModel''',
		    '''DeiTPreTrainedModel''',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase        =  [
		    '''TF_DEIT_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''TFDeiTForImageClassification''',
		    '''TFDeiTForImageClassificationWithTeacher''',
		    '''TFDeiTForMaskedImageModeling''',
		    '''TFDeiTModel''',
		    '''TFDeiTPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_deit import DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP, DeiTConfig, DeiTOnnxConfig

		try:
				if not is_vision_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .feature_extraction_deit import DeiTFeatureExtractor
				from .image_processing_deit import DeiTImageProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_deit import (
				    DEIT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    DeiTForImageClassification,
				    DeiTForImageClassificationWithTeacher,
				    DeiTForMaskedImageModeling,
				    DeiTModel,
				    DeiTPreTrainedModel,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_deit import (
				    TF_DEIT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFDeiTForImageClassification,
				    TFDeiTForImageClassificationWithTeacher,
				    TFDeiTForMaskedImageModeling,
				    TFDeiTModel,
				    TFDeiTPreTrainedModel,
				)


else:
		import sys

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





