





import functools
import operator

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


snake_case_							=			logging.get_logger(__name__)

snake_case_							=			{
    '''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        snake_case_		(			_A):
  lowerCamelCase    :Tuple						=     "wav2vec2"







  def __init__(		self			,     __lowercase=3_2			,     __lowercase=7_6_8			,     __lowercase=1_2			,     __lowercase=1_2			,     __lowercase=3_0_7_2			,     __lowercase="gelu"			,     __lowercase=0.1			,     __lowercase=0.1			,     __lowercase=0.1			,     __lowercase=0.0			,     __lowercase=0.0			,     __lowercase=0.1			,     __lowercase=0.1			,     __lowercase=0.0_2			,     __lowercase=1e-5			,     __lowercase="group"			,     __lowercase="gelu"			,     __lowercase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)			,     __lowercase=(5, 2, 2, 2, 2, 2, 2)			,     __lowercase=(1_0, 3, 3, 3, 3, 2, 2)			,     __lowercase=False			,     __lowercase=1_2_8			,     __lowercase=1_6			,     __lowercase=False			,     __lowercase=True			,     __lowercase=0.0_5			,     __lowercase=1_0			,     __lowercase=2			,     __lowercase=0.0			,     __lowercase=1_0			,     __lowercase=0			,     __lowercase=3_2_0			,     __lowercase=2			,     __lowercase=0.1			,     __lowercase=1_0_0			,     __lowercase=2_5_6			,     __lowercase=2_5_6			,     __lowercase=0.1			,     __lowercase="sum"			,     __lowercase=False			,     __lowercase=False			,     __lowercase=2_5_6			,     __lowercase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)			,     __lowercase=(5, 3, 3, 1, 1)			,     __lowercase=(1, 2, 3, 1, 1)			,     __lowercase=5_1_2			,     __lowercase=0			,     __lowercase=1			,     __lowercase=2			,     __lowercase=False			,     __lowercase=3			,     __lowercase=2			,     __lowercase=3			,     __lowercase=None			,     __lowercase=None			,     **__lowercase			,     )				->   Any:
    super().__init__(**__lowercase			,     pad_token_id=__lowercase			,     bos_token_id=__lowercase			,     eos_token_id=__lowercase   )
    lowerCamelCase   : int								=hidden_size
    lowerCamelCase   : int								=feat_extract_norm
    lowerCamelCase   : int								=feat_extract_activation
    lowerCamelCase   : List[str]								=list(__lowercase   )
    lowerCamelCase   : Any								=list(__lowercase   )
    lowerCamelCase   : Optional[Any]								=list(__lowercase   )
    lowerCamelCase   : Any								=conv_bias
    lowerCamelCase   : List[str]								=num_conv_pos_embeddings
    lowerCamelCase   : Tuple								=num_conv_pos_embedding_groups
    lowerCamelCase   : str								=len(self.conv_dim   )
    lowerCamelCase   : int								=num_hidden_layers
    lowerCamelCase   : str								=intermediate_size
    lowerCamelCase   : Dict								=hidden_act
    lowerCamelCase   : Any								=num_attention_heads
    lowerCamelCase   : Optional[int]								=hidden_dropout
    lowerCamelCase   : int								=attention_dropout
    lowerCamelCase   : Tuple								=activation_dropout
    lowerCamelCase   : List[str]								=feat_proj_dropout
    lowerCamelCase   : Optional[Any]								=final_dropout
    lowerCamelCase   : Tuple								=layerdrop
    lowerCamelCase   : Optional[int]								=layer_norm_eps
    lowerCamelCase   : Union[str, Any]								=initializer_range
    lowerCamelCase   : Any								=vocab_size
    lowerCamelCase   : int								=do_stable_layer_norm
    lowerCamelCase   : List[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
    lowerCamelCase   : Dict								=apply_spec_augment
    lowerCamelCase   : Optional[int]								=mask_time_prob
    lowerCamelCase   : Optional[int]								=mask_time_length
    lowerCamelCase   : List[str]								=mask_time_min_masks
    lowerCamelCase   : Optional[int]								=mask_feature_prob
    lowerCamelCase   : Optional[Any]								=mask_feature_length
    lowerCamelCase   : List[str]								=mask_feature_min_masks

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

    # ctc loss
    lowerCamelCase   : Any								=ctc_loss_reduction
    lowerCamelCase   : Tuple								=ctc_zero_infinity

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

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

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







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








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


snake_case_							=			logging.get_logger(__name__)

snake_case_							=			{
    '''facebook/timesformer''': '''https://huggingface.co/facebook/timesformer/resolve/main/config.json''',
}
class        snake_case_		(			_A):
		lowerCamelCase    :Union[str, Any]						=     "timesformer"







		def __init__(		self			,     __lowercase=2_2_4			,     __lowercase=1_6			,     __lowercase=3			,     __lowercase=8			,     __lowercase=7_6_8			,     __lowercase=1_2			,     __lowercase=1_2			,     __lowercase=3_0_7_2			,     __lowercase="gelu"			,     __lowercase=0.0			,     __lowercase=0.0			,     __lowercase=0.0_2			,     __lowercase=1e-6			,     __lowercase=True			,     __lowercase="divided_space_time"			,     __lowercase=0			,     **__lowercase			,     )				->   List[Any]:
				super().__init__(**__lowercase   )

				lowerCamelCase   : int								=image_size
				lowerCamelCase   : List[str]								=patch_size
				lowerCamelCase   : Union[str, Any]								=num_channels
				lowerCamelCase   : str								=num_frames

				lowerCamelCase   : Dict								=hidden_size
				lowerCamelCase   : int								=num_hidden_layers
				lowerCamelCase   : Dict								=num_attention_heads
				lowerCamelCase   : Dict								=intermediate_size
				lowerCamelCase   : Union[str, Any]								=hidden_act
				lowerCamelCase   : str								=hidden_dropout_prob
				lowerCamelCase   : Union[str, Any]								=attention_probs_dropout_prob
				lowerCamelCase   : List[Any]								=initializer_range
				lowerCamelCase   : List[Any]								=layer_norm_eps
				lowerCamelCase   : List[str]								=qkv_bias

				lowerCamelCase   : Tuple								=attention_type
				lowerCamelCase   : List[Any]								=drop_path_rate

