






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   __SCREAMING_SNAKE_CASE(	a_	):
							_UpperCAmelCase     =       "sew"
							def __init__(     self:      str       ,	UpperCamelCase:      Union[str, Any]=32       ,	UpperCamelCase:      Optional[int]=7_68       ,	UpperCamelCase:      List[str]=12       ,	UpperCamelCase:      List[str]=12       ,	UpperCamelCase:      Any=30_72       ,	UpperCamelCase:      List[Any]=2       ,	UpperCamelCase:      Union[str, Any]="gelu"       ,	UpperCamelCase:      Tuple=0.1       ,	UpperCamelCase:      str=0.1       ,	UpperCamelCase:      Optional[Any]=0.1       ,	UpperCamelCase:      Tuple=0.0       ,	UpperCamelCase:      Optional[Any]=0.1       ,	UpperCamelCase:      int=0.1       ,	UpperCamelCase:      Optional[Any]=0.02       ,	UpperCamelCase:      Optional[Any]=1e-5       ,	UpperCamelCase:      List[Any]="group"       ,	UpperCamelCase:      Tuple="gelu"       ,	UpperCamelCase:      Optional[Any]=(64, 1_28, 1_28, 1_28, 1_28, 2_56, 2_56, 2_56, 2_56, 5_12, 5_12, 5_12, 5_12)       ,	UpperCamelCase:      str=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)       ,	UpperCamelCase:      Optional[int]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)       ,	UpperCamelCase:      Union[str, Any]=False       ,	UpperCamelCase:      Optional[Any]=1_28       ,	UpperCamelCase:      List[Any]=16       ,	UpperCamelCase:      int=True       ,	UpperCamelCase:      str=0.05       ,	UpperCamelCase:      Optional[int]=10       ,	UpperCamelCase:      List[Any]=2       ,	UpperCamelCase:      List[Any]=0.0       ,	UpperCamelCase:      Tuple=10       ,	UpperCamelCase:      Tuple=0       ,	UpperCamelCase:      str="mean"       ,	UpperCamelCase:      Any=False       ,	UpperCamelCase:      List[str]=False       ,	UpperCamelCase:      List[str]=2_56       ,	UpperCamelCase:      Tuple=0       ,	UpperCamelCase:      List[Any]=1       ,	UpperCamelCase:      List[Any]=2       ,	**UpperCamelCase:      List[str]       ,	)		->		Dict:
											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 lowerCAmelCase_ (     self:      Union[str, Any]						)		->		Dict:
											return functools.reduce(operator.mul       ,	self.conv_stride       ,	1						)












from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


__UpperCamelCase					:		str	  =						{"""processing_layoutxlm""": ["""LayoutXLMProcessor"""]}

try:
							if not is_sentencepiece_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase					:		Dict	  =						["""LayoutXLMTokenizer"""]

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase					:		str	  =						["""LayoutXLMTokenizerFast"""]

if TYPE_CHECKING:
							from .processing_layoutxlm import LayoutXLMProcessor

							try:
														if not is_sentencepiece_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_layoutxlm import LayoutXLMTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_layoutxlm_fast import LayoutXLMTokenizerFast

else:
							import sys

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




