




'''simple docstring'''





import functools
import operator

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


UpperCAmelCase_		:				Union[str, Any]									=     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 		__A      (			UpperCamelCase__			):
						UpperCamelCase     						=					"""wav2vec2"""

						def __init__(		self   :Optional[int]    , __snake_case   :List[str]=32    , __snake_case   :Optional[int]=7_68    , __snake_case   :List[str]=12    , __snake_case   :List[str]=12    , __snake_case   :Dict=30_72    , __snake_case   :List[str]="gelu"    , __snake_case   :Optional[Any]=0.1    , __snake_case   :Union[str, Any]=0.1    , __snake_case   :Dict=0.1    , __snake_case   :str=0.0    , __snake_case   :Tuple=0.0    , __snake_case   :Any=0.1    , __snake_case   :Any=0.1    , __snake_case   :int=0.02    , __snake_case   :Union[str, Any]=1E-5    , __snake_case   :Dict="group"    , __snake_case   :Tuple="gelu"    , __snake_case   :Dict=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)    , __snake_case   :Tuple=(5, 2, 2, 2, 2, 2, 2)    , __snake_case   :Dict=(10, 3, 3, 3, 3, 2, 2)    , __snake_case   :Dict=False    , __snake_case   :Tuple=1_28    , __snake_case   :List[str]=16    , __snake_case   :Tuple=False    , __snake_case   :Union[str, Any]=True    , __snake_case   :Dict=0.05    , __snake_case   :Optional[int]=10    , __snake_case   :List[Any]=2    , __snake_case   :Dict=0.0    , __snake_case   :int=10    , __snake_case   :Dict=0    , __snake_case   :Union[str, Any]=3_20    , __snake_case   :Optional[Any]=2    , __snake_case   :Union[str, Any]=0.1    , __snake_case   :Any=1_00    , __snake_case   :int=2_56    , __snake_case   :Union[str, Any]=2_56    , __snake_case   :List[Any]=0.1    , __snake_case   :int="sum"    , __snake_case   :Tuple=False    , __snake_case   :Any=False    , __snake_case   :Any=2_56    , __snake_case   :Any=(5_12, 5_12, 5_12, 5_12, 15_00)    , __snake_case   :str=(5, 3, 3, 1, 1)    , __snake_case   :List[Any]=(1, 2, 3, 1, 1)    , __snake_case   :str=5_12    , __snake_case   :Optional[int]=0    , __snake_case   :Tuple=1    , __snake_case   :List[Any]=2    , __snake_case   :List[Any]=False    , __snake_case   :List[Any]=3    , __snake_case   :List[str]=2    , __snake_case   :List[str]=3    , __snake_case   :Any=None    , __snake_case   :Optional[Any]=None    , **__snake_case   :List[str]    , ):
										'''simple docstring'''

										super().__init__(**__snake_case    , pad_token_id=__snake_case    , bos_token_id=__snake_case    , eos_token_id=__snake_case )
										__magic_name__	:	Union[str, Any]								=hidden_size
										__magic_name__	:	Optional[int]								=feat_extract_norm
										__magic_name__	:	str								=feat_extract_activation
										__magic_name__	:	Union[str, Any]								=list(__snake_case )
										__magic_name__	:	Optional[int]								=list(__snake_case )
										__magic_name__	:	str								=list(__snake_case )
										__magic_name__	:	List[Any]								=conv_bias
										__magic_name__	:	List[str]								=num_conv_pos_embeddings
										__magic_name__	:	Union[str, Any]								=num_conv_pos_embedding_groups
										__magic_name__	:	Dict								=len(self.conv_dim )
										__magic_name__	:	Dict								=num_hidden_layers
										__magic_name__	:	Dict								=intermediate_size
										__magic_name__	:	Optional[Any]								=hidden_act
										__magic_name__	:	Any								=num_attention_heads
										__magic_name__	:	Dict								=hidden_dropout
										__magic_name__	:	int								=attention_dropout
										__magic_name__	:	int								=activation_dropout
										__magic_name__	:	List[Any]								=feat_proj_dropout
										__magic_name__	:	int								=final_dropout
										__magic_name__	:	int								=layerdrop
										__magic_name__	:	Dict								=layer_norm_eps
										__magic_name__	:	Any								=initializer_range
										__magic_name__	:	Union[str, Any]								=vocab_size
										__magic_name__	:	Tuple								=do_stable_layer_norm
										__magic_name__	:	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
										__magic_name__	:	List[str]								=apply_spec_augment
										__magic_name__	:	Optional[int]								=mask_time_prob
										__magic_name__	:	Any								=mask_time_length
										__magic_name__	:	List[Any]								=mask_time_min_masks
										__magic_name__	:	str								=mask_feature_prob
										__magic_name__	:	List[str]								=mask_feature_length
										__magic_name__	:	Tuple								=mask_feature_min_masks

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

										# ctc loss
										__magic_name__	:	str								=ctc_loss_reduction
										__magic_name__	:	Any								=ctc_zero_infinity

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

										# SequenceClassification-specific parameter. Feel free to ignore for other classes.
										__magic_name__	:	Union[str, Any]								=classifier_proj_size

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


						@property
						def     A__						(		self   :Tuple ):
										'''simple docstring'''

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










import inspect
import warnings
from typing import Any, Dict, Optional, Union

from packaging import version




def 		lowerCAmelCase_   (	*lowerCamelCase	,     lowerCamelCase = None	,     lowerCamelCase=True	,     lowerCamelCase=2   ):
				from .. import __version__

				__magic_name__	:	Optional[int]								=take_from
				__magic_name__	:	Tuple								=()
				if not isinstance(args[0]	,     lowerCamelCase   ):
								__magic_name__	:	List[Any]								=(args,)

				for attribute, version_name, message in args:
								if version.parse(version.parse(lowerCamelCase   ).base_version   ) >= version.parse(lowerCamelCase   ):
												raise ValueError(
												    F"The deprecation tuple {(attribute, version_name, message)} should be removed since diffusers'"
												    F" version {__version__} is >= {version_name}"   )

								__magic_name__	:	List[str]								=None
								if isinstance(lowerCamelCase	,     lowerCamelCase   ) and attribute in deprecated_kwargs:
												values += (deprecated_kwargs.pop(lowerCamelCase   ),)
												__magic_name__	:	List[str]								=F"The `{attribute}` argument is deprecated and will be removed in version {version_name}."
								elif hasattr(lowerCamelCase	,     lowerCamelCase   ):
												values += (getattr(lowerCamelCase	,     lowerCamelCase   ),)
												__magic_name__	:	List[str]								=F"The `{attribute}` attribute is deprecated and will be removed in version {version_name}."
								elif deprecated_kwargs is None:
												__magic_name__	:	List[str]								=F"`{attribute}` is deprecated and will be removed in version {version_name}."

								if warning is not None:
												__magic_name__	:	List[Any]								=warning + """ """ if standard_warn else """"""
												warnings.warn(warning + message	,     lowerCamelCase	,     stacklevel=lowerCamelCase   )

				if isinstance(lowerCamelCase	,     lowerCamelCase   ) and len(lowerCamelCase   ) > 0:
								__magic_name__	:	List[Any]								=inspect.getouterframes(inspect.currentframe()   )[1]
								__magic_name__	:	Optional[int]								=call_frame.filename
								__magic_name__	:	Tuple								=call_frame.lineno
								__magic_name__	:	str								=call_frame.function
								__magic_name__				, __magic_name__	:	Optional[int]								=next(iter(deprecated_kwargs.items()   )   )
								raise TypeError(F"{function} in {filename} line {line_number-1} got an unexpected keyword argument `{key}`"   )

				if len(lowerCamelCase   ) == 0:
								return
				elif len(lowerCamelCase   ) == 1:
								return values[0]
				return values




