


import functools
import operator

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


a					:				Optional[int]       =      logging.get_logger(__name__)

a					:				int       =      {
    """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						(	__snake_case  ):
       _UpperCamelCase     		=   """hubert"""

       def __init__(      self						,    a__=32						,    a__=7_68						,    a__=12						,    a__=12						,    a__=30_72						,    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__=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)						,    a__=(5, 2, 2, 2, 2, 2, 2)						,    a__=(10, 3, 3, 3, 3, 2, 2)						,    a__=False						,    a__=1_28						,    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__=2_56						,    a__=0						,    a__=1						,    a__=2						,    **a__						,    ):






        '''simple docstring'''






        super().__init__(**lowerCAmelCase__						,    pad_token_id=lowerCAmelCase__						,    bos_token_id=lowerCAmelCase__						,    eos_token_id=lowerCAmelCase__       )
        snake_case :			Optional[Any]							=   hidden_size
        snake_case :			Union[str, Any]							=   feat_extract_norm
        snake_case :			Union[str, Any]							=   feat_extract_activation
        snake_case :			int							=   list(lowerCAmelCase__       )
        snake_case :			Dict							=   list(lowerCAmelCase__       )
        snake_case :			Dict							=   list(lowerCAmelCase__       )
        snake_case :			Optional[int]							=   conv_bias
        snake_case :			Union[str, Any]							=   num_conv_pos_embeddings
        snake_case :			int							=   num_conv_pos_embedding_groups
        snake_case :			Dict							=   len(self.conv_dim       )
        snake_case :			Dict							=   num_hidden_layers
        snake_case :			Tuple							=   intermediate_size
        snake_case :			Optional[Any]							=   hidden_act
        snake_case :			Dict							=   num_attention_heads
        snake_case :			Optional[int]							=   hidden_dropout
        snake_case :			int							=   attention_dropout
        snake_case :			Optional[Any]							=   activation_dropout
        snake_case :			List[Any]							=   feat_proj_layer_norm
        snake_case :			Union[str, Any]							=   feat_proj_dropout
        snake_case :			Optional[int]							=   final_dropout
        snake_case :			Optional[int]							=   layerdrop
        snake_case :			Union[str, Any]							=   layer_norm_eps
        snake_case :			str							=   initializer_range
        snake_case :			List[str]							=   vocab_size
        snake_case :			int							=   do_stable_layer_norm
        snake_case :			int							=   use_weighted_layer_sum
        snake_case :			Optional[int]							=   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
        snake_case :			Union[str, Any]							=   apply_spec_augment
        snake_case :			Tuple							=   mask_time_prob
        snake_case :			Union[str, Any]							=   mask_time_length
        snake_case :			Optional[int]							=   mask_time_min_masks
        snake_case :			Any							=   mask_feature_prob
        snake_case :			Any							=   mask_feature_length
        snake_case :			List[Any]							=   mask_feature_min_masks

        # ctc loss
        snake_case :			Optional[int]							=   ctc_loss_reduction
        snake_case :			List[str]							=   ctc_zero_infinity



       @property
       def 					UpperCAmelCase					(      self       ):






        '''simple docstring'''






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







'''simple docstring'''

from typing import Optional

from ..utils.logging import get_logger
from .audio_classificiation import AudioClassification
from .automatic_speech_recognition import AutomaticSpeechRecognition
from .base import TaskTemplate
from .image_classification import ImageClassification
from .language_modeling import LanguageModeling
from .question_answering import QuestionAnsweringExtractive
from .summarization import Summarization
from .text_classification import TextClassification


_lowerCamelCase :				int														= [
    """AutomaticSpeechRecognition""",
    """AudioClassification""",
    """ImageClassification""",
    """LanguageModeling""",
    """QuestionAnsweringExtractive""",
    """Summarization""",
    """TaskTemplate""",
    """TextClassification""",
]

_lowerCamelCase :				int														= get_logger(__name__)


_lowerCamelCase :				List[str]														= {
    AutomaticSpeechRecognition.task: AutomaticSpeechRecognition,
    AudioClassification.task: AudioClassification,
    ImageClassification.task: ImageClassification,
    LanguageModeling.task: LanguageModeling,
    QuestionAnsweringExtractive.task: QuestionAnsweringExtractive,
    Summarization.task: Summarization,
    TextClassification.task: TextClassification,
}



def  _lowerCAmelCase				(				__a      )  ->      Optional[TaskTemplate]:
     '''simple docstring'''







     _UpperCamelCase  :List[str]       =task_template_dict.get("""task"""      )
     if task_name is None:
          logger.warning(F'''Couldn\'t find template for task \'{task_name}\'. Available templates: {list(__a      )}'''      )
          return None
     _UpperCamelCase  :List[str]       =NAMEaTEMPLATE.get(__a      )
     return template.from_dict(__a      )