




import functools
import operator

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


lowerCamelCase       :	int									=     logging.get_logger(__name__)

lowerCamelCase       :	Optional[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(		UpperCamelCase     ):



	'''simple docstring'''


	UpperCamelCase		     =		'''sew-d'''

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

							"""simple docstring"""






							super().__init__(**A_		,							pad_token_id=A_		,							bos_token_id=A_		,							eos_token_id=A_						)
							lowerCamelCase_	  =					hidden_size
							lowerCamelCase_	  =					feat_extract_norm
							lowerCamelCase_	  =					feat_extract_activation
							lowerCamelCase_	  =					list(A_						)
							lowerCamelCase_	  =					list(A_						)
							lowerCamelCase_	  =					list(A_						)
							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_	  =					max_position_embeddings
							lowerCamelCase_	  =					position_buckets
							lowerCamelCase_	  =					share_att_key
							lowerCamelCase_	  =					relative_attention
							lowerCamelCase_	  =					norm_rel_ebd
							lowerCamelCase_	  =					list(A_						)
							lowerCamelCase_	  =					hidden_act
							lowerCamelCase_	  =					num_attention_heads
							lowerCamelCase_	  =					hidden_dropout
							lowerCamelCase_	  =					attention_dropout
							lowerCamelCase_	  =					activation_dropout
							lowerCamelCase_	  =					feat_proj_dropout
							lowerCamelCase_	  =					final_dropout
							lowerCamelCase_	  =					layer_norm_eps
							lowerCamelCase_	  =					feature_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        a__				(       self      :						str						)     ->			Dict:

							"""simple docstring"""






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









from typing import TYPE_CHECKING

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


lowerCamelCase       :	Dict									=     {"configuration_vit": ["VIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ViTConfig", "ViTOnnxConfig"]}

try:
 if not is_vision_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase       :	Optional[int]									=     ["ViTFeatureExtractor"]
 lowerCamelCase       :	Dict									=     ["ViTImageProcessor"]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase       :	int									=     [
     "VIT_PRETRAINED_MODEL_ARCHIVE_LIST",
     "ViTForImageClassification",
     "ViTForMaskedImageModeling",
     "ViTModel",
     "ViTPreTrainedModel",
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase       :	Tuple									=     [
     "TFViTForImageClassification",
     "TFViTModel",
     "TFViTPreTrainedModel",
 ]

try:
 if not is_flax_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase       :	Dict									=     [
     "FlaxViTForImageClassification",
     "FlaxViTModel",
     "FlaxViTPreTrainedModel",
 ]

if TYPE_CHECKING:
 from .configuration_vit import VIT_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTConfig, ViTOnnxConfig

 try:
  if not is_vision_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .feature_extraction_vit import ViTFeatureExtractor
  from .image_processing_vit import ViTImageProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_vit import (
      VIT_PRETRAINED_MODEL_ARCHIVE_LIST,
      ViTForImageClassification,
      ViTForMaskedImageModeling,
      ViTModel,
      ViTPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_vit import TFViTForImageClassification, TFViTModel, TFViTPreTrainedModel

 try:
  if not is_flax_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_flax_vit import FlaxViTForImageClassification, FlaxViTModel, FlaxViTPreTrainedModel


else:
 import sys

 lowerCamelCase       :	Any									=     _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



