



"""simple docstring"""

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


a_			   =					logging.get_logger(__name__)

a_			   =					{
    '''microsoft/trocr-base-handwritten''': (
        '''https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json'''
    ),
    # See all TrOCR models at https://huggingface.co/models?filter=trocr
}







class    __lowercase     (					_UpperCAmelCase):







						"""simple docstring"""







						_A		:							Optional[Any]							       =		"""trocr"""
						_A		:							Union[str, Any]							       =		["""past_key_values"""]
						_A		:							str							       =		{
						    """num_attention_heads""": """decoder_attention_heads""",
						    """hidden_size""": """d_model""",
						    """num_hidden_layers""": """decoder_layers""",
						}







						def __init__(self   ,		lowercase__=5_02_65   ,		lowercase__=10_24   ,		lowercase__=12   ,		lowercase__=16   ,		lowercase__=40_96   ,		lowercase__="gelu"   ,		lowercase__=5_12   ,		lowercase__=0.1   ,		lowercase__=0.0   ,		lowercase__=0.0   ,		lowercase__=2   ,		lowercase__=0.02   ,		lowercase__=0.0   ,		lowercase__=True   ,		lowercase__=False   ,		lowercase__=True   ,		lowercase__=True   ,		lowercase__=1   ,		lowercase__=0   ,		lowercase__=2   ,		**lowercase__   ,		):
											snake_case_					:		Union[str, Any] 					=					vocab_size
											snake_case_					:		int 					=					d_model
											snake_case_					:		Any 					=					decoder_layers
											snake_case_					:		str 					=					decoder_attention_heads
											snake_case_					:		Optional[Any] 					=					decoder_ffn_dim
											snake_case_					:		str 					=					activation_function
											snake_case_					:		Dict 					=					max_position_embeddings
											snake_case_					:		Dict 					=					dropout
											snake_case_					:		Optional[int] 					=					attention_dropout
											snake_case_					:		Dict 					=					activation_dropout
											snake_case_					:		Tuple 					=					init_std
											snake_case_					:		Optional[int] 					=					decoder_layerdrop
											snake_case_					:		Optional[int] 					=					use_cache
											snake_case_					:		Union[str, Any] 					=					scale_embedding
											snake_case_					:		Optional[Any] 					=					use_learned_position_embeddings
											snake_case_					:		Dict 					=					layernorm_embedding

											super().__init__(
											    pad_token_id=lowercase__   ,		bos_token_id=lowercase__   ,		eos_token_id=lowercase__   ,		decoder_start_token_id=lowercase__   ,		**lowercase__   ,		)









"""simple docstring"""

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

from ..features import Audio, Features, Value
from .base import TaskTemplate







@dataclass(frozen=_UpperCAmelCase)
class    __lowercase     (					_UpperCAmelCase):







						"""simple docstring"""







						_A		:							str							       =		field(default="""automatic-speech-recognition"""					,    metadata={"""include_in_asdict_even_if_is_default""": True})
						_A		:							ClassVar[Features]							       =		Features({"""audio""": Audio()})
						_A		:							ClassVar[Features]							       =		Features({"""transcription""": Value("""string""")})
						_A		:							str							       =		"audio"
						_A		:							str							       =		"transcription"







						def 						__UpperCamelCase							(self   ,		lowercase__       ):
											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]   ,		lowercase__       ):
																raise ValueError(f'Column {self.audio_column} is not an Audio type.'       )
											snake_case_					:		Optional[int] 					=					copy.deepcopy(self       )
											snake_case_					:		Tuple 					=					self.input_schema.copy()
											snake_case_					:		List[str] 					=					features[self.audio_column]
											snake_case_					:		Any 					=					input_schema
											return task_template







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




