




"""simple docstring"""




import functools
import operator

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


a_										=       logging.get_logger(__name__)

a_										=       {
    "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 	_lowerCamelCase  (     _SCREAMING_SNAKE_CASE				):

      """simple docstring"""

      lowerCAmelCase__     :	int      =   "hubert"







      def __init__(       self   :	List[str]	,    snake_case   :	Dict=32	,    snake_case   :	int=768	,    snake_case   :	Optional[int]=12	,    snake_case   :	List[str]=12	,    snake_case   :	str=3072	,    snake_case   :	Tuple="gelu"	,    snake_case   :	Union[str, Any]=0.1	,    snake_case   :	Optional[Any]=0.1	,    snake_case   :	Optional[int]=0.1	,    snake_case   :	Optional[Any]=True	,    snake_case   :	Union[str, Any]=0.0	,    snake_case   :	List[str]=0.1	,    snake_case   :	str=0.1	,    snake_case   :	List[str]=0.02	,    snake_case   :	Union[str, Any]=1E-5	,    snake_case   :	int="group"	,    snake_case   :	int="gelu"	,    snake_case   :	Tuple=(512, 512, 512, 512, 512, 512, 512)	,    snake_case   :	str=(5, 2, 2, 2, 2, 2, 2)	,    snake_case   :	List[str]=(10, 3, 3, 3, 3, 2, 2)	,    snake_case   :	Optional[Any]=False	,    snake_case   :	List[str]=128	,    snake_case   :	List[Any]=16	,    snake_case   :	Union[str, Any]=False	,    snake_case   :	int=True	,    snake_case   :	Optional[Any]=0.05	,    snake_case   :	List[Any]=10	,    snake_case   :	Optional[Any]=2	,    snake_case   :	Tuple=0.0	,    snake_case   :	Optional[int]=10	,    snake_case   :	Any=0	,    snake_case   :	int="sum"	,    snake_case   :	List[Any]=False	,    snake_case   :	Optional[int]=False	,    snake_case   :	List[str]=256	,    snake_case   :	Any=0	,    snake_case   :	str=1	,    snake_case   :	Tuple=2	,    **snake_case   :	List[Any]	,    ):
          super().__init__(**snake_case	,    pad_token_id=snake_case	,    bos_token_id=snake_case	,    eos_token_id=snake_case			)
          __UpperCamelCase											=  hidden_size
          __UpperCamelCase											=  feat_extract_norm
          __UpperCamelCase											=  feat_extract_activation
          __UpperCamelCase											=  list(snake_case			)
          __UpperCamelCase											=  list(snake_case			)
          __UpperCamelCase											=  list(snake_case			)
          __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  snake_case		(       self   :	Optional[Any]			):
          return functools.reduce(operator.mul	,    self.conv_stride	,    1			)












from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


a_										=       {
    "configuration_marian": ["MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP", "MarianConfig", "MarianOnnxConfig"],
}

try:
 if not is_sentencepiece_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_										=       ["MarianTokenizer"]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_										=       [
     "MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST",
     "MarianForCausalLM",
     "MarianModel",
     "MarianMTModel",
     "MarianPreTrainedModel",
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_										=       ["TFMarianModel", "TFMarianMTModel", "TFMarianPreTrainedModel"]

try:
 if not is_flax_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_										=       ["FlaxMarianModel", "FlaxMarianMTModel", "FlaxMarianPreTrainedModel"]

if TYPE_CHECKING:
 from .configuration_marian import MARIAN_PRETRAINED_CONFIG_ARCHIVE_MAP, MarianConfig, MarianOnnxConfig

 try:
  if not is_sentencepiece_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_marian import MarianTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_marian import (
      MARIAN_PRETRAINED_MODEL_ARCHIVE_LIST,
      MarianForCausalLM,
      MarianModel,
      MarianMTModel,
      MarianPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_marian import TFMarianModel, TFMarianMTModel, TFMarianPreTrainedModel

 try:
  if not is_flax_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_flax_marian import FlaxMarianModel, FlaxMarianMTModel, FlaxMarianPreTrainedModel

else:
 import sys

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






