





import functools
import operator

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


_lowerCamelCase   				=			logging.get_logger(__name__)

_lowerCamelCase   				=			{
    'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json',
    # See all SEW-D models at https://huggingface.co/models?filter=sew-d
}




class   UpperCamelCase_       (     UpperCamelCase__    ):
							lowerCamelCase_           =					"sew-d"


							def __init__(							self    :Dict							,				__A    :Dict=32							,				__A    :str=768							,				__A    :int=12							,				__A    :str=12							,				__A    :str=3072							,				__A    :Optional[Any]=2							,				__A    :int=512							,				__A    :Optional[Any]=256							,				__A    :List[Any]=True							,				__A    :Union[str, Any]=True							,				__A    :int=("p2c", "c2p")							,				__A    :List[str]="layer_norm"							,				__A    :Optional[int]="gelu_python"							,				__A    :Dict=0.1							,				__A    :List[Any]=0.1							,				__A    :List[Any]=0.1							,				__A    :Optional[int]=0.0							,				__A    :Any=0.1							,				__A    :Optional[int]=0.0_2							,				__A    :Union[str, Any]=1E-7							,				__A    :List[Any]=1E-5							,				__A    :Optional[Any]="group"							,				__A    :Union[str, Any]="gelu"							,				__A    :Dict=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)							,				__A    :Tuple=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)							,				__A    :Union[str, Any]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)							,				__A    :int=False							,				__A    :Tuple=128							,				__A    :List[str]=16							,				__A    :Optional[int]=True							,				__A    :Optional[Any]=0.0_5							,				__A    :str=10							,				__A    :Optional[int]=2							,				__A    :int=0.0							,				__A    :List[Any]=10							,				__A    :Optional[int]=0							,				__A    :List[Any]="mean"							,				__A    :Optional[int]=False							,				__A    :str=False							,				__A    :Union[str, Any]=256							,				__A    :Any=0							,				__A    :Any=1							,				__A    :Any=2							,				**__A    :str							,				)   ->   int:



									"""simple docstring"""



									super().__init__(**__A							,				pad_token_id=__A							,				bos_token_id=__A							,				eos_token_id=__A		)
									SCREAMING_SNAKE_CASE__			=      hidden_size
									SCREAMING_SNAKE_CASE__			=      feat_extract_norm
									SCREAMING_SNAKE_CASE__			=      feat_extract_activation
									SCREAMING_SNAKE_CASE__			=      list(__A		)
									SCREAMING_SNAKE_CASE__			=      list(__A		)
									SCREAMING_SNAKE_CASE__			=      list(__A		)
									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__			=      squeeze_factor
									SCREAMING_SNAKE_CASE__			=      max_position_embeddings
									SCREAMING_SNAKE_CASE__			=      position_buckets
									SCREAMING_SNAKE_CASE__			=      share_att_key
									SCREAMING_SNAKE_CASE__			=      relative_attention
									SCREAMING_SNAKE_CASE__			=      norm_rel_ebd
									SCREAMING_SNAKE_CASE__			=      list(__A		)
									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__			=      layer_norm_eps
									SCREAMING_SNAKE_CASE__			=      feature_layer_norm_eps
									SCREAMING_SNAKE_CASE__			=      initializer_range
									SCREAMING_SNAKE_CASE__			=      vocab_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)`,"""
											    f'''but is `len(config.conv_dim) = {len(self.conv_dim		)}`, `len(config.conv_stride)'''
											    f'''= {len(self.conv_stride		)}`, `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

									# ctc loss
									SCREAMING_SNAKE_CASE__			=      ctc_loss_reduction
									SCREAMING_SNAKE_CASE__			=      ctc_zero_infinity

									# sequence classification
									SCREAMING_SNAKE_CASE__			=      use_weighted_layer_sum
									SCREAMING_SNAKE_CASE__			=      classifier_proj_size


							@property
							def      _snake_case  (							self    :Optional[int]		)   ->   List[str]:



									"""simple docstring"""



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






import inspect
import unittest




class   UpperCamelCase_       (     unittest.TestCase    ):


							def      _snake_case  (							self    :str		)   ->   Union[str, Any]:



									"""simple docstring"""



									try:
											import diffusers  # noqa: F401
									except ImportError:
											assert False


							def      _snake_case  (							self    :Any		)   ->   Any:



									"""simple docstring"""



									import diffusers
									from diffusers.dependency_versions_table import deps

									SCREAMING_SNAKE_CASE__			=      inspect.getmembers(__A							,				inspect.isclass		)

									for cls_name, cls_module in all_classes:
											if "dummy_" in cls_module.__module__:
													for backend in cls_module._backends:
															if backend == "k_diffusion":
																	SCREAMING_SNAKE_CASE__			=      """k-diffusion"""
															elif backend == "invisible_watermark":
																	SCREAMING_SNAKE_CASE__			=      """invisible-watermark"""
															assert backend in deps, f'''{backend} is not in the deps table!'''