

'''simple docstring'''





import functools
import operator

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


A_	= logging.get_logger(__name__)

A_	= {
    "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__    ):

		'''simple docstring'''






		SCREAMING_SNAKE_CASE_           =					'sew-d'
		def __init__(					self   ,			SCREAMING_SNAKE_CASE_=32   ,			SCREAMING_SNAKE_CASE_=768   ,			SCREAMING_SNAKE_CASE_=12   ,			SCREAMING_SNAKE_CASE_=12   ,			SCREAMING_SNAKE_CASE_=3072   ,			SCREAMING_SNAKE_CASE_=2   ,			SCREAMING_SNAKE_CASE_=512   ,			SCREAMING_SNAKE_CASE_=256   ,			SCREAMING_SNAKE_CASE_=True   ,			SCREAMING_SNAKE_CASE_=True   ,			SCREAMING_SNAKE_CASE_=("p2c", "c2p")   ,			SCREAMING_SNAKE_CASE_="layer_norm"   ,			SCREAMING_SNAKE_CASE_="gelu_python"   ,			SCREAMING_SNAKE_CASE_=0.1   ,			SCREAMING_SNAKE_CASE_=0.1   ,			SCREAMING_SNAKE_CASE_=0.1   ,			SCREAMING_SNAKE_CASE_=0.0   ,			SCREAMING_SNAKE_CASE_=0.1   ,			SCREAMING_SNAKE_CASE_=0.02   ,			SCREAMING_SNAKE_CASE_=1E-7   ,			SCREAMING_SNAKE_CASE_=1E-5   ,			SCREAMING_SNAKE_CASE_="group"   ,			SCREAMING_SNAKE_CASE_="gelu"   ,			SCREAMING_SNAKE_CASE_=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)   ,			SCREAMING_SNAKE_CASE_=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)   ,			SCREAMING_SNAKE_CASE_=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)   ,			SCREAMING_SNAKE_CASE_=False   ,			SCREAMING_SNAKE_CASE_=128   ,			SCREAMING_SNAKE_CASE_=16   ,			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_="mean"   ,			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_   ,			)  ->     Optional[int]:






							'''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_		)
							lowerCamelCase_  				=      hidden_size
							lowerCamelCase_  				=      feat_extract_norm
							lowerCamelCase_  				=      feat_extract_activation
							lowerCamelCase_  				=      list(SCREAMING_SNAKE_CASE_		)
							lowerCamelCase_  				=      list(SCREAMING_SNAKE_CASE_		)
							lowerCamelCase_  				=      list(SCREAMING_SNAKE_CASE_		)
							lowerCamelCase_  				=      conv_bias
							lowerCamelCase_  				=      num_conv_pos_embeddings
							lowerCamelCase_  				=      num_conv_pos_embedding_groups
							lowerCamelCase_  				=      len(self.conv_dim		)
							lowerCamelCase_  				=      num_hidden_layers
							lowerCamelCase_  				=      intermediate_size
							lowerCamelCase_  				=      squeeze_factor
							lowerCamelCase_  				=      max_position_embeddings
							lowerCamelCase_  				=      position_buckets
							lowerCamelCase_  				=      share_att_key
							lowerCamelCase_  				=      relative_attention
							lowerCamelCase_  				=      norm_rel_ebd
							lowerCamelCase_  				=      list(SCREAMING_SNAKE_CASE_		)
							lowerCamelCase_  				=      hidden_act
							lowerCamelCase_  				=      num_attention_heads
							lowerCamelCase_  				=      hidden_dropout
							lowerCamelCase_  				=      attention_dropout
							lowerCamelCase_  				=      activation_dropout
							lowerCamelCase_  				=      feat_proj_dropout
							lowerCamelCase_  				=      final_dropout
							lowerCamelCase_  				=      layer_norm_eps
							lowerCamelCase_  				=      feature_layer_norm_eps
							lowerCamelCase_  				=      initializer_range
							lowerCamelCase_  				=      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
							lowerCamelCase_  				=      apply_spec_augment
							lowerCamelCase_  				=      mask_time_prob
							lowerCamelCase_  				=      mask_time_length
							lowerCamelCase_  				=      mask_time_min_masks
							lowerCamelCase_  				=      mask_feature_prob
							lowerCamelCase_  				=      mask_feature_length
							lowerCamelCase_  				=      mask_feature_min_masks

							# ctc loss
							lowerCamelCase_  				=      ctc_loss_reduction
							lowerCamelCase_  				=      ctc_zero_infinity

							# sequence classification
							lowerCamelCase_  				=      use_weighted_layer_sum
							lowerCamelCase_  				=      classifier_proj_size






		@property
		def 			UpperCamelCase(					self		)  ->     List[Any]:






							'''simple docstring'''



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







import inspect
import unittest






class      UpperCamelCase(	unittest.TestCase ):


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Dict    )      ->						List[Any]:




											'''simple docstring'''

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






					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[int]    )      ->						Any:




											'''simple docstring'''

											import diffusers
											from diffusers.dependency_versions_table import deps

											__snake_case				=		inspect.getmembers(SCREAMING_SNAKE_CASE  ,     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":
																																			__snake_case				=		"k-diffusion"
																													elif backend == "invisible_watermark":
																																			__snake_case				=		"invisible-watermark"
																													assert backend in deps, f'''{backend} is not in the deps table!'''





