




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			(	lowerCamelCase_			):
			snake_case_				:			Optional[Any]								=					"""hubert"""







			def __init__(	self   :      Any   ,   snake_case__   :      Dict=32   ,   snake_case__   :      str=768   ,   snake_case__   :      Optional[int]=12   ,   snake_case__   :      Union[str, Any]=12   ,   snake_case__   :      Any=3_072   ,   snake_case__   :      Union[str, Any]="gelu"   ,   snake_case__   :      Optional[int]=0.1   ,   snake_case__   :      Union[str, Any]=0.1   ,   snake_case__   :      Union[str, Any]=0.1   ,   snake_case__   :      str=True   ,   snake_case__   :      int=0.0   ,   snake_case__   :      List[Any]=0.1   ,   snake_case__   :      Tuple=0.1   ,   snake_case__   :      Any=0.02   ,   snake_case__   :      Any=1e-5   ,   snake_case__   :      Dict="group"   ,   snake_case__   :      int="gelu"   ,   snake_case__   :      str=(512, 512, 512, 512, 512, 512, 512)   ,   snake_case__   :      Union[str, Any]=(5, 2, 2, 2, 2, 2, 2)   ,   snake_case__   :      Optional[Any]=(10, 3, 3, 3, 3, 2, 2)   ,   snake_case__   :      Union[str, Any]=False   ,   snake_case__   :      Optional[int]=128   ,   snake_case__   :      str=16   ,   snake_case__   :      List[Any]=False   ,   snake_case__   :      List[str]=True   ,   snake_case__   :      int=0.05   ,   snake_case__   :      List[Any]=10   ,   snake_case__   :      Union[str, Any]=2   ,   snake_case__   :      str=0.0   ,   snake_case__   :      str=10   ,   snake_case__   :      int=0   ,   snake_case__   :      List[str]="sum"   ,   snake_case__   :      Any=False   ,   snake_case__   :      str=False   ,   snake_case__   :      List[Any]=256   ,   snake_case__   :      Optional[Any]=0   ,   snake_case__   :      Optional[int]=1   ,   snake_case__   :      Union[str, Any]=2   ,   **snake_case__   :      Any   ,   ):




									"""simple docstring"""


									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 UpperCamelCase      (	self   :      str				):




									"""simple docstring"""


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












from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


lowercase_     :    int      =			{
    'configuration_videomae': ['VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VideoMAEConfig'],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowercase_     :    List[str]      =			[
				    'VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'VideoMAEForPreTraining',
				    'VideoMAEModel',
				    'VideoMAEPreTrainedModel',
				    'VideoMAEForVideoClassification',
				]

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowercase_     :    Any      =			['VideoMAEFeatureExtractor']
				lowercase_     :    Dict      =			['VideoMAEImageProcessor']

if TYPE_CHECKING:
				from .configuration_videomae import VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP, VideoMAEConfig

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_videomae import (
								    VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST,
								    VideoMAEForPreTraining,
								    VideoMAEForVideoClassification,
								    VideoMAEModel,
								    VideoMAEPreTrainedModel,
								)

				try:
								if not is_vision_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .feature_extraction_videomae import VideoMAEFeatureExtractor
								from .image_processing_videomae import VideoMAEImageProcessor

else:
				import sys

				lowercase_     :    int      =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




