

import functools
import operator

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


_UpperCamelCase     =    logging.get_logger(__name__)

_UpperCamelCase     =    {
    '''facebook/hubert-base-ls960''': '''https://huggingface.co/facebook/hubert-base-ls960/resolve/main/config.json''',
    # See all Hubert models at https://huggingface.co/models?filter=hubert
}



class 					lowercase		( _UpperCamelCase      ):



 '''simple docstring'''


 __SCREAMING_SNAKE_CASE      							=       """hubert"""




 def __init__(self , __a=32 , __a=768 , __a=12 , __a=12 , __a=3072 , __a="gelu" , __a=0.1 , __a=0.1 , __a=0.1 , __a=True , __a=0.0 , __a=0.1 , __a=0.1 , __a=0.02 , __a=1E-5 , __a="group" , __a="gelu" , __a=(512, 512, 512, 512, 512, 512, 512) , __a=(5, 2, 2, 2, 2, 2, 2) , __a=(10, 3, 3, 3, 3, 2, 2) , __a=False , __a=128 , __a=16 , __a=False , __a=True , __a=0.05 , __a=10 , __a=2 , __a=0.0 , __a=10 , __a=0 , __a="sum" , __a=False , __a=False , __a=256 , __a=0 , __a=1 , __a=2 , **__a , )				->      Union[str, Any]:






  """simple docstring"""





  super().__init__(**__a , pad_token_id=__a , bos_token_id=__a , eos_token_id=__a				)
  UpperCAmelCase__           =       hidden_size
  UpperCAmelCase__           =       feat_extract_norm
  UpperCAmelCase__           =       feat_extract_activation
  UpperCAmelCase__           =       list(__a				)
  UpperCAmelCase__           =       list(__a				)
  UpperCAmelCase__           =       list(__a				)
  UpperCAmelCase__           =       conv_bias
  UpperCAmelCase__           =       num_conv_pos_embeddings
  UpperCAmelCase__           =       num_conv_pos_embedding_groups
  UpperCAmelCase__           =       len(self.conv_dim				)
  UpperCAmelCase__           =       num_hidden_layers
  UpperCAmelCase__           =       intermediate_size
  UpperCAmelCase__           =       hidden_act
  UpperCAmelCase__           =       num_attention_heads
  UpperCAmelCase__           =       hidden_dropout
  UpperCAmelCase__           =       attention_dropout
  UpperCAmelCase__           =       activation_dropout
  UpperCAmelCase__           =       feat_proj_layer_norm
  UpperCAmelCase__           =       feat_proj_dropout
  UpperCAmelCase__           =       final_dropout
  UpperCAmelCase__           =       layerdrop
  UpperCAmelCase__           =       layer_norm_eps
  UpperCAmelCase__           =       initializer_range
  UpperCAmelCase__           =       vocab_size
  UpperCAmelCase__           =       do_stable_layer_norm
  UpperCAmelCase__           =       use_weighted_layer_sum
  UpperCAmelCase__           =       classifier_proj_size

  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
  UpperCAmelCase__           =       apply_spec_augment
  UpperCAmelCase__           =       mask_time_prob
  UpperCAmelCase__           =       mask_time_length
  UpperCAmelCase__           =       mask_time_min_masks
  UpperCAmelCase__           =       mask_feature_prob
  UpperCAmelCase__           =       mask_feature_length
  UpperCAmelCase__           =       mask_feature_min_masks

  # ctc loss
  UpperCAmelCase__           =       ctc_loss_reduction
  UpperCAmelCase__           =       ctc_zero_infinity




 @property
 def 						UpperCamelCase__							(self				)				->      int:






  """simple docstring"""





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






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_UpperCamelCase     =    {
    '''configuration_fsmt''': ['''FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FSMTConfig'''],
    '''tokenization_fsmt''': ['''FSMTTokenizer'''],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _UpperCamelCase     =    ['''FSMTForConditionalGeneration''', '''FSMTModel''', '''PretrainedFSMTModel''']


if TYPE_CHECKING:
 from .configuration_fsmt import FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP, FSMTConfig
 from .tokenization_fsmt import FSMTTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_fsmt import FSMTForConditionalGeneration, FSMTModel, PretrainedFSMTModel

else:
 import sys

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



