






"""simple docstring"""



import functools
import operator

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


A__	:    List[Any]			 = logging.get_logger(__name__)

A__	:    Union[str, Any]			 = {
    'microsoft/unispeech-large-1500h-cv': (
        'https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json'
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}







class        lowercase__      (							snake_case__       ):
			_UpperCAmelCase		:Any             =			"unispeech"


			def __init__(				self					:  int       ,	snake_case__					:  Optional[Any]=32       ,	snake_case__					:  int=768       ,	snake_case__					:  Optional[int]=12       ,	snake_case__					:  Union[str, Any]=12       ,	snake_case__					:  int=3072       ,	snake_case__					:  Union[str, Any]="gelu"       ,	snake_case__					:  Any=0.1       ,	snake_case__					:  Optional[int]=0.1       ,	snake_case__					:  Union[str, Any]=0.1       ,	snake_case__					:  str=0.0       ,	snake_case__					:  Tuple=0.0       ,	snake_case__					:  Dict=0.1       ,	snake_case__					:  Any=0.1       ,	snake_case__					:  Union[str, Any]=0.02       ,	snake_case__					:  Optional[Any]=1E-5       ,	snake_case__					:  int="group"       ,	snake_case__					:  Dict="gelu"       ,	snake_case__					:  Optional[Any]=(512, 512, 512, 512, 512, 512, 512)       ,	snake_case__					:  Optional[int]=(5, 2, 2, 2, 2, 2, 2)       ,	snake_case__					:  str=(10, 3, 3, 3, 3, 2, 2)       ,	snake_case__					:  List[str]=False       ,	snake_case__					:  Tuple=128       ,	snake_case__					:  Any=16       ,	snake_case__					:  Optional[Any]=False       ,	snake_case__					:  str=True       ,	snake_case__					:  str=0.05       ,	snake_case__					:  int=10       ,	snake_case__					:  Any=2       ,	snake_case__					:  Dict=0.0       ,	snake_case__					:  int=10       ,	snake_case__					:  List[Any]=0       ,	snake_case__					:  List[Any]=320       ,	snake_case__					:  List[Any]=2       ,	snake_case__					:  Tuple=0.1       ,	snake_case__					:  Any=100       ,	snake_case__					:  List[Any]=256       ,	snake_case__					:  Union[str, Any]=256       ,	snake_case__					:  Any=0.1       ,	snake_case__					:  Any="mean"       ,	snake_case__					:  int=False       ,	snake_case__					:  Tuple=False       ,	snake_case__					:  str=256       ,	snake_case__					:  Any=80       ,	snake_case__					:  Optional[int]=0       ,	snake_case__					:  Optional[int]=1       ,	snake_case__					:  Dict=2       ,	snake_case__					:  List[str]=0.5       ,	**snake_case__					:  int       ,	):
										super().__init__(**snake_case__       ,	pad_token_id=snake_case__       ,	bos_token_id=snake_case__       ,	eos_token_id=snake_case__ )
										lowerCamelCase_	:							Tuple									=hidden_size
										lowerCamelCase_	:							List[str]									=feat_extract_norm
										lowerCamelCase_	:							Union[str, Any]									=feat_extract_activation
										lowerCamelCase_	:							int									=list(snake_case__ )
										lowerCamelCase_	:							Tuple									=list(snake_case__ )
										lowerCamelCase_	:							List[str]									=list(snake_case__ )
										lowerCamelCase_	:							List[Any]									=conv_bias
										lowerCamelCase_	:							str									=num_conv_pos_embeddings
										lowerCamelCase_	:							Dict									=num_conv_pos_embedding_groups
										lowerCamelCase_	:							int									=len(self.conv_dim )
										lowerCamelCase_	:							Dict									=num_hidden_layers
										lowerCamelCase_	:							str									=intermediate_size
										lowerCamelCase_	:							str									=hidden_act
										lowerCamelCase_	:							Optional[int]									=num_attention_heads
										lowerCamelCase_	:							Dict									=hidden_dropout
										lowerCamelCase_	:							Optional[Any]									=attention_dropout
										lowerCamelCase_	:							Dict									=activation_dropout
										lowerCamelCase_	:							Optional[int]									=feat_proj_dropout
										lowerCamelCase_	:							List[str]									=final_dropout
										lowerCamelCase_	:							Union[str, Any]									=layerdrop
										lowerCamelCase_	:							Tuple									=layer_norm_eps
										lowerCamelCase_	:							Union[str, Any]									=initializer_range
										lowerCamelCase_	:							str									=num_ctc_classes
										lowerCamelCase_	:							Any									=vocab_size
										lowerCamelCase_	:							Tuple									=do_stable_layer_norm
										lowerCamelCase_	:							Any									=use_weighted_layer_sum
										lowerCamelCase_	:							str									=classifier_proj_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)`, but is `len(config.conv_dim) ="
																	    F""" {len(self.conv_dim )}`, `len(config.conv_stride) = {len(self.conv_stride )}`,"""
																	    F""" `len(config.conv_kernel) = {len(self.conv_kernel )}`.""" )

										# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
										lowerCamelCase_	:							Dict									=apply_spec_augment
										lowerCamelCase_	:							int									=mask_time_prob
										lowerCamelCase_	:							Any									=mask_time_length
										lowerCamelCase_	:							Any									=mask_time_min_masks
										lowerCamelCase_	:							Optional[int]									=mask_feature_prob
										lowerCamelCase_	:							int									=mask_feature_length
										lowerCamelCase_	:							Optional[int]									=mask_feature_min_masks

										# parameters for pretraining with codevector quantized representations
										lowerCamelCase_	:							int									=num_codevectors_per_group
										lowerCamelCase_	:							Tuple									=num_codevector_groups
										lowerCamelCase_	:							List[Any]									=contrastive_logits_temperature
										lowerCamelCase_	:							List[Any]									=feat_quantizer_dropout
										lowerCamelCase_	:							Optional[int]									=num_negatives
										lowerCamelCase_	:							str									=codevector_dim
										lowerCamelCase_	:							str									=proj_codevector_dim
										lowerCamelCase_	:							Dict									=diversity_loss_weight

										# ctc loss
										lowerCamelCase_	:							Any									=ctc_loss_reduction
										lowerCamelCase_	:							Union[str, Any]									=ctc_zero_infinity

										# pretraining loss
										lowerCamelCase_	:							str									=replace_prob


			@property
			def      UpperCAmelCase__						(				self					:  Optional[int] ):
										return functools.reduce(operator.mul       ,	self.conv_stride       ,	1 )











"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A__	:    List[Any]			 = {
    'configuration_lilt': ['LILT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LiltConfig'],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__	:    List[str]			 = [
						    'LILT_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'LiltForQuestionAnswering',
						    'LiltForSequenceClassification',
						    'LiltForTokenClassification',
						    'LiltModel',
						    'LiltPreTrainedModel',
						]

if TYPE_CHECKING:
						from .configuration_lilt import LILT_PRETRAINED_CONFIG_ARCHIVE_MAP, LiltConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_lilt import (
												    LILT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    LiltForQuestionAnswering,
												    LiltForSequenceClassification,
												    LiltForTokenClassification,
												    LiltModel,
												    LiltPreTrainedModel,
												)

else:
						import sys

						A__	:    Optional[Any]			 = _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



