


'''simple docstring'''

import functools
import operator

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


_UpperCAmelCase				: Tuple							    =				logging.get_logger(__name__)

_UpperCAmelCase				: 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       a__				( __A      ):







				"""simple docstring"""



				__UpperCamelCase    :		Tuple	=	'unispeech'




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

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

										# ctc loss
										__lowerCAmelCase							       =				ctc_loss_reduction
										__lowerCAmelCase							       =				ctc_zero_infinity

										# pretraining loss
										__lowerCAmelCase							       =				replace_prob




				@property
				def 					_snake_case  (self		):
										return functools.reduce(operator.mul       ,			self.conv_stride       ,			1		)





'''simple docstring'''

from typing import TYPE_CHECKING

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


_UpperCAmelCase				: str							    =				{
    """configuration_gpt_neox_japanese""": ["""GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoXJapaneseConfig"""],
    """tokenization_gpt_neox_japanese""": ["""GPTNeoXJapaneseTokenizer"""],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCAmelCase				: Union[str, Any]							    =				[
	    """GPT_NEOX_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST""",
	    """GPTNeoXJapaneseForCausalLM""",
	    """GPTNeoXJapaneseLayer""",
	    """GPTNeoXJapaneseModel""",
	    """GPTNeoXJapanesePreTrainedModel""",
	]


if TYPE_CHECKING:
	from .configuration_gpt_neox_japanese import GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTNeoXJapaneseConfig
	from .tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_gpt_neox_japanese import (
		    GPT_NEOX_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST,
		    GPTNeoXJapaneseForCausalLM,
		    GPTNeoXJapaneseLayer,
		    GPTNeoXJapaneseModel,
		    GPTNeoXJapanesePreTrainedModel,
		)


else:
	import sys

	_UpperCAmelCase				: int							    =				_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)

