



import functools
import operator

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


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

A__						:						Union[str, Any]          =      {
    '''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        __snake_case		(  a_		):
       _a       =				'hubert'




       def __init__( self  : Optional[Any]       ,       A_  : str=3_2       ,       A_  : int=7_6_8       ,       A_  : Dict=1_2       ,       A_  : List[Any]=1_2       ,       A_  : Optional[Any]=3_0_7_2       ,       A_  : Tuple="gelu"       ,       A_  : List[str]=0.1       ,       A_  : List[Any]=0.1       ,       A_  : str=0.1       ,       A_  : Tuple=True       ,       A_  : str=0.0       ,       A_  : Optional[int]=0.1       ,       A_  : Optional[int]=0.1       ,       A_  : Any=0.02       ,       A_  : int=1e-5       ,       A_  : Tuple="group"       ,       A_  : List[str]="gelu"       ,       A_  : Optional[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)       ,       A_  : Any=(5, 2, 2, 2, 2, 2, 2)       ,       A_  : Optional[int]=(1_0, 3, 3, 3, 3, 2, 2)       ,       A_  : Optional[int]=False       ,       A_  : str=1_2_8       ,       A_  : Optional[Any]=1_6       ,       A_  : Tuple=False       ,       A_  : Dict=True       ,       A_  : Any=0.05       ,       A_  : List[str]=1_0       ,       A_  : str=2       ,       A_  : Tuple=0.0       ,       A_  : Optional[int]=1_0       ,       A_  : Dict=0       ,       A_  : Optional[int]="sum"       ,       A_  : List[str]=False       ,       A_  : List[str]=False       ,       A_  : int=2_5_6       ,       A_  : Union[str, Any]=0       ,       A_  : List[str]=1       ,       A_  : Dict=2       ,       **A_  : Any       ,       ):
         super().__init__(**A_       ,       pad_token_id=A_       ,       bos_token_id=A_       ,       eos_token_id=A_)
         lowerCAmelCase_    :  Union[str, Any]             =				hidden_size
         lowerCAmelCase_    :  Optional[int]             =				feat_extract_norm
         lowerCAmelCase_    :  str             =				feat_extract_activation
         lowerCAmelCase_    :  List[Any]             =				list(A_)
         lowerCAmelCase_    :  Optional[Any]             =				list(A_)
         lowerCAmelCase_    :  str             =				list(A_)
         lowerCAmelCase_    :  Dict             =				conv_bias
         lowerCAmelCase_    :  int             =				num_conv_pos_embeddings
         lowerCAmelCase_    :  Dict             =				num_conv_pos_embedding_groups
         lowerCAmelCase_    :  Dict             =				len(self.conv_dim)
         lowerCAmelCase_    :  List[Any]             =				num_hidden_layers
         lowerCAmelCase_    :  Tuple             =				intermediate_size
         lowerCAmelCase_    :  Optional[Any]             =				hidden_act
         lowerCAmelCase_    :  List[str]             =				num_attention_heads
         lowerCAmelCase_    :  int             =				hidden_dropout
         lowerCAmelCase_    :  Optional[Any]             =				attention_dropout
         lowerCAmelCase_    :  Union[str, Any]             =				activation_dropout
         lowerCAmelCase_    :  Optional[Any]             =				feat_proj_layer_norm
         lowerCAmelCase_    :  Optional[Any]             =				feat_proj_dropout
         lowerCAmelCase_    :  List[Any]             =				final_dropout
         lowerCAmelCase_    :  Any             =				layerdrop
         lowerCAmelCase_    :  List[str]             =				layer_norm_eps
         lowerCAmelCase_    :  Tuple             =				initializer_range
         lowerCAmelCase_    :  str             =				vocab_size
         lowerCAmelCase_    :  Dict             =				do_stable_layer_norm
         lowerCAmelCase_    :  Dict             =				use_weighted_layer_sum
         lowerCAmelCase_    :  List[str]             =				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
         lowerCAmelCase_    :  Any             =				apply_spec_augment
         lowerCAmelCase_    :  List[Any]             =				mask_time_prob
         lowerCAmelCase_    :  Tuple             =				mask_time_length
         lowerCAmelCase_    :  Union[str, Any]             =				mask_time_min_masks
         lowerCAmelCase_    :  str             =				mask_feature_prob
         lowerCAmelCase_    :  List[Any]             =				mask_feature_length
         lowerCAmelCase_    :  Union[str, Any]             =				mask_feature_min_masks

         # ctc loss
         lowerCAmelCase_    :  Any             =				ctc_loss_reduction
         lowerCAmelCase_    :  Any             =				ctc_zero_infinity







       @property
       def      UpperCAmelCase__    ( self  : Optional[Any]):
         return functools.reduce(operator.mul       ,       self.conv_stride       ,       1)










from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


A__						:						List[str]          =      {
    '''configuration_segformer''': ['''SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SegformerConfig''', '''SegformerOnnxConfig''']
}

try:
						if not is_vision_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__						:						int          =      ['''SegformerFeatureExtractor''']
						A__						:						Dict          =      ['''SegformerImageProcessor''']

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__						:						Any          =      [
						    '''SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''SegformerDecodeHead''',
						    '''SegformerForImageClassification''',
						    '''SegformerForSemanticSegmentation''',
						    '''SegformerLayer''',
						    '''SegformerModel''',
						    '''SegformerPreTrainedModel''',
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__						:						List[Any]          =      [
						    '''TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''TFSegformerDecodeHead''',
						    '''TFSegformerForImageClassification''',
						    '''TFSegformerForSemanticSegmentation''',
						    '''TFSegformerModel''',
						    '''TFSegformerPreTrainedModel''',
						]


if TYPE_CHECKING:
						from .configuration_segformer import SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, SegformerConfig, SegformerOnnxConfig

						try:
												if not is_vision_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_segformer import SegformerFeatureExtractor
												from .image_processing_segformer import SegformerImageProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_segformer import (
												    SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    SegformerDecodeHead,
												    SegformerForImageClassification,
												    SegformerForSemanticSegmentation,
												    SegformerLayer,
												    SegformerModel,
												    SegformerPreTrainedModel,
												)
						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_segformer import (
												    TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    TFSegformerDecodeHead,
												    TFSegformerForImageClassification,
												    TFSegformerForSemanticSegmentation,
												    TFSegformerModel,
												    TFSegformerPreTrainedModel,
												)

else:
						import sys

						A__						:						Dict          =      _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





