




"""simple docstring"""

import functools
import operator

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


__A							=     logging.get_logger(__name__)

__A							=     {
    "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_     ):
			a__	: Optional[Any]        =       """hubert"""


			def __init__(       self			,	SCREAMING_SNAKE_CASE=32			,	SCREAMING_SNAKE_CASE=768			,	SCREAMING_SNAKE_CASE=12			,	SCREAMING_SNAKE_CASE=12			,	SCREAMING_SNAKE_CASE=3_072			,	SCREAMING_SNAKE_CASE="gelu"			,	SCREAMING_SNAKE_CASE=0.1			,	SCREAMING_SNAKE_CASE=0.1			,	SCREAMING_SNAKE_CASE=0.1			,	SCREAMING_SNAKE_CASE=True			,	SCREAMING_SNAKE_CASE=0.0			,	SCREAMING_SNAKE_CASE=0.1			,	SCREAMING_SNAKE_CASE=0.1			,	SCREAMING_SNAKE_CASE=0.02			,	SCREAMING_SNAKE_CASE=1E-5			,	SCREAMING_SNAKE_CASE="group"			,	SCREAMING_SNAKE_CASE="gelu"			,	SCREAMING_SNAKE_CASE=(512, 512, 512, 512, 512, 512, 512)			,	SCREAMING_SNAKE_CASE=(5, 2, 2, 2, 2, 2, 2)			,	SCREAMING_SNAKE_CASE=(10, 3, 3, 3, 3, 2, 2)			,	SCREAMING_SNAKE_CASE=False			,	SCREAMING_SNAKE_CASE=128			,	SCREAMING_SNAKE_CASE=16			,	SCREAMING_SNAKE_CASE=False			,	SCREAMING_SNAKE_CASE=True			,	SCREAMING_SNAKE_CASE=0.05			,	SCREAMING_SNAKE_CASE=10			,	SCREAMING_SNAKE_CASE=2			,	SCREAMING_SNAKE_CASE=0.0			,	SCREAMING_SNAKE_CASE=10			,	SCREAMING_SNAKE_CASE=0			,	SCREAMING_SNAKE_CASE="sum"			,	SCREAMING_SNAKE_CASE=False			,	SCREAMING_SNAKE_CASE=False			,	SCREAMING_SNAKE_CASE=256			,	SCREAMING_SNAKE_CASE=0			,	SCREAMING_SNAKE_CASE=1			,	SCREAMING_SNAKE_CASE=2			,	**SCREAMING_SNAKE_CASE			,	):



					"""simple docstring"""







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

					# ctc loss
					snake_case						:  Union[str, Any]        =			ctc_loss_reduction
					snake_case						:  Dict        =			ctc_zero_infinity



			@property
			def 							lowerCamelCase_			(       self							):



					"""simple docstring"""







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







"""simple docstring"""

def 					UpperCamelCase__       (						lowercase__					:       int				):
		if not isinstance(lowercase__    ,       lowercase__				):
				raise ValueError("double_factorial() only accepts integral values"				)
		if n < 0:
				raise ValueError("double_factorial() not defined for negative values"				)
		return 1 if n <= 1 else n * double_factorial(n - 2				)


if __name__ == "__main__":
							import doctest

							doctest.testmod()

