


from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


UpperCamelCase			:					Any         =							logging.get_logger(__name__)

UpperCamelCase			:					Optional[Any]         =							{
    '''nghuyong/ernie-1.0-base-zh''': '''https://huggingface.co/nghuyong/ernie-1.0-base-zh/resolve/main/config.json''',
    '''nghuyong/ernie-2.0-base-en''': '''https://huggingface.co/nghuyong/ernie-2.0-base-en/resolve/main/config.json''',
    '''nghuyong/ernie-2.0-large-en''': '''https://huggingface.co/nghuyong/ernie-2.0-large-en/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-base-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-base-zh/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-medium-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-mini-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-micro-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-nano-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json''',
    '''nghuyong/ernie-gram-zh''': '''https://huggingface.co/nghuyong/ernie-gram-zh/resolve/main/config.json''',
    '''nghuyong/ernie-health-zh''': '''https://huggingface.co/nghuyong/ernie-health-zh/resolve/main/config.json''',
}

class      __snake_case				(   _UpperCAmelCase):
					SCREAMING_SNAKE_CASE_		:       Optional[int]								=			"ernie"
					def __init__(						self       :						int	,      _lowerCAmelCase       :						Dict=3_0_5_2_2	,      _lowerCAmelCase       :						List[str]=7_6_8	,      _lowerCAmelCase       :						int=1_2	,      _lowerCAmelCase       :						Optional[Any]=1_2	,      _lowerCAmelCase       :						List[str]=3_0_7_2	,      _lowerCAmelCase       :						Optional[Any]="gelu"	,      _lowerCAmelCase       :						Any=0.1	,      _lowerCAmelCase       :						Any=0.1	,      _lowerCAmelCase       :						Dict=5_1_2	,      _lowerCAmelCase       :						Union[str, Any]=2	,      _lowerCAmelCase       :						Union[str, Any]=3	,      _lowerCAmelCase       :						List[str]=False	,      _lowerCAmelCase       :						Union[str, Any]=0.02	,      _lowerCAmelCase       :						Tuple=1E-1_2	,      _lowerCAmelCase       :						Tuple=0	,      _lowerCAmelCase       :						Any="absolute"	,      _lowerCAmelCase       :						str=True	,      _lowerCAmelCase       :						Dict=None	,      **_lowerCAmelCase       :						Union[str, Any]	,      )							->					List[str]:



											'''simple docstring'''





											super().__init__(pad_token_id=_lowerCAmelCase	,      **_lowerCAmelCase  )

											__magic_name__					=      vocab_size
											__magic_name__					=      hidden_size
											__magic_name__					=      num_hidden_layers
											__magic_name__					=      num_attention_heads
											__magic_name__					=      hidden_act
											__magic_name__					=      intermediate_size
											__magic_name__					=      hidden_dropout_prob
											__magic_name__					=      attention_probs_dropout_prob
											__magic_name__					=      max_position_embeddings
											__magic_name__					=      type_vocab_size
											__magic_name__					=      task_type_vocab_size
											__magic_name__					=      use_task_id
											__magic_name__					=      initializer_range
											__magic_name__					=      layer_norm_eps
											__magic_name__					=      position_embedding_type
											__magic_name__					=      use_cache
											__magic_name__					=      classifier_dropout







class      __snake_case				(   _UpperCAmelCase):
					@property
					def 	a			(						self       :						Union[str, Any]  )							->					Mapping[str, Mapping[int, str]]:



											'''simple docstring'''





											if self.task == "multiple-choice":
																	__magic_name__					=      {0: 'batch', 1: 'choice', 2: 'sequence'}
											else:
																	__magic_name__					=      {0: 'batch', 1: 'sequence'}
											return OrderedDict(
											    [
											        ('input_ids', dynamic_axis),
											        ('attention_mask', dynamic_axis),
											        ('token_type_ids', dynamic_axis),
											        ('task_type_ids', dynamic_axis),
											    ]  )





import functools
import operator

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


UpperCamelCase			:					Union[str, Any]         =							logging.get_logger(__name__)

UpperCamelCase			:					List[Any]         =							{
    '''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      __snake_case				(   _UpperCAmelCase):
					SCREAMING_SNAKE_CASE_		:       Tuple								=			"hubert"
					def __init__(						self       :						List[Any]	,      _lowerCAmelCase       :						Any=3_2	,      _lowerCAmelCase       :						Optional[Any]=7_6_8	,      _lowerCAmelCase       :						str=1_2	,      _lowerCAmelCase       :						List[Any]=1_2	,      _lowerCAmelCase       :						Optional[int]=3_0_7_2	,      _lowerCAmelCase       :						int="gelu"	,      _lowerCAmelCase       :						List[str]=0.1	,      _lowerCAmelCase       :						Union[str, Any]=0.1	,      _lowerCAmelCase       :						Optional[Any]=0.1	,      _lowerCAmelCase       :						Optional[int]=True	,      _lowerCAmelCase       :						Any=0.0	,      _lowerCAmelCase       :						Tuple=0.1	,      _lowerCAmelCase       :						Optional[int]=0.1	,      _lowerCAmelCase       :						str=0.02	,      _lowerCAmelCase       :						str=1E-5	,      _lowerCAmelCase       :						Dict="group"	,      _lowerCAmelCase       :						Tuple="gelu"	,      _lowerCAmelCase       :						List[str]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)	,      _lowerCAmelCase       :						List[str]=(5, 2, 2, 2, 2, 2, 2)	,      _lowerCAmelCase       :						Union[str, Any]=(1_0, 3, 3, 3, 3, 2, 2)	,      _lowerCAmelCase       :						Any=False	,      _lowerCAmelCase       :						Union[str, Any]=1_2_8	,      _lowerCAmelCase       :						Any=1_6	,      _lowerCAmelCase       :						Tuple=False	,      _lowerCAmelCase       :						Dict=True	,      _lowerCAmelCase       :						Union[str, Any]=0.05	,      _lowerCAmelCase       :						Optional[int]=1_0	,      _lowerCAmelCase       :						str=2	,      _lowerCAmelCase       :						Any=0.0	,      _lowerCAmelCase       :						Tuple=1_0	,      _lowerCAmelCase       :						int=0	,      _lowerCAmelCase       :						Tuple="sum"	,      _lowerCAmelCase       :						Tuple=False	,      _lowerCAmelCase       :						str=False	,      _lowerCAmelCase       :						Tuple=2_5_6	,      _lowerCAmelCase       :						List[str]=0	,      _lowerCAmelCase       :						int=1	,      _lowerCAmelCase       :						int=2	,      **_lowerCAmelCase       :						Optional[Any]	,      )							->					Dict:



											'''simple docstring'''





											super().__init__(**_lowerCAmelCase	,      pad_token_id=_lowerCAmelCase	,      bos_token_id=_lowerCAmelCase	,      eos_token_id=_lowerCAmelCase  )
											__magic_name__					=      hidden_size
											__magic_name__					=      feat_extract_norm
											__magic_name__					=      feat_extract_activation
											__magic_name__					=      list(_lowerCAmelCase  )
											__magic_name__					=      list(_lowerCAmelCase  )
											__magic_name__					=      list(_lowerCAmelCase  )
											__magic_name__					=      conv_bias
											__magic_name__					=      num_conv_pos_embeddings
											__magic_name__					=      num_conv_pos_embedding_groups
											__magic_name__					=      len(self.conv_dim  )
											__magic_name__					=      num_hidden_layers
											__magic_name__					=      intermediate_size
											__magic_name__					=      hidden_act
											__magic_name__					=      num_attention_heads
											__magic_name__					=      hidden_dropout
											__magic_name__					=      attention_dropout
											__magic_name__					=      activation_dropout
											__magic_name__					=      feat_proj_layer_norm
											__magic_name__					=      feat_proj_dropout
											__magic_name__					=      final_dropout
											__magic_name__					=      layerdrop
											__magic_name__					=      layer_norm_eps
											__magic_name__					=      initializer_range
											__magic_name__					=      vocab_size
											__magic_name__					=      do_stable_layer_norm
											__magic_name__					=      use_weighted_layer_sum
											__magic_name__					=      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
											__magic_name__					=      apply_spec_augment
											__magic_name__					=      mask_time_prob
											__magic_name__					=      mask_time_length
											__magic_name__					=      mask_time_min_masks
											__magic_name__					=      mask_feature_prob
											__magic_name__					=      mask_feature_length
											__magic_name__					=      mask_feature_min_masks

											# ctc loss
											__magic_name__					=      ctc_loss_reduction
											__magic_name__					=      ctc_zero_infinity







					@property
					def 	a			(						self       :						Optional[int]  )							->					Any:



											'''simple docstring'''





											return functools.reduce(operator.mul	,      self.conv_stride	,      1  )

