'''simple docstring'''




import functools
import operator

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


_lowercase		:				List[str]	       =		logging.get_logger(__name__)

_lowercase		:				Optional[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 					__magic_name__		(					_UpperCAmelCase):
			UpperCamelCase__       = '''wav2vec2'''







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

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

										# ctc loss
										lowercase_      :    Dict       		= ctc_loss_reduction
										lowercase_      :    Dict       		= ctc_zero_infinity

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

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

										# XVector-specific parameters. Feel free to ignore for other classes.
										lowercase_      :    str       		= list(lowercase_					)
										lowercase_      :    Dict       		= list(lowercase_					)
										lowercase_      :    int       		= list(lowercase_					)
										lowercase_      :    Optional[int]       		= xvector_output_dim







			@property
			def 			SCREAMING_SNAKE_CASE_  (			self       :						Union[str, Any]					):
										return functools.reduce(operator.mul       ,    self.conv_stride       ,    1					)






'''simple docstring'''




import argparse


_lowercase		:				Optional[int]	       =		"docs/source/_static/js/custom.js"




def 							lowerCamelCase			(   UpperCAmelCase__ :      Tuple				)    ->   Dict:
							with open(UpperCAmelCase__   ,   encoding="""utf-8"""   ,   newline="""\n"""				) as f:
														lowercase_      :    Optional[int]       		= f.readlines()
							lowercase_      :    Tuple       		= 0

							# First let's put the right version
							while not lines[index].startswith("""const stableVersion ="""				):
														index += 1
							lowercase_      :    Optional[Any]       		= F'''const stableVersion = "v{version}"\n'''

							# Then update the dictionary
							while not lines[index].startswith("""const versionMapping = {"""				):
														index += 1

							# We go until the end
							while not lines[index].startswith("""}"""				):
														index += 1
							# We add the new version at the end
							lines[index - 1] += F'''    "v{version}": "v{version}",\n'''

							with open(UpperCAmelCase__   ,   """w"""   ,   encoding="""utf-8"""   ,   newline="""\n"""				) as f:
														f.writelines(UpperCAmelCase__				)


if __name__ == "__main__":
						_lowercase		:				Union[str, Any]	       =		argparse.ArgumentParser()
						parser.add_argument("--version", help="Release version.")
						_lowercase		:				Dict	       =		parser.parse_args()
						update_custom_js(args.version)





