



'''simple docstring'''






import functools
import operator

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


UpperCamelCase__:  Dict				      =     logging.get_logger(__name__)

UpperCamelCase__:  int				      =     {
    '''facebook/wav2vec2-base-960h''': '''https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json''',
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}

class 							SCREAMING_SNAKE_CASE(				A__     ):







	"""simple docstring"""






	lowerCamelCase__     					=			"wav2vec2"







	def __init__(		self     :	str						,     __snake_case     :	Dict=32						,     __snake_case     :	List[Any]=768						,     __snake_case     :	List[str]=12						,     __snake_case     :	List[str]=12						,     __snake_case     :	List[Any]=3072						,     __snake_case     :	Optional[Any]="gelu"						,     __snake_case     :	Optional[int]=0.1						,     __snake_case     :	Optional[int]=0.1						,     __snake_case     :	List[Any]=0.1						,     __snake_case     :	Dict=0.0						,     __snake_case     :	Union[str, Any]=0.0						,     __snake_case     :	str=0.1						,     __snake_case     :	List[str]=0.1						,     __snake_case     :	Dict=0.02						,     __snake_case     :	List[str]=1E-5						,     __snake_case     :	Optional[Any]="group"						,     __snake_case     :	List[Any]="gelu"						,     __snake_case     :	int=(512, 512, 512, 512, 512, 512, 512)						,     __snake_case     :	Union[str, Any]=(5, 2, 2, 2, 2, 2, 2)						,     __snake_case     :	Any=(10, 3, 3, 3, 3, 2, 2)						,     __snake_case     :	str=False						,     __snake_case     :	Tuple=128						,     __snake_case     :	Union[str, Any]=16						,     __snake_case     :	List[str]=False						,     __snake_case     :	Union[str, Any]=True						,     __snake_case     :	Any=0.05						,     __snake_case     :	Any=10						,     __snake_case     :	Dict=2						,     __snake_case     :	List[Any]=0.0						,     __snake_case     :	int=10						,     __snake_case     :	List[str]=0						,     __snake_case     :	Tuple=320						,     __snake_case     :	List[str]=2						,     __snake_case     :	int=0.1						,     __snake_case     :	List[Any]=100						,     __snake_case     :	List[str]=256						,     __snake_case     :	int=256						,     __snake_case     :	Optional[Any]=0.1						,     __snake_case     :	str="sum"						,     __snake_case     :	List[Any]=False						,     __snake_case     :	List[str]=False						,     __snake_case     :	Tuple=256						,     __snake_case     :	str=(512, 512, 512, 512, 1500)						,     __snake_case     :	List[str]=(5, 3, 3, 1, 1)						,     __snake_case     :	Tuple=(1, 2, 3, 1, 1)						,     __snake_case     :	Optional[Any]=512						,     __snake_case     :	Any=0						,     __snake_case     :	str=1						,     __snake_case     :	Any=2						,     __snake_case     :	Any=False						,     __snake_case     :	List[Any]=3						,     __snake_case     :	Any=2						,     __snake_case     :	List[str]=3						,     __snake_case     :	int=None						,     __snake_case     :	Optional[int]=None						,     **__snake_case     :	Union[str, Any]						,     )     ->						Any:
								super().__init__(**__snake_case						,     pad_token_id=__snake_case						,     bos_token_id=__snake_case						,     eos_token_id=__snake_case						)
								UpperCAmelCase					:			Tuple									=						hidden_size
								UpperCAmelCase					:			List[Any]									=						feat_extract_norm
								UpperCAmelCase					:			Tuple									=						feat_extract_activation
								UpperCAmelCase					:			Optional[int]									=						list(__snake_case						)
								UpperCAmelCase					:			Any									=						list(__snake_case						)
								UpperCAmelCase					:			Union[str, Any]									=						list(__snake_case						)
								UpperCAmelCase					:			Optional[int]									=						conv_bias
								UpperCAmelCase					:			Optional[Any]									=						num_conv_pos_embeddings
								UpperCAmelCase					:			Optional[int]									=						num_conv_pos_embedding_groups
								UpperCAmelCase					:			Tuple									=						len(self.conv_dim						)
								UpperCAmelCase					:			Optional[int]									=						num_hidden_layers
								UpperCAmelCase					:			List[Any]									=						intermediate_size
								UpperCAmelCase					:			Optional[Any]									=						hidden_act
								UpperCAmelCase					:			List[str]									=						num_attention_heads
								UpperCAmelCase					:			List[Any]									=						hidden_dropout
								UpperCAmelCase					:			int									=						attention_dropout
								UpperCAmelCase					:			Optional[Any]									=						activation_dropout
								UpperCAmelCase					:			int									=						feat_proj_dropout
								UpperCAmelCase					:			Dict									=						final_dropout
								UpperCAmelCase					:			Optional[int]									=						layerdrop
								UpperCAmelCase					:			Optional[Any]									=						layer_norm_eps
								UpperCAmelCase					:			Any									=						initializer_range
								UpperCAmelCase					:			List[str]									=						vocab_size
								UpperCAmelCase					:			List[str]									=						do_stable_layer_norm
								UpperCAmelCase					:			Optional[int]									=						use_weighted_layer_sum

								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					:			List[Any]									=						apply_spec_augment
								UpperCAmelCase					:			Optional[Any]									=						mask_time_prob
								UpperCAmelCase					:			List[str]									=						mask_time_length
								UpperCAmelCase					:			List[Any]									=						mask_time_min_masks
								UpperCAmelCase					:			Optional[Any]									=						mask_feature_prob
								UpperCAmelCase					:			Optional[int]									=						mask_feature_length
								UpperCAmelCase					:			Optional[int]									=						mask_feature_min_masks

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

								# ctc loss
								UpperCAmelCase					:			Optional[Any]									=						ctc_loss_reduction
								UpperCAmelCase					:			int									=						ctc_zero_infinity

								# adapter
								UpperCAmelCase					:			Union[str, Any]									=						add_adapter
								UpperCAmelCase					:			Union[str, Any]									=						adapter_kernel_size
								UpperCAmelCase					:			Optional[int]									=						adapter_stride
								UpperCAmelCase					:			Any									=						num_adapter_layers
								UpperCAmelCase					:			List[str]									=						output_hidden_size or hidden_size
								UpperCAmelCase					:			List[str]									=						adapter_attn_dim

								# SequenceClassification-specific parameter. Feel free to ignore for other classes.
								UpperCAmelCase					:			List[Any]									=						classifier_proj_size

								# XVector-specific parameters. Feel free to ignore for other classes.
								UpperCAmelCase					:			str									=						list(__snake_case						)
								UpperCAmelCase					:			Union[str, Any]									=						list(__snake_case						)
								UpperCAmelCase					:			List[Any]									=						list(__snake_case						)
								UpperCAmelCase					:			Optional[int]									=						xvector_output_dim







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









'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging


__SCREAMING_SNAKE_CASE					:				Optional[int]									=		logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE					:				Union[str, Any]									=		{
    '''tanreinama/GPTSAN-2.8B-spout_is_uniform''': (
        '''https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_is_uniform/resolve/main/config.json'''
    ),
}






class 					__lowerCAmelCase   (   lowercase						):

						"""simple docstring"""






						_UpperCAmelCase		:       Optional[int]   						="gptsan-japanese"
						_UpperCAmelCase		:       Union[str, Any]   						=[
						    "past_key_values",
						]
						_UpperCAmelCase		:       int   						={
						    "hidden_size": "d_model",
						    "num_attention_heads": "num_heads",
						    "num_hidden_layers": "num_layers",
						}






						def __init__(  self							:      List[str] ,  lowerCAmelCase							:      Dict=3_60_00 ,  lowerCAmelCase							:      Union[str, Any]=12_80 ,  lowerCAmelCase							:      Tuple=10_24 ,  lowerCAmelCase							:      Any=81_92 ,  lowerCAmelCase							:      List[str]=40_96 ,  lowerCAmelCase							:      Dict=1_28 ,  lowerCAmelCase							:      int=10 ,  lowerCAmelCase							:      str=0 ,  lowerCAmelCase							:      int=16 ,  lowerCAmelCase							:      int=16 ,  lowerCAmelCase							:      str=1_28 ,  lowerCAmelCase							:      Dict=0.0 ,  lowerCAmelCase							:      List[str]=1e-5 ,  lowerCAmelCase							:      List[str]=False ,  lowerCAmelCase							:      int=0.0 ,  lowerCAmelCase							:      Tuple="float32" ,  lowerCAmelCase							:      Optional[int]=False ,  lowerCAmelCase							:      int=False ,  lowerCAmelCase							:      Tuple=False ,  lowerCAmelCase							:      Optional[Any]=0.0_0_2 ,  lowerCAmelCase							:      Tuple=False ,  lowerCAmelCase							:      str=True ,  lowerCAmelCase							:      Optional[int]=3_59_98 ,  lowerCAmelCase							:      Optional[Any]=3_59_95 ,  lowerCAmelCase							:      Tuple=3_59_99 ,  **lowerCAmelCase							:      Dict ,  ):
													A_			    =		vocab_size
													A_			    =		max_position_embeddings
													A_			    =		d_model
													A_			    =		d_ff
													A_			    =		d_ext
													A_			    =		d_spout
													A_			    =		num_switch_layers
													A_			    =		num_ext_layers
													A_			    =		num_switch_layers + num_ext_layers
													A_			    =		num_heads
													A_			    =		num_experts
													A_			    =		expert_capacity
													A_			    =		dropout_rate
													A_			    =		layer_norm_epsilon
													A_			    =		router_bias
													A_			    =		router_jitter_noise
													A_			    =		router_dtype
													A_			    =		router_ignore_padding_tokens
													A_			    =		output_hidden_states
													A_			    =		output_attentions
													A_			    =		initializer_factor
													A_			    =		output_router_logits
													A_			    =		use_cache

													super().__init__(
													    separator_token_id=lowerCAmelCase ,  pad_token_id=lowerCAmelCase ,  eos_token_id=lowerCAmelCase ,  **lowerCAmelCase ,  )





