


'''simple docstring'''







import functools
import operator

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


SCREAMING_SNAKE_CASE_      =			logging.get_logger(__name__)

SCREAMING_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  lowerCAmelCase_						(       snake_case__      ):





  """simple docstring"""



  a_       :List[Any]												="""wav2vec2"""

  def __init__(					self     :							List[Any]				,							SCREAMING_SNAKE_CASE__     :							Tuple=3_2				,							SCREAMING_SNAKE_CASE__     :							int=7_6_8				,							SCREAMING_SNAKE_CASE__     :							Optional[Any]=1_2				,							SCREAMING_SNAKE_CASE__     :							Optional[Any]=1_2				,							SCREAMING_SNAKE_CASE__     :							Tuple=3_0_7_2				,							SCREAMING_SNAKE_CASE__     :							List[str]="gelu"				,							SCREAMING_SNAKE_CASE__     :							Tuple=0.1				,							SCREAMING_SNAKE_CASE__     :							Dict=0.1				,							SCREAMING_SNAKE_CASE__     :							Any=0.1				,							SCREAMING_SNAKE_CASE__     :							Tuple=0.0				,							SCREAMING_SNAKE_CASE__     :							Union[str, Any]=0.0				,							SCREAMING_SNAKE_CASE__     :							Optional[Any]=0.1				,							SCREAMING_SNAKE_CASE__     :							Union[str, Any]=0.1				,							SCREAMING_SNAKE_CASE__     :							Union[str, Any]=0.0_2				,							SCREAMING_SNAKE_CASE__     :							Optional[Any]=1E-5				,							SCREAMING_SNAKE_CASE__     :							List[str]="group"				,							SCREAMING_SNAKE_CASE__     :							Dict="gelu"				,							SCREAMING_SNAKE_CASE__     :							List[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)				,							SCREAMING_SNAKE_CASE__     :							int=(5, 2, 2, 2, 2, 2, 2)				,							SCREAMING_SNAKE_CASE__     :							Optional[Any]=(1_0, 3, 3, 3, 3, 2, 2)				,							SCREAMING_SNAKE_CASE__     :							Any=False				,							SCREAMING_SNAKE_CASE__     :							Dict=1_2_8				,							SCREAMING_SNAKE_CASE__     :							str=1_6				,							SCREAMING_SNAKE_CASE__     :							Dict=False				,							SCREAMING_SNAKE_CASE__     :							str=True				,							SCREAMING_SNAKE_CASE__     :							List[Any]=0.0_5				,							SCREAMING_SNAKE_CASE__     :							Optional[Any]=1_0				,							SCREAMING_SNAKE_CASE__     :							Any=2				,							SCREAMING_SNAKE_CASE__     :							str=0.0				,							SCREAMING_SNAKE_CASE__     :							Tuple=1_0				,							SCREAMING_SNAKE_CASE__     :							Union[str, Any]=0				,							SCREAMING_SNAKE_CASE__     :							Optional[Any]=3_2_0				,							SCREAMING_SNAKE_CASE__     :							List[str]=2				,							SCREAMING_SNAKE_CASE__     :							List[Any]=0.1				,							SCREAMING_SNAKE_CASE__     :							str=1_0_0				,							SCREAMING_SNAKE_CASE__     :							Any=2_5_6				,							SCREAMING_SNAKE_CASE__     :							Dict=2_5_6				,							SCREAMING_SNAKE_CASE__     :							List[str]=0.1				,							SCREAMING_SNAKE_CASE__     :							Optional[int]="sum"				,							SCREAMING_SNAKE_CASE__     :							List[str]=False				,							SCREAMING_SNAKE_CASE__     :							Any=False				,							SCREAMING_SNAKE_CASE__     :							List[Any]=2_5_6				,							SCREAMING_SNAKE_CASE__     :							List[str]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)				,							SCREAMING_SNAKE_CASE__     :							Union[str, Any]=(5, 3, 3, 1, 1)				,							SCREAMING_SNAKE_CASE__     :							int=(1, 2, 3, 1, 1)				,							SCREAMING_SNAKE_CASE__     :							List[str]=5_1_2				,							SCREAMING_SNAKE_CASE__     :							int=0				,							SCREAMING_SNAKE_CASE__     :							int=1				,							SCREAMING_SNAKE_CASE__     :							List[str]=2				,							SCREAMING_SNAKE_CASE__     :							Any=False				,							SCREAMING_SNAKE_CASE__     :							Union[str, Any]=3				,							SCREAMING_SNAKE_CASE__     :							List[str]=2				,							SCREAMING_SNAKE_CASE__     :							str=3				,							SCREAMING_SNAKE_CASE__     :							Optional[Any]=None				,							SCREAMING_SNAKE_CASE__     :							Dict=None				,							**SCREAMING_SNAKE_CASE__     :							List[Any]				,							):





       '''simple docstring'''

       super().__init__(**SCREAMING_SNAKE_CASE__				,							pad_token_id=SCREAMING_SNAKE_CASE__				,							bos_token_id=SCREAMING_SNAKE_CASE__				,							eos_token_id=SCREAMING_SNAKE_CASE__						)
       __a       =   hidden_size
       __a       =   feat_extract_norm
       __a       =   feat_extract_activation
       __a       =   list(SCREAMING_SNAKE_CASE__						)
       __a       =   list(SCREAMING_SNAKE_CASE__						)
       __a       =   list(SCREAMING_SNAKE_CASE__						)
       __a       =   conv_bias
       __a       =   num_conv_pos_embeddings
       __a       =   num_conv_pos_embedding_groups
       __a       =   len(self.conv_dim						)
       __a       =   num_hidden_layers
       __a       =   intermediate_size
       __a       =   hidden_act
       __a       =   num_attention_heads
       __a       =   hidden_dropout
       __a       =   attention_dropout
       __a       =   activation_dropout
       __a       =   feat_proj_dropout
       __a       =   final_dropout
       __a       =   layerdrop
       __a       =   layer_norm_eps
       __a       =   initializer_range
       __a       =   vocab_size
       __a       =   do_stable_layer_norm
       __a       =   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
       __a       =   apply_spec_augment
       __a       =   mask_time_prob
       __a       =   mask_time_length
       __a       =   mask_time_min_masks
       __a       =   mask_feature_prob
       __a       =   mask_feature_length
       __a       =   mask_feature_min_masks

       # parameters for pretraining with codevector quantized representations
       __a       =   num_codevectors_per_group
       __a       =   num_codevector_groups
       __a       =   contrastive_logits_temperature
       __a       =   feat_quantizer_dropout
       __a       =   num_negatives
       __a       =   codevector_dim
       __a       =   proj_codevector_dim
       __a       =   diversity_loss_weight

       # ctc loss
       __a       =   ctc_loss_reduction
       __a       =   ctc_zero_infinity

       # adapter
       __a       =   add_adapter
       __a       =   adapter_kernel_size
       __a       =   adapter_stride
       __a       =   num_adapter_layers
       __a       =   output_hidden_size or hidden_size
       __a       =   adapter_attn_dim

       # SequenceClassification-specific parameter. Feel free to ignore for other classes.
       __a       =   classifier_proj_size

       # XVector-specific parameters. Feel free to ignore for other classes.
       __a       =   list(SCREAMING_SNAKE_CASE__						)
       __a       =   list(SCREAMING_SNAKE_CASE__						)
       __a       =   list(SCREAMING_SNAKE_CASE__						)
       __a       =   xvector_output_dim


  @property
  def __a						(					self     :							Optional[Any]						):





       '''simple docstring'''

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










'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


SCREAMING_SNAKE_CASE_      =			{
    'configuration_rag': ['RagConfig'],
    'retrieval_rag': ['RagRetriever'],
    'tokenization_rag': ['RagTokenizer'],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE_      =			[
     'RagModel',
     'RagPreTrainedModel',
     'RagSequenceForGeneration',
     'RagTokenForGeneration',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE_      =			[
     'TFRagModel',
     'TFRagPreTrainedModel',
     'TFRagSequenceForGeneration',
     'TFRagTokenForGeneration',
 ]


if TYPE_CHECKING:
 from .configuration_rag import RagConfig
 from .retrieval_rag import RagRetriever
 from .tokenization_rag import RagTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_rag import RagModel, RagPreTrainedModel, RagSequenceForGeneration, RagTokenForGeneration

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_rag import (
      TFRagModel,
      TFRagPreTrainedModel,
      TFRagSequenceForGeneration,
      TFRagTokenForGeneration,
  )

else:
 import sys

 SCREAMING_SNAKE_CASE_      =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)






