



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCamelCase__ =						{
    "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"],
}

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			UpperCamelCase__ =						[
			    "TIMESFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "TimesformerModel",
			    "TimesformerForVideoClassification",
			    "TimesformerPreTrainedModel",
			]

if TYPE_CHECKING:
			from .configuration_timesformer import TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, TimesformerConfig

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_timesformer import (
						    TIMESFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
						    TimesformerForVideoClassification,
						    TimesformerModel,
						    TimesformerPreTrainedModel,
						)

else:
			import sys

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










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   ( _UpperCAmelCase			):






			"""simple docstring"""





			lowercase__      :  Union[str, Any]      =			"""sew"""





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







									super().__init__(**lowercase			,     pad_token_id=lowercase			,     bos_token_id=lowercase			,     eos_token_id=lowercase   )
									__lowercase					=				hidden_size
									__lowercase					=				feat_extract_norm
									__lowercase					=				feat_extract_activation
									__lowercase					=				list(lowercase   )
									__lowercase					=				list(lowercase   )
									__lowercase					=				list(lowercase   )
									__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					=				hidden_act
									__lowercase					=				num_attention_heads
									__lowercase					=				hidden_dropout
									__lowercase					=				attention_dropout
									__lowercase					=				activation_dropout
									__lowercase					=				feat_proj_dropout
									__lowercase					=				final_dropout
									__lowercase					=				layerdrop
									__lowercase					=				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 		snake_case__			(				self	:       Dict   )						->					str:
									"""simple docstring"""







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





