


"""simple docstring"""







import functools
import operator

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


a__       :							Dict        =  logging.get_logger(__name__)

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




class 				UpperCamelCase_			(				__a):

	"""simple docstring"""





	snake_case__       :						Tuple					      =    '''sew'''




	def __init__(				self    :       Optional[Any]    ,    UpperCAmelCase__    :       Dict=3_2    ,    UpperCAmelCase__    :       Optional[Any]=7_6_8    ,    UpperCAmelCase__    :       Union[str, Any]=1_2    ,    UpperCAmelCase__    :       List[str]=1_2    ,    UpperCAmelCase__    :       List[Any]=3_0_7_2    ,    UpperCAmelCase__    :       Union[str, Any]=2    ,    UpperCAmelCase__    :       Union[str, Any]="gelu"    ,    UpperCAmelCase__    :       Optional[int]=0.1    ,    UpperCAmelCase__    :       Tuple=0.1    ,    UpperCAmelCase__    :       Optional[Any]=0.1    ,    UpperCAmelCase__    :       List[str]=0.0    ,    UpperCAmelCase__    :       Union[str, Any]=0.1    ,    UpperCAmelCase__    :       Dict=0.1    ,    UpperCAmelCase__    :       int=0.02    ,    UpperCAmelCase__    :       Any=1E-5    ,    UpperCAmelCase__    :       Optional[Any]="group"    ,    UpperCAmelCase__    :       Optional[Any]="gelu"    ,    UpperCAmelCase__    :       Dict=(6_4, 1_2_8, 1_2_8, 1_2_8, 1_2_8, 2_5_6, 2_5_6, 2_5_6, 2_5_6, 5_1_2, 5_1_2, 5_1_2, 5_1_2)    ,    UpperCAmelCase__    :       Tuple=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)    ,    UpperCAmelCase__    :       Dict=(1_0, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)    ,    UpperCAmelCase__    :       str=False    ,    UpperCAmelCase__    :       Optional[Any]=1_2_8    ,    UpperCAmelCase__    :       Optional[Any]=1_6    ,    UpperCAmelCase__    :       Any=True    ,    UpperCAmelCase__    :       int=0.05    ,    UpperCAmelCase__    :       int=1_0    ,    UpperCAmelCase__    :       Optional[Any]=2    ,    UpperCAmelCase__    :       Optional[int]=0.0    ,    UpperCAmelCase__    :       Union[str, Any]=1_0    ,    UpperCAmelCase__    :       Dict=0    ,    UpperCAmelCase__    :       List[Any]="mean"    ,    UpperCAmelCase__    :       Tuple=False    ,    UpperCAmelCase__    :       Tuple=False    ,    UpperCAmelCase__    :       str=2_5_6    ,    UpperCAmelCase__    :       Optional[Any]=0    ,    UpperCAmelCase__    :       List[str]=1    ,    UpperCAmelCase__    :       int=2    ,    **UpperCAmelCase__    :       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		     =       squeeze_factor
		__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

		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 						UpperCAmelCase_   (				self    :       Union[str, Any]     ) ->			List[Any]:
		return functools.reduce(operator.mul    ,    self.conv_stride    ,    1     )




"""simple docstring"""







import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available
from . import BaseDiffusersCLICommand




def      UpperCAmelCase__ (lowerCAmelCase_     ):




					'''simple docstring'''


					return EnvironmentCommand()




class 				UpperCamelCase_			(				UpperCamelCase):

	"""simple docstring"""





	@staticmethod
	def 						UpperCAmelCase_   (				UpperCAmelCase__    :       ArgumentParser     ) ->			Optional[Any]:
						__SCREAMING_SNAKE_CASE		     =       parser.add_parser("env"     )
						download_parser.set_defaults(func=UpperCAmelCase__     )




	def 						UpperCAmelCase_   (				self    :       List[Any]     ) ->			List[str]:
						__SCREAMING_SNAKE_CASE		     =       huggingface_hub.__version__

						__SCREAMING_SNAKE_CASE		     =       "not installed"
						__SCREAMING_SNAKE_CASE		     =       "NA"
						if is_torch_available():
											import torch

											__SCREAMING_SNAKE_CASE		     =       torch.__version__
											__SCREAMING_SNAKE_CASE		     =       torch.cuda.is_available()

						__SCREAMING_SNAKE_CASE		     =       "not installed"
						if is_transformers_available():
											import transformers

											__SCREAMING_SNAKE_CASE		     =       transformers.__version__

						__SCREAMING_SNAKE_CASE		     =       "not installed"
						if is_accelerate_available():
											import accelerate

											__SCREAMING_SNAKE_CASE		     =       accelerate.__version__

						__SCREAMING_SNAKE_CASE		     =       "not installed"
						if is_xformers_available():
											import xformers

											__SCREAMING_SNAKE_CASE		     =       xformers.__version__

						__SCREAMING_SNAKE_CASE		     =       {
						    "`diffusers` version": version,
						    "Platform": platform.platform(),
						    "Python version": platform.python_version(),
						    "PyTorch version (GPU?)": F"""{pt_version} ({pt_cuda_available})""",
						    "Huggingface_hub version": hub_version,
						    "Transformers version": transformers_version,
						    "Accelerate version": accelerate_version,
						    "xFormers version": xformers_version,
						    "Using GPU in script?": "<fill in>",
						    "Using distributed or parallel set-up in script?": "<fill in>",
						}

						print("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n"     )
						print(self.format_dict(UpperCAmelCase__     )     )

						return info




	@staticmethod
	def 						UpperCAmelCase_   (				UpperCAmelCase__    :       Optional[Any]     ) ->			str:
						return "\n".join([F"""- {prop}: {val}""" for prop, val in d.items()]     ) + "\n"
