



"""simple docstring"""


import functools
import operator

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


snake_case_    					=	logging.get_logger(__name__)

snake_case_    					=	{
    '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 				A_      (					_lowerCamelCase    ):



						"""simple docstring"""
						__UpperCamelCase		    =							"""unispeech"""






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

												# parameters for pretraining with codevector quantized representations
												UpperCAmelCase					=			num_codevectors_per_group
												UpperCAmelCase					=			num_codevector_groups
												UpperCAmelCase					=			contrastive_logits_temperature
												UpperCAmelCase					=			feat_quantizer_dropout
												UpperCAmelCase					=			num_negatives
												UpperCAmelCase					=			codevector_dim
												UpperCAmelCase					=			proj_codevector_dim
												UpperCAmelCase					=			diversity_loss_weight

												# ctc loss
												UpperCAmelCase					=			ctc_loss_reduction
												UpperCAmelCase					=			ctc_zero_infinity

												# pretraining loss
												UpperCAmelCase					=			replace_prob






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




"""simple docstring"""


# Copyright 2022 The HuggingFace Team and The OpenBMB Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


snake_case_    					=	{
    """configuration_cpmant""": ["""CPMANT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CpmAntConfig"""],
    """tokenization_cpmant""": ["""CpmAntTokenizer"""],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				snake_case_    					=	[
				    """CPMANT_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """CpmAntForCausalLM""",
				    """CpmAntModel""",
				    """CpmAntPreTrainedModel""",
				]


if TYPE_CHECKING:
				from .configuration_cpmant import CPMANT_PRETRAINED_CONFIG_ARCHIVE_MAP, CpmAntConfig
				from .tokenization_cpmant import CpmAntTokenizer

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_cpmant import (
								    CPMANT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    CpmAntForCausalLM,
								    CpmAntModel,
								    CpmAntPreTrainedModel,
								)


else:
				import sys

				snake_case_    					=	_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





