"""simple docstring"""






import functools
import operator

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


_A   					=    logging.get_logger(__name__)

_A   					=    {
    '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 lowerCamelCase		(_SCREAMING_SNAKE_CASE      ):






					'''simple docstring'''


					a   	=		"unispeech-sat"



					def __init__(						self			:				List[str]   , _snake_case			:				Optional[int]=32   , _snake_case			:				Union[str, Any]=768   , _snake_case			:				Optional[int]=12   , _snake_case			:				List[str]=12   , _snake_case			:				Optional[int]=3072   , _snake_case			:				List[str]="gelu"   , _snake_case			:				Optional[Any]=0.1   , _snake_case			:				List[str]=0.1   , _snake_case			:				Any=0.1   , _snake_case			:				Optional[Any]=0.0   , _snake_case			:				Optional[Any]=0.0   , _snake_case			:				str=0.1   , _snake_case			:				Dict=0.1   , _snake_case			:				Any=0.02   , _snake_case			:				List[Any]=1e-5   , _snake_case			:				List[Any]="group"   , _snake_case			:				Union[str, Any]="gelu"   , _snake_case			:				Union[str, Any]=(512, 512, 512, 512, 512, 512, 512)   , _snake_case			:				int=(5, 2, 2, 2, 2, 2, 2)   , _snake_case			:				Union[str, Any]=(10, 3, 3, 3, 3, 2, 2)   , _snake_case			:				Dict=False   , _snake_case			:				Union[str, Any]=128   , _snake_case			:				Any=16   , _snake_case			:				Tuple=False   , _snake_case			:				Optional[int]=True   , _snake_case			:				Tuple=0.05   , _snake_case			:				Dict=10   , _snake_case			:				Tuple=2   , _snake_case			:				Dict=0.0   , _snake_case			:				Dict=10   , _snake_case			:				Optional[Any]=0   , _snake_case			:				int=320   , _snake_case			:				Optional[Any]=2   , _snake_case			:				Dict=0.1   , _snake_case			:				List[Any]=100   , _snake_case			:				str=256   , _snake_case			:				Dict=256   , _snake_case			:				Dict=0.1   , _snake_case			:				List[Any]="mean"   , _snake_case			:				Tuple=False   , _snake_case			:				List[Any]=False   , _snake_case			:				int=256   , _snake_case			:				str=(512, 512, 512, 512, 1500)   , _snake_case			:				Optional[Any]=(5, 3, 3, 1, 1)   , _snake_case			:				Optional[int]=(1, 2, 3, 1, 1)   , _snake_case			:				str=512   , _snake_case			:				Tuple=0   , _snake_case			:				Union[str, Any]=1   , _snake_case			:				Any=2   , _snake_case			:				str=504   , **_snake_case			:				Optional[Any]   , )							->       List[str]:
									super().__init__(**_snake_case   , pad_token_id=_snake_case   , bos_token_id=_snake_case   , eos_token_id=_snake_case		)
									SCREAMING_SNAKE_CASE__		  =				hidden_size
									SCREAMING_SNAKE_CASE__		  =				feat_extract_norm
									SCREAMING_SNAKE_CASE__		  =				feat_extract_activation
									SCREAMING_SNAKE_CASE__		  =				list(_snake_case		)
									SCREAMING_SNAKE_CASE__		  =				list(_snake_case		)
									SCREAMING_SNAKE_CASE__		  =				list(_snake_case		)
									SCREAMING_SNAKE_CASE__		  =				conv_bias
									SCREAMING_SNAKE_CASE__		  =				num_conv_pos_embeddings
									SCREAMING_SNAKE_CASE__		  =				num_conv_pos_embedding_groups
									SCREAMING_SNAKE_CASE__		  =				len(self.conv_dim		)
									SCREAMING_SNAKE_CASE__		  =				num_hidden_layers
									SCREAMING_SNAKE_CASE__		  =				intermediate_size
									SCREAMING_SNAKE_CASE__		  =				hidden_act
									SCREAMING_SNAKE_CASE__		  =				num_attention_heads
									SCREAMING_SNAKE_CASE__		  =				hidden_dropout
									SCREAMING_SNAKE_CASE__		  =				attention_dropout
									SCREAMING_SNAKE_CASE__		  =				activation_dropout
									SCREAMING_SNAKE_CASE__		  =				feat_proj_dropout
									SCREAMING_SNAKE_CASE__		  =				final_dropout
									SCREAMING_SNAKE_CASE__		  =				layerdrop
									SCREAMING_SNAKE_CASE__		  =				layer_norm_eps
									SCREAMING_SNAKE_CASE__		  =				initializer_range
									SCREAMING_SNAKE_CASE__		  =				vocab_size
									SCREAMING_SNAKE_CASE__		  =				num_clusters
									SCREAMING_SNAKE_CASE__		  =				do_stable_layer_norm
									SCREAMING_SNAKE_CASE__		  =				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
									SCREAMING_SNAKE_CASE__		  =				apply_spec_augment
									SCREAMING_SNAKE_CASE__		  =				mask_time_prob
									SCREAMING_SNAKE_CASE__		  =				mask_time_length
									SCREAMING_SNAKE_CASE__		  =				mask_time_min_masks
									SCREAMING_SNAKE_CASE__		  =				mask_feature_prob
									SCREAMING_SNAKE_CASE__		  =				mask_feature_length
									SCREAMING_SNAKE_CASE__		  =				mask_feature_min_masks

									# parameters for pretraining with codevector quantized representations
									SCREAMING_SNAKE_CASE__		  =				num_codevectors_per_group
									SCREAMING_SNAKE_CASE__		  =				num_codevector_groups
									SCREAMING_SNAKE_CASE__		  =				contrastive_logits_temperature
									SCREAMING_SNAKE_CASE__		  =				feat_quantizer_dropout
									SCREAMING_SNAKE_CASE__		  =				num_negatives
									SCREAMING_SNAKE_CASE__		  =				codevector_dim
									SCREAMING_SNAKE_CASE__		  =				proj_codevector_dim
									SCREAMING_SNAKE_CASE__		  =				diversity_loss_weight

									# ctc loss
									SCREAMING_SNAKE_CASE__		  =				ctc_loss_reduction
									SCREAMING_SNAKE_CASE__		  =				ctc_zero_infinity

									# SequenceClassification-specific parameter. Feel free to ignore for other classes.
									SCREAMING_SNAKE_CASE__		  =				classifier_proj_size

									# XVector-specific parameters. Feel free to ignore for other classes.
									SCREAMING_SNAKE_CASE__		  =				list(_snake_case		)
									SCREAMING_SNAKE_CASE__		  =				list(_snake_case		)
									SCREAMING_SNAKE_CASE__		  =				list(_snake_case		)
									SCREAMING_SNAKE_CASE__		  =				xvector_output_dim



					@property
					def 			lowerCAmelCase_					(						self			:				str		)							->       Tuple:
									return functools.reduce(operator.mul   , self.conv_stride   , 1		)





"""simple docstring"""






from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream

class lowerCamelCase		(_SCREAMING_SNAKE_CASE      ):






					'''simple docstring'''


					def __init__(						self			:				List[str]   , _snake_case			:				Callable   , _snake_case			:				Optional[Features] = None   , _snake_case			:				str = None   , _snake_case			:				bool = False   , _snake_case			:				bool = False   , _snake_case			:				Optional[dict] = None   , _snake_case			:				Optional[int] = None   , **_snake_case			:				Dict   , )							->       Any:
									super().__init__(
									    features=_snake_case   , cache_dir=_snake_case   , keep_in_memory=_snake_case   , streaming=_snake_case   , num_proc=_snake_case   , **_snake_case   , )
									SCREAMING_SNAKE_CASE__		  =				Generator(
									    cache_dir=_snake_case   , features=_snake_case   , generator=_snake_case   , gen_kwargs=_snake_case   , **_snake_case   , )



					def 			lowerCAmelCase_					(						self			:				List[str]		)							->       Optional[Any]:
									# Build iterable dataset
									if self.streaming:
													SCREAMING_SNAKE_CASE__		  =				self.builder.as_streaming_dataset(split="train"		)
									# Build regular (map-style) dataset
									else:
													SCREAMING_SNAKE_CASE__		  =				None
													SCREAMING_SNAKE_CASE__		  =				None
													SCREAMING_SNAKE_CASE__		  =				None
													SCREAMING_SNAKE_CASE__		  =				None

													self.builder.download_and_prepare(
													    download_config=_snake_case   , download_mode=_snake_case   , verification_mode=_snake_case   , base_path=_snake_case   , num_proc=self.num_proc   , )
													SCREAMING_SNAKE_CASE__		  =				self.builder.as_dataset(
													    split="train"   , verification_mode=_snake_case   , in_memory=self.keep_in_memory		)
									return dataset




