'''simple docstring'''




import functools
import operator

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


_lowercase		:				List[Any]	       =		logging.get_logger(__name__)

_lowercase		:				Union[str, Any]	       =		{
    "microsoft/unispeech-sat-base-100h-libri-ft": (
        "https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json"
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}





class 					__magic_name__		(					__A):
			UpperCamelCase__       = """unispeech-sat"""







			def __init__(			self       :						Optional[Any]       ,    lowercase_       :						Union[str, Any]=32       ,    lowercase_       :						Any=768       ,    lowercase_       :						Optional[Any]=12       ,    lowercase_       :						int=12       ,    lowercase_       :						Dict=3072       ,    lowercase_       :						Tuple="gelu"       ,    lowercase_       :						Optional[Any]=0.1       ,    lowercase_       :						Dict=0.1       ,    lowercase_       :						Optional[int]=0.1       ,    lowercase_       :						str=0.0       ,    lowercase_       :						Optional[Any]=0.0       ,    lowercase_       :						str=0.1       ,    lowercase_       :						Dict=0.1       ,    lowercase_       :						List[Any]=0.02       ,    lowercase_       :						List[str]=1E-5       ,    lowercase_       :						int="group"       ,    lowercase_       :						Tuple="gelu"       ,    lowercase_       :						str=(512, 512, 512, 512, 512, 512, 512)       ,    lowercase_       :						Union[str, Any]=(5, 2, 2, 2, 2, 2, 2)       ,    lowercase_       :						List[Any]=(10, 3, 3, 3, 3, 2, 2)       ,    lowercase_       :						str=False       ,    lowercase_       :						str=128       ,    lowercase_       :						Dict=16       ,    lowercase_       :						str=False       ,    lowercase_       :						int=True       ,    lowercase_       :						Optional[int]=0.05       ,    lowercase_       :						str=10       ,    lowercase_       :						List[Any]=2       ,    lowercase_       :						List[Any]=0.0       ,    lowercase_       :						List[str]=10       ,    lowercase_       :						List[Any]=0       ,    lowercase_       :						List[str]=320       ,    lowercase_       :						Tuple=2       ,    lowercase_       :						Optional[int]=0.1       ,    lowercase_       :						Optional[int]=100       ,    lowercase_       :						List[str]=256       ,    lowercase_       :						Optional[int]=256       ,    lowercase_       :						Optional[Any]=0.1       ,    lowercase_       :						Union[str, Any]="mean"       ,    lowercase_       :						Union[str, Any]=False       ,    lowercase_       :						Union[str, Any]=False       ,    lowercase_       :						Union[str, Any]=256       ,    lowercase_       :						Optional[int]=(512, 512, 512, 512, 1500)       ,    lowercase_       :						Dict=(5, 3, 3, 1, 1)       ,    lowercase_       :						Tuple=(1, 2, 3, 1, 1)       ,    lowercase_       :						List[str]=512       ,    lowercase_       :						Optional[Any]=0       ,    lowercase_       :						List[Any]=1       ,    lowercase_       :						List[str]=2       ,    lowercase_       :						Any=504       ,    **lowercase_       :						Tuple       ,    ):
										super().__init__(**UpperCamelCase__       ,    pad_token_id=UpperCamelCase__       ,    bos_token_id=UpperCamelCase__       ,    eos_token_id=UpperCamelCase__					)
										lowercase_      :    int       		= hidden_size
										lowercase_      :    List[Any]       		= feat_extract_norm
										lowercase_      :    str       		= feat_extract_activation
										lowercase_      :    str       		= list(UpperCamelCase__					)
										lowercase_      :    List[str]       		= list(UpperCamelCase__					)
										lowercase_      :    Union[str, Any]       		= list(UpperCamelCase__					)
										lowercase_      :    List[Any]       		= conv_bias
										lowercase_      :    Union[str, Any]       		= num_conv_pos_embeddings
										lowercase_      :    str       		= num_conv_pos_embedding_groups
										lowercase_      :    int       		= len(self.conv_dim					)
										lowercase_      :    int       		= num_hidden_layers
										lowercase_      :    Dict       		= intermediate_size
										lowercase_      :    Optional[int]       		= hidden_act
										lowercase_      :    Tuple       		= num_attention_heads
										lowercase_      :    Tuple       		= hidden_dropout
										lowercase_      :    Optional[Any]       		= attention_dropout
										lowercase_      :    Any       		= activation_dropout
										lowercase_      :    Any       		= feat_proj_dropout
										lowercase_      :    str       		= final_dropout
										lowercase_      :    Optional[int]       		= layerdrop
										lowercase_      :    Union[str, Any]       		= layer_norm_eps
										lowercase_      :    Union[str, Any]       		= initializer_range
										lowercase_      :    str       		= vocab_size
										lowercase_      :    Optional[int]       		= num_clusters
										lowercase_      :    Tuple       		= do_stable_layer_norm
										lowercase_      :    str       		= use_weighted_layer_sum

										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
										lowercase_      :    Dict       		= apply_spec_augment
										lowercase_      :    Any       		= mask_time_prob
										lowercase_      :    Optional[Any]       		= mask_time_length
										lowercase_      :    str       		= mask_time_min_masks
										lowercase_      :    int       		= mask_feature_prob
										lowercase_      :    int       		= mask_feature_length
										lowercase_      :    List[Any]       		= mask_feature_min_masks

										# parameters for pretraining with codevector quantized representations
										lowercase_      :    List[str]       		= num_codevectors_per_group
										lowercase_      :    Tuple       		= num_codevector_groups
										lowercase_      :    List[str]       		= contrastive_logits_temperature
										lowercase_      :    Optional[Any]       		= feat_quantizer_dropout
										lowercase_      :    Any       		= num_negatives
										lowercase_      :    Any       		= codevector_dim
										lowercase_      :    Tuple       		= proj_codevector_dim
										lowercase_      :    Optional[int]       		= diversity_loss_weight

										# ctc loss
										lowercase_      :    Optional[int]       		= ctc_loss_reduction
										lowercase_      :    Union[str, Any]       		= ctc_zero_infinity

										# SequenceClassification-specific parameter. Feel free to ignore for other classes.
										lowercase_      :    Dict       		= classifier_proj_size

										# XVector-specific parameters. Feel free to ignore for other classes.
										lowercase_      :    Union[str, Any]       		= list(UpperCamelCase__					)
										lowercase_      :    Optional[int]       		= list(UpperCamelCase__					)
										lowercase_      :    Any       		= list(UpperCamelCase__					)
										lowercase_      :    int       		= xvector_output_dim







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






'''simple docstring'''




import pytest

import datasets.config
from datasets.utils.info_utils import is_small_dataset




@pytest.mark.parametrize("""dataset_size"""   ,   [None, 400 * 2**20, 600 * 2**20]				)
@pytest.mark.parametrize("""input_in_memory_max_size"""   ,   ["""default""", 0, 100 * 2**20, 900 * 2**20]				)
def 							lowerCamelCase			(   UpperCAmelCase__ :      Union[str, Any]   ,   UpperCAmelCase__ :      List[Any]   ,   UpperCAmelCase__ :      str				)    ->   Any:
							if input_in_memory_max_size != "default":
														monkeypatch.setattr(datasets.config   ,   """IN_MEMORY_MAX_SIZE"""   ,   UpperCAmelCase__				)
							lowercase_      :    List[Any]       		= datasets.config.IN_MEMORY_MAX_SIZE
							if input_in_memory_max_size == "default":
														assert in_memory_max_size == 0
							else:
														assert in_memory_max_size == input_in_memory_max_size
							if dataset_size and in_memory_max_size:
														lowercase_      :    str       		= dataset_size < in_memory_max_size
							else:
														lowercase_      :    List[Any]       		= False
							lowercase_      :    Any       		= is_small_dataset(UpperCAmelCase__				)
							assert result == expected





