



import functools
import operator

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


snake_case    :						Tuple  =						logging.get_logger(__name__)

snake_case    :						Tuple  =						{
    '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 							lowerCAmelCase__  (	UpperCamelCase						):
					__A     :    List[str]           =						'unispeech'







					def __init__(       self      :     Tuple			,		_A      :     Any=32			,		_A      :     List[Any]=768			,		_A      :     Any=12			,		_A      :     Any=12			,		_A      :     List[str]=3072			,		_A      :     Dict="gelu"			,		_A      :     Optional[Any]=0.1			,		_A      :     Tuple=0.1			,		_A      :     str=0.1			,		_A      :     Any=0.0			,		_A      :     int=0.0			,		_A      :     str=0.1			,		_A      :     Optional[int]=0.1			,		_A      :     Union[str, Any]=0.02			,		_A      :     int=1e-5			,		_A      :     List[str]="group"			,		_A      :     List[Any]="gelu"			,		_A      :     List[Any]=(512, 512, 512, 512, 512, 512, 512)			,		_A      :     Dict=(5, 2, 2, 2, 2, 2, 2)			,		_A      :     int=(10, 3, 3, 3, 3, 2, 2)			,		_A      :     str=False			,		_A      :     Tuple=128			,		_A      :     Optional[int]=16			,		_A      :     List[Any]=False			,		_A      :     Optional[int]=True			,		_A      :     Optional[Any]=0.05			,		_A      :     List[Any]=10			,		_A      :     Union[str, Any]=2			,		_A      :     Optional[int]=0.0			,		_A      :     int=10			,		_A      :     List[str]=0			,		_A      :     List[Any]=320			,		_A      :     int=2			,		_A      :     Optional[Any]=0.1			,		_A      :     List[Any]=100			,		_A      :     Optional[int]=256			,		_A      :     Union[str, Any]=256			,		_A      :     Optional[Any]=0.1			,		_A      :     Optional[int]="mean"			,		_A      :     Optional[Any]=False			,		_A      :     Tuple=False			,		_A      :     Optional[Any]=256			,		_A      :     Union[str, Any]=80			,		_A      :     Tuple=0			,		_A      :     List[Any]=1			,		_A      :     Dict=2			,		_A      :     str=0.5			,		**_A      :     Any			,		):
											super().__init__(**_A			,		pad_token_id=_A			,		bos_token_id=_A			,		eos_token_id=_A)
											A__	:							Tuple						    = hidden_size
											A__	:							List[Any]						    = feat_extract_norm
											A__	:							Optional[int]						    = feat_extract_activation
											A__	:							int						    = list(_A)
											A__	:							str						    = list(_A)
											A__	:							List[Any]						    = list(_A)
											A__	:							str						    = conv_bias
											A__	:							Union[str, Any]						    = num_conv_pos_embeddings
											A__	:							Any						    = num_conv_pos_embedding_groups
											A__	:							Union[str, Any]						    = len(self.conv_dim)
											A__	:							Dict						    = num_hidden_layers
											A__	:							str						    = intermediate_size
											A__	:							Any						    = hidden_act
											A__	:							Optional[int]						    = num_attention_heads
											A__	:							Any						    = hidden_dropout
											A__	:							Union[str, Any]						    = attention_dropout
											A__	:							Union[str, Any]						    = activation_dropout
											A__	:							Dict						    = feat_proj_dropout
											A__	:							Tuple						    = final_dropout
											A__	:							Optional[Any]						    = layerdrop
											A__	:							Optional[int]						    = layer_norm_eps
											A__	:							Dict						    = initializer_range
											A__	:							Union[str, Any]						    = num_ctc_classes
											A__	:							Union[str, Any]						    = vocab_size
											A__	:							str						    = do_stable_layer_norm
											A__	:							Any						    = use_weighted_layer_sum
											A__	:							Optional[Any]						    = 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
											A__	:							Any						    = apply_spec_augment
											A__	:							Any						    = mask_time_prob
											A__	:							str						    = mask_time_length
											A__	:							Union[str, Any]						    = mask_time_min_masks
											A__	:							int						    = mask_feature_prob
											A__	:							int						    = mask_feature_length
											A__	:							Optional[Any]						    = mask_feature_min_masks

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

											# ctc loss
											A__	:							Optional[int]						    = ctc_loss_reduction
											A__	:							Optional[int]						    = ctc_zero_infinity

											# pretraining loss
											A__	:							Optional[Any]						    = replace_prob







					@property
					def  _lowercase			(       self      :     List[str]):
											return functools.reduce(operator.mul			,		self.conv_stride			,		1)





from typing import TYPE_CHECKING

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


snake_case    :						str  =						{
    'configuration_albert': ['ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'AlbertConfig', 'AlbertOnnxConfig'],
}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		snake_case    :						Any  =						['AlbertTokenizer']

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		snake_case    :						List[str]  =						['AlbertTokenizerFast']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		snake_case    :						List[str]  =						[
		    'ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'AlbertForMaskedLM',
		    'AlbertForMultipleChoice',
		    'AlbertForPreTraining',
		    'AlbertForQuestionAnswering',
		    'AlbertForSequenceClassification',
		    'AlbertForTokenClassification',
		    'AlbertModel',
		    'AlbertPreTrainedModel',
		    'load_tf_weights_in_albert',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		snake_case    :						Union[str, Any]  =						[
		    'TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'TFAlbertForMaskedLM',
		    'TFAlbertForMultipleChoice',
		    'TFAlbertForPreTraining',
		    'TFAlbertForQuestionAnswering',
		    'TFAlbertForSequenceClassification',
		    'TFAlbertForTokenClassification',
		    'TFAlbertMainLayer',
		    'TFAlbertModel',
		    'TFAlbertPreTrainedModel',
		]

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		snake_case    :						Any  =						[
		    'FlaxAlbertForMaskedLM',
		    'FlaxAlbertForMultipleChoice',
		    'FlaxAlbertForPreTraining',
		    'FlaxAlbertForQuestionAnswering',
		    'FlaxAlbertForSequenceClassification',
		    'FlaxAlbertForTokenClassification',
		    'FlaxAlbertModel',
		    'FlaxAlbertPreTrainedModel',
		]

if TYPE_CHECKING:
		from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig, AlbertOnnxConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_albert import AlbertTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_albert_fast import AlbertTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_albert import (
				    ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    AlbertForMaskedLM,
				    AlbertForMultipleChoice,
				    AlbertForPreTraining,
				    AlbertForQuestionAnswering,
				    AlbertForSequenceClassification,
				    AlbertForTokenClassification,
				    AlbertModel,
				    AlbertPreTrainedModel,
				    load_tf_weights_in_albert,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_albert import (
				    TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFAlbertForMaskedLM,
				    TFAlbertForMultipleChoice,
				    TFAlbertForPreTraining,
				    TFAlbertForQuestionAnswering,
				    TFAlbertForSequenceClassification,
				    TFAlbertForTokenClassification,
				    TFAlbertMainLayer,
				    TFAlbertModel,
				    TFAlbertPreTrainedModel,
				)

		try:
				if not is_flax_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_flax_albert import (
				    FlaxAlbertForMaskedLM,
				    FlaxAlbertForMultipleChoice,
				    FlaxAlbertForPreTraining,
				    FlaxAlbertForQuestionAnswering,
				    FlaxAlbertForSequenceClassification,
				    FlaxAlbertForTokenClassification,
				    FlaxAlbertModel,
				    FlaxAlbertPreTrainedModel,
				)
else:
		import sys

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