






import functools
import operator

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


lowercase	:				str      	=     logging.get_logger(__name__)

lowercase	:				Tuple      	=     {
    '''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 		UpperCAmelCase_    (						snake_case_       ):


						'''simple docstring'''




						A  : List[str]							=       '''wav2vec2'''






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

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

								# ctc loss
								snake_case_					:				List[str]    			=							ctc_loss_reduction
								snake_case_					:				List[str]    			=							ctc_zero_infinity

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

								# SequenceClassification-specific parameter. Feel free to ignore for other classes.
								snake_case_					:				int    			=							classifier_proj_size

								# XVector-specific parameters. Feel free to ignore for other classes.
								snake_case_					:				List[str]    			=							list(UpperCamelCase__					)
								snake_case_					:				Tuple    			=							list(UpperCamelCase__					)
								snake_case_					:				int    			=							list(UpperCamelCase__					)
								snake_case_					:				Any    			=							xvector_output_dim






						@property
						def    _lowerCAmelCase							(						self					)			->					Dict:
								return functools.reduce(operator.mul		,					self.conv_stride		,					1					)




"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__snake_case       =       {
    """configuration_time_series_transformer""": [
        """TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """TimeSeriesTransformerConfig""",
    ],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __snake_case       =       [
      """TIME_SERIES_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TimeSeriesTransformerForPrediction""",
      """TimeSeriesTransformerModel""",
      """TimeSeriesTransformerPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_time_series_transformer import (
      TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
      TimeSeriesTransformerConfig,
  )

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_time_series_transformer import (
        TIME_SERIES_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
        TimeSeriesTransformerForPrediction,
        TimeSeriesTransformerModel,
        TimeSeriesTransformerPreTrainedModel,
    )

else:
  import sys

  __snake_case       =       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





