



from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxSeqaSeqConfigWithPast
from ...utils import logging


_lowercase     							=						logging.get_logger(__name__)

_lowercase     							=						{
    '''google/umt5-small''': '''https://huggingface.co/google/umt5-small/resolve/main/config.json''',
    # See all umt5 models at https://huggingface.co/models?filter=umt5
}
class 				__A					( A_      ):
			UpperCamelCase					:Tuple     =			'''umt5'''
			UpperCamelCase					:List[Any]     =			['''past_key_values''']





			def __init__(self							,    __magic_name__=250112							,    __magic_name__=512							,    __magic_name__=64							,    __magic_name__=1024							,    __magic_name__=8							,    __magic_name__=None							,    __magic_name__=6							,    __magic_name__=32							,    __magic_name__=128							,    __magic_name__=0.1							,    __magic_name__=1E-6							,    __magic_name__=1.0							,    __magic_name__="gated-gelu"							,    __magic_name__=True							,    __magic_name__=True							,    __magic_name__="T5Tokenizer"							,    __magic_name__=True							,    __magic_name__=0							,    __magic_name__=1							,    __magic_name__=0							,    **__magic_name__							,    ):
						super().__init__(
						    is_encoder_decoder=__magic_name__							,    tokenizer_class=__magic_name__							,    tie_word_embeddings=__magic_name__							,    pad_token_id=__magic_name__							,    eos_token_id=__magic_name__							,    decoder_start_token_id=__magic_name__							,    **__magic_name__							,    )
						lowerCamelCase__ :      Optional[int]								=		vocab_size
						lowerCamelCase__ :      Dict								=		d_model
						lowerCamelCase__ :      Any								=		d_kv
						lowerCamelCase__ :      Optional[int]								=		d_ff
						lowerCamelCase__ :      List[str]								=		num_layers
						lowerCamelCase__ :      Any								=		(
						    num_decoder_layers if num_decoder_layers is not None else self.num_layers
						)  # default = symmetry
						lowerCamelCase__ :      List[str]								=		num_heads
						lowerCamelCase__ :      Tuple								=		relative_attention_num_buckets
						lowerCamelCase__ :      Union[str, Any]								=		relative_attention_max_distance
						lowerCamelCase__ :      str								=		dropout_rate
						lowerCamelCase__ :      List[str]								=		layer_norm_epsilon
						lowerCamelCase__ :      Tuple								=		initializer_factor
						lowerCamelCase__ :      Tuple								=		feed_forward_proj
						lowerCamelCase__ :      Dict								=		use_cache

						lowerCamelCase__ :      Dict								=		self.feed_forward_proj.split("""-"""				)
						lowerCamelCase__ :      List[str]								=		act_info[-1]
						lowerCamelCase__ :      Any								=		act_info[0] == """gated"""

						if len(__magic_name__				) > 1 and act_info[0] != "gated" or len(__magic_name__				) > 2:
									raise ValueError(
									    f"`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer."
									    """Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. """
									    """'gated-gelu' or 'relu'"""				)

						if feed_forward_proj == "gated-gelu":
									lowerCamelCase__ :      Optional[int]								=		"""gelu_new"""





			@property
			def        _snake_case    (self				):
						return self.d_model





			@property
			def        _snake_case    (self				):
						return self.num_heads





			@property
			def        _snake_case    (self				):
						return self.num_layers







class 				__A					( A_      ):





			@property
			# Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.inputs
			def        _snake_case    (self				):
						lowerCamelCase__ :      int								=		{
						    """input_ids""": {0: """batch""", 1: """encoder_sequence"""},
						    """attention_mask""": {0: """batch""", 1: """encoder_sequence"""},
						}
						if self.use_past:
									lowerCamelCase__ :      Optional[int]								=		"""past_encoder_sequence + sequence"""
									lowerCamelCase__ :      Optional[int]								=		{0: """batch"""}
									lowerCamelCase__ :      Tuple								=		{0: """batch""", 1: """past_decoder_sequence + sequence"""}
						else:
									lowerCamelCase__ :      Any								=		{0: """batch""", 1: """decoder_sequence"""}
									lowerCamelCase__ :      List[str]								=		{0: """batch""", 1: """decoder_sequence"""}

						if self.use_past:
									self.fill_with_past_key_values_(__magic_name__							,    direction="""inputs"""				)

						return common_inputs





			@property
			# Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.default_onnx_opset
			def        _snake_case    (self				):
						return 13





			@property
			def        _snake_case    (self				):
						return 5E-4








import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, Features, Value
from .base import TaskTemplate
@dataclass(frozen=A_      )
class 				__A					( A_      ):
			UpperCamelCase					:str     =			field(default='''automatic-speech-recognition'''					, metadata={'''include_in_asdict_even_if_is_default''': True}      )
			UpperCamelCase					:ClassVar[Features]     =			Features({'''audio''': Audio()}      )
			UpperCamelCase					:ClassVar[Features]     =			Features({'''transcription''': Value('''string'''      )}      )
			UpperCamelCase					:str     =			"audio"
			UpperCamelCase					:str     =			"transcription"





			def        _snake_case    (self							,    __magic_name__				):
						if self.audio_column not in features:
									raise ValueError(f"Column {self.audio_column} is not present in features."				)
						if not isinstance(features[self.audio_column]							,    __magic_name__				):
									raise ValueError(f"Column {self.audio_column} is not an Audio type."				)
						lowerCamelCase__ :      int								=		copy.deepcopy(self				)
						lowerCamelCase__ :      Tuple								=		self.input_schema.copy()
						lowerCamelCase__ :      Tuple								=		features[self.audio_column]
						lowerCamelCase__ :      List[str]								=		input_schema
						return task_template





			@property
			def        _snake_case    (self				):
						return {self.audio_column: "audio", self.transcription_column: "transcription"}



