





import functools
import operator

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


UpperCamelCase__ :			str       	=			logging.get_logger(__name__)

UpperCamelCase__ :			Dict       	=			{
    """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 	_UpperCamelCase	(							A_	):







					'''simple docstring'''

					lowerCamelCase  :  Optional[int]           =							'hubert'





					def __init__(    self     :	int			,       __lowercase     :	List[Any]=32			,       __lowercase     :	Dict=7_68			,       __lowercase     :	Optional[Any]=12			,       __lowercase     :	List[Any]=12			,       __lowercase     :	List[Any]=30_72			,       __lowercase     :	str="gelu"			,       __lowercase     :	Optional[int]=0.1			,       __lowercase     :	str=0.1			,       __lowercase     :	int=0.1			,       __lowercase     :	List[str]=True			,       __lowercase     :	List[Any]=0.0			,       __lowercase     :	str=0.1			,       __lowercase     :	Optional[int]=0.1			,       __lowercase     :	int=0.02			,       __lowercase     :	str=1e-5			,       __lowercase     :	Union[str, Any]="group"			,       __lowercase     :	List[Any]="gelu"			,       __lowercase     :	List[str]=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)			,       __lowercase     :	str=(5, 2, 2, 2, 2, 2, 2)			,       __lowercase     :	List[str]=(10, 3, 3, 3, 3, 2, 2)			,       __lowercase     :	Dict=False			,       __lowercase     :	Tuple=1_28			,       __lowercase     :	str=16			,       __lowercase     :	List[Any]=False			,       __lowercase     :	Any=True			,       __lowercase     :	Dict=0.05			,       __lowercase     :	List[str]=10			,       __lowercase     :	Optional[Any]=2			,       __lowercase     :	Optional[int]=0.0			,       __lowercase     :	Any=10			,       __lowercase     :	List[str]=0			,       __lowercase     :	List[str]="sum"			,       __lowercase     :	Union[str, Any]=False			,       __lowercase     :	Dict=False			,       __lowercase     :	List[str]=2_56			,       __lowercase     :	List[Any]=0			,       __lowercase     :	Dict=1			,       __lowercase     :	Tuple=2			,       **__lowercase     :	Dict			,       ):






						'''simple docstring'''







						super().__init__(**__lowercase			,       pad_token_id=__lowercase			,       bos_token_id=__lowercase			,       eos_token_id=__lowercase		)
						UpperCAmelCase_		    =  hidden_size
						UpperCAmelCase_		    =  feat_extract_norm
						UpperCAmelCase_		    =  feat_extract_activation
						UpperCAmelCase_		    =  list(__lowercase		)
						UpperCAmelCase_		    =  list(__lowercase		)
						UpperCAmelCase_		    =  list(__lowercase		)
						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 							SCREAMING_SNAKE_CASE				(    self     :	Any		):






						'''simple docstring'''







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









from typing import TYPE_CHECKING

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


UpperCamelCase__ :			Any       	=			{
    """configuration_splinter""": ["""SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SplinterConfig"""],
    """tokenization_splinter""": ["""SplinterTokenizer"""],
}

try:
				if not is_tokenizers_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				UpperCamelCase__ :			Any       	=			["""SplinterTokenizerFast"""]

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				UpperCamelCase__ :			Union[str, Any]       	=			[
				    """SPLINTER_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """SplinterForQuestionAnswering""",
				    """SplinterForPreTraining""",
				    """SplinterLayer""",
				    """SplinterModel""",
				    """SplinterPreTrainedModel""",
				]


if TYPE_CHECKING:
				from .configuration_splinter import SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP, SplinterConfig
				from .tokenization_splinter import SplinterTokenizer

				try:
								if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_splinter_fast import SplinterTokenizerFast

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_splinter import (
								    SPLINTER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    SplinterForPreTraining,
								    SplinterForQuestionAnswering,
								    SplinterLayer,
								    SplinterModel,
								    SplinterPreTrainedModel,
								)


else:
				import sys

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


