



'''simple docstring'''







import functools
import operator

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


lowercase__  :	Union[str, Any]            =      logging.get_logger(__name__)

lowercase__  :	List[str]            =      {
    """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_				(						__A	):






   '''simple docstring'''

   A			:  int					=						"hubert"


   def __init__(	self  ,    __UpperCamelCase=32  ,    __UpperCamelCase=7_68  ,    __UpperCamelCase=12  ,    __UpperCamelCase=12  ,    __UpperCamelCase=30_72  ,    __UpperCamelCase="gelu"  ,    __UpperCamelCase=0.1  ,    __UpperCamelCase=0.1  ,    __UpperCamelCase=0.1  ,    __UpperCamelCase=True  ,    __UpperCamelCase=0.0  ,    __UpperCamelCase=0.1  ,    __UpperCamelCase=0.1  ,    __UpperCamelCase=0.02  ,    __UpperCamelCase=1e-5  ,    __UpperCamelCase="group"  ,    __UpperCamelCase="gelu"  ,    __UpperCamelCase=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)  ,    __UpperCamelCase=(5, 2, 2, 2, 2, 2, 2)  ,    __UpperCamelCase=(10, 3, 3, 3, 3, 2, 2)  ,    __UpperCamelCase=False  ,    __UpperCamelCase=1_28  ,    __UpperCamelCase=16  ,    __UpperCamelCase=False  ,    __UpperCamelCase=True  ,    __UpperCamelCase=0.05  ,    __UpperCamelCase=10  ,    __UpperCamelCase=2  ,    __UpperCamelCase=0.0  ,    __UpperCamelCase=10  ,    __UpperCamelCase=0  ,    __UpperCamelCase="sum"  ,    __UpperCamelCase=False  ,    __UpperCamelCase=False  ,    __UpperCamelCase=2_56  ,    __UpperCamelCase=0  ,    __UpperCamelCase=1  ,    __UpperCamelCase=2  ,    **__UpperCamelCase  ,    ):
       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			):
       return functools.reduce(operator.mul  ,    self.conv_stride  ,    1			)









"""simple docstring"""






from typing import TYPE_CHECKING

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


lowerCamelCase				:     Dict								=  {
    """configuration_camembert""": ["""CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CamembertConfig""", """CamembertOnnxConfig"""],
}

try:
    if not is_sentencepiece_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase				:     Optional[Any]								=  ["""CamembertTokenizer"""]

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase				:     Optional[Any]								=  ["""CamembertTokenizerFast"""]

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase				:     int								=  [
        """CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """CamembertForCausalLM""",
        """CamembertForMaskedLM""",
        """CamembertForMultipleChoice""",
        """CamembertForQuestionAnswering""",
        """CamembertForSequenceClassification""",
        """CamembertForTokenClassification""",
        """CamembertModel""",
        """CamembertPreTrainedModel""",
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase				:     str								=  [
        """TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """TFCamembertForCausalLM""",
        """TFCamembertForMaskedLM""",
        """TFCamembertForMultipleChoice""",
        """TFCamembertForQuestionAnswering""",
        """TFCamembertForSequenceClassification""",
        """TFCamembertForTokenClassification""",
        """TFCamembertModel""",
        """TFCamembertPreTrainedModel""",
    ]


if TYPE_CHECKING:
    from .configuration_camembert import CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CamembertConfig, CamembertOnnxConfig

    try:
        if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_camembert import CamembertTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_camembert_fast import CamembertTokenizerFast

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_camembert import (
            CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
            CamembertForCausalLM,
            CamembertForMaskedLM,
            CamembertForMultipleChoice,
            CamembertForQuestionAnswering,
            CamembertForSequenceClassification,
            CamembertForTokenClassification,
            CamembertModel,
            CamembertPreTrainedModel,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_camembert import (
            TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFCamembertForCausalLM,
            TFCamembertForMaskedLM,
            TFCamembertForMultipleChoice,
            TFCamembertForQuestionAnswering,
            TFCamembertForSequenceClassification,
            TFCamembertForTokenClassification,
            TFCamembertModel,
            TFCamembertPreTrainedModel,
        )

else:
    import sys

    lowerCamelCase				:     List[Any]								=  _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
