



import functools
import operator

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


__UpperCAmelCase    	=  logging.get_logger(__name__)

__UpperCAmelCase    	=  {
    '''facebook/hubert-base-ls960''': '''https://huggingface.co/facebook/hubert-base-ls960/resolve/main/config.json''',
    # See all Hubert models at https://huggingface.co/models?filter=hubert
}


class 						lowerCamelCase__			(		_a ):
						_lowerCAmelCase             =			'''hubert'''


						def __init__(			self    :	Union[str, Any]   ,							_a    :	Optional[Any]=3_2   ,							_a    :	int=7_6_8   ,							_a    :	List[Any]=1_2   ,							_a    :	Tuple=1_2   ,							_a    :	int=3_0_7_2   ,							_a    :	int="gelu"   ,							_a    :	int=0.1   ,							_a    :	int=0.1   ,							_a    :	int=0.1   ,							_a    :	int=True   ,							_a    :	Dict=0.0   ,							_a    :	Any=0.1   ,							_a    :	str=0.1   ,							_a    :	Dict=0.0_2   ,							_a    :	Dict=1e-5   ,							_a    :	List[str]="group"   ,							_a    :	Union[str, Any]="gelu"   ,							_a    :	List[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)   ,							_a    :	int=(5, 2, 2, 2, 2, 2, 2)   ,							_a    :	Union[str, Any]=(1_0, 3, 3, 3, 3, 2, 2)   ,							_a    :	List[Any]=False   ,							_a    :	int=1_2_8   ,							_a    :	str=1_6   ,							_a    :	int=False   ,							_a    :	Optional[int]=True   ,							_a    :	Any=0.0_5   ,							_a    :	Dict=1_0   ,							_a    :	int=2   ,							_a    :	Dict=0.0   ,							_a    :	Optional[Any]=1_0   ,							_a    :	Union[str, Any]=0   ,							_a    :	List[str]="sum"   ,							_a    :	Optional[int]=False   ,							_a    :	List[str]=False   ,							_a    :	Dict=2_5_6   ,							_a    :	str=0   ,							_a    :	List[Any]=1   ,							_a    :	List[Any]=2   ,							**_a    :	Any   ,							):
													super().__init__(**_a   ,							pad_token_id=_a   ,							bos_token_id=_a   ,							eos_token_id=_a      )
													a__:							List[str]									=hidden_size
													a__:							Optional[int]									=feat_extract_norm
													a__:							Optional[Any]									=feat_extract_activation
													a__:							Union[str, Any]									=list(_a      )
													a__:							Tuple									=list(_a      )
													a__:							Dict									=list(_a      )
													a__:							int									=conv_bias
													a__:							Optional[Any]									=num_conv_pos_embeddings
													a__:							int									=num_conv_pos_embedding_groups
													a__:							List[str]									=len(self.conv_dim      )
													a__:							int									=num_hidden_layers
													a__:							str									=intermediate_size
													a__:							int									=hidden_act
													a__:							List[str]									=num_attention_heads
													a__:							List[str]									=hidden_dropout
													a__:							List[Any]									=attention_dropout
													a__:							int									=activation_dropout
													a__:							Dict									=feat_proj_layer_norm
													a__:							Dict									=feat_proj_dropout
													a__:							Optional[int]									=final_dropout
													a__:							Any									=layerdrop
													a__:							List[Any]									=layer_norm_eps
													a__:							Optional[int]									=initializer_range
													a__:							str									=vocab_size
													a__:							Union[str, Any]									=do_stable_layer_norm
													a__:							Optional[int]									=use_weighted_layer_sum
													a__:							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__:							Dict									=apply_spec_augment
													a__:							Optional[Any]									=mask_time_prob
													a__:							Union[str, Any]									=mask_time_length
													a__:							int									=mask_time_min_masks
													a__:							int									=mask_feature_prob
													a__:							Any									=mask_feature_length
													a__:							int									=mask_feature_min_masks

													# ctc loss
													a__:							int									=ctc_loss_reduction
													a__:							int									=ctc_zero_infinity







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










from typing import TYPE_CHECKING

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


__UpperCAmelCase    	=  {
    '''configuration_ernie_m''': ['''ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieMConfig'''],
}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__UpperCAmelCase    	=  ['''ErnieMTokenizer''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__UpperCAmelCase    	=  [
		    '''ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''ErnieMForMultipleChoice''',
		    '''ErnieMForQuestionAnswering''',
		    '''ErnieMForSequenceClassification''',
		    '''ErnieMForTokenClassification''',
		    '''ErnieMModel''',
		    '''ErnieMPreTrainedModel''',
		    '''ErnieMForInformationExtraction''',
		]


if TYPE_CHECKING:
		from .configuration_ernie_m import ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP, ErnieMConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_ernie_m import ErnieMTokenizer

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_ernie_m import (
				    ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST,
				    ErnieMForInformationExtraction,
				    ErnieMForMultipleChoice,
				    ErnieMForQuestionAnswering,
				    ErnieMForSequenceClassification,
				    ErnieMForTokenClassification,
				    ErnieMModel,
				    ErnieMPreTrainedModel,
				)


else:
		import sys

		__UpperCAmelCase    	=  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





