


from typing import Mapping

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


_lowerCAmelCase:						Optional[int]   				=       logging.get_logger(__name__)

_lowerCAmelCase:						Any   				=       {
    't5-small': 'https://huggingface.co/t5-small/resolve/main/config.json',
    't5-base': 'https://huggingface.co/t5-base/resolve/main/config.json',
    't5-large': 'https://huggingface.co/t5-large/resolve/main/config.json',
    't5-3b': 'https://huggingface.co/t5-3b/resolve/main/config.json',
    't5-11b': 'https://huggingface.co/t5-11b/resolve/main/config.json',
}




class       lowercase_					(lowercase__   ):
				snake_case	    ='t5'
				snake_case	    =['past_key_values']
				snake_case	    ={'hidden_size': 'd_model', 'num_attention_heads': 'num_heads', 'num_hidden_layers': 'num_layers'}





				def __init__(				self       ,  lowercase_=32128       ,  lowercase_=512       ,  lowercase_=64       ,  lowercase_=2048       ,  lowercase_=6       ,  lowercase_=None       ,  lowercase_=8       ,  lowercase_=32       ,  lowercase_=128       ,  lowercase_=0.1       ,  lowercase_=1e-6       ,  lowercase_=1.0       ,  lowercase_="relu"       ,  lowercase_=True       ,  lowercase_=True       ,  lowercase_=0       ,  lowercase_=1       ,  **lowercase_       ,  )  -> Optional[Any]:
											a__      =vocab_size
											a__      =d_model
											a__      =d_kv
											a__      =d_ff
											a__      =num_layers
											a__      =(
											    num_decoder_layers if num_decoder_layers is not None else self.num_layers
											)  # default = symmetry
											a__      =num_heads
											a__      =relative_attention_num_buckets
											a__      =relative_attention_max_distance
											a__      =dropout_rate
											a__      =layer_norm_epsilon
											a__      =initializer_factor
											a__      =feed_forward_proj
											a__      =use_cache

											a__      =self.feed_forward_proj.split('-')
											a__      =act_info[-1]
											a__      =act_info[0] == 'gated'

											if len(lowercase_) > 1 and act_info[0] != "gated" or len(lowercase_) > 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\'')

											# for backwards compatibility
											if feed_forward_proj == "gated-gelu":
																		a__      ='gelu_new'

											super().__init__(
											    pad_token_id=lowercase_       ,  eos_token_id=lowercase_       ,  is_encoder_decoder=lowercase_       ,  **lowercase_       ,  )







class       lowercase_					(lowercase__   ):





				@property
				def 						__UpperCamelCase    (				self)  -> Mapping[str, Mapping[int, str]]:
											a__      ={
											    'input_ids': {0: 'batch', 1: 'encoder_sequence'},
											    'attention_mask': {0: 'batch', 1: 'encoder_sequence'},
											}
											if self.use_past:
																		a__      ='past_encoder_sequence + sequence'
																		a__      ={0: 'batch'}
																		a__      ={0: 'batch', 1: 'past_decoder_sequence + sequence'}
											else:
																		a__      ={0: 'batch', 1: 'decoder_sequence'}
																		a__      ={0: 'batch', 1: 'decoder_sequence'}

											if self.use_past:
																		self.fill_with_past_key_values_(lowercase_       ,  direction='inputs')

											return common_inputs





				@property
				def 						__UpperCamelCase    (				self)  -> int:
											return 13





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

from ..features import Audio, Features, Value
from .base import TaskTemplate
@dataclass(frozen=lowerCAmelCase__					)
class 						lowerCamelCase_							(					lowerCAmelCase__					):



					'''simple docstring'''







					__UpperCAmelCase							  =					field(default="automatic-speech-recognition"  ,  metadata={"include_in_asdict_even_if_is_default": True}					)
					__UpperCAmelCase							  =					Features({"audio": Audio()}					)
					__UpperCAmelCase							  =					Features({"transcription": Value("string"					)}					)
					__UpperCAmelCase							  =					"audio"
					__UpperCAmelCase							  =					"transcription"






					def A   (					self			,							snake_case_    ) ->      Any:







								'''simple docstring'''

								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]			,							snake_case_    ):
											raise ValueError(F'Column {self.audio_column} is not an Audio type.'    )
								__lowercase			       = copy.deepcopy(self    )
								__lowercase			       = self.input_schema.copy()
								__lowercase			       = features[self.audio_column]
								__lowercase			       = input_schema
								return task_template






					@property
					def A   (					self    ) ->      Dict[str, str]:







								'''simple docstring'''

								return {self.audio_column: "audio", self.transcription_column: "transcription"}


