

import functools
import operator

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


lowerCAmelCase_       	=	logging.get_logger(__name__)

lowerCAmelCase_       	=	{
    '''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 	snake_case_   (		__A					):







			'''simple docstring'''

			SCREAMING_SNAKE_CASE     :   Dict									=				"sew"







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

									# ctc loss
									snake_case_   =	ctc_loss_reduction
									snake_case_   =	ctc_zero_infinity

									# sequence classification
									snake_case_   =	use_weighted_layer_sum
									snake_case_   =	classifier_proj_size







			@property
			def 				snake_case__(     self :				Dict							)      ->Optional[Any]:
									return functools.reduce(operator.mul							,   self.conv_stride							,   1							)


from typing import TYPE_CHECKING

from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available
from ...utils import OptionalDependencyNotAvailable


lowerCAmelCase_       	=	{'''configuration_dpt''': ['''DPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DPTConfig''']}

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase_       	=	['''DPTFeatureExtractor''']
					lowerCAmelCase_       	=	['''DPTImageProcessor''']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase_       	=	[
					    '''DPT_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''DPTForDepthEstimation''',
					    '''DPTForSemanticSegmentation''',
					    '''DPTModel''',
					    '''DPTPreTrainedModel''',
					]


if TYPE_CHECKING:
					from .configuration_dpt import DPT_PRETRAINED_CONFIG_ARCHIVE_MAP, DPTConfig

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .feature_extraction_dpt import DPTFeatureExtractor
										from .image_processing_dpt import DPTImageProcessor

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_dpt import (
										    DPT_PRETRAINED_MODEL_ARCHIVE_LIST,
										    DPTForDepthEstimation,
										    DPTForSemanticSegmentation,
										    DPTModel,
										    DPTPreTrainedModel,
										)


else:
					import sys

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