
"""simple docstring"""







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


lowercase_         =       logging.get_logger(__name__)

lowercase_         =       {
    "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 		UpperCAmelCase_						(lowerCamelCase_    ):
 """simple docstring"""




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




 def __init__(			self							:			Any  , a_							:			Any=5_02_65  , a_							:			Optional[int]=10_24  , a_							:			Dict=12  , a_							:			Tuple=16  , a_							:			str=40_96  , a_							:			List[Any]="gelu"  , a_							:			Dict=5_12  , a_							:			List[Any]=0.1  , a_							:			List[str]=0.0  , a_							:			List[str]=0.0  , a_							:			List[Any]=2  , a_							:			Optional[Any]=0.02  , a_							:			int=0.0  , a_							:			List[Any]=True  , a_							:			Optional[int]=False  , a_							:			Optional[int]=True  , a_							:			List[str]=True  , a_							:			Any=1  , a_							:			Dict=0  , a_							:			Optional[Any]=2  , **a_							:			Tuple  , )->       Any:



      """simple docstring"""

      UpperCAmelCase_    :     int            =	vocab_size
      UpperCAmelCase_    :     Dict            =	d_model
      UpperCAmelCase_    :     Optional[int]            =	decoder_layers
      UpperCAmelCase_    :     Optional[Any]            =	decoder_attention_heads
      UpperCAmelCase_    :     Optional[Any]            =	decoder_ffn_dim
      UpperCAmelCase_    :     int            =	activation_function
      UpperCAmelCase_    :     Tuple            =	max_position_embeddings
      UpperCAmelCase_    :     Any            =	dropout
      UpperCAmelCase_    :     Tuple            =	attention_dropout
      UpperCAmelCase_    :     str            =	activation_dropout
      UpperCAmelCase_    :     Optional[int]            =	init_std
      UpperCAmelCase_    :     List[str]            =	decoder_layerdrop
      UpperCAmelCase_    :     Union[str, Any]            =	use_cache
      UpperCAmelCase_    :     List[Any]            =	scale_embedding
      UpperCAmelCase_    :     str            =	use_learned_position_embeddings
      UpperCAmelCase_    :     Optional[int]            =	layernorm_embedding

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



"""simple docstring"""







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

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



@dataclass(frozen=lowerCamelCase_    )
class 		UpperCAmelCase_						(lowerCamelCase_    ):
 """simple docstring"""




 UpperCamelCase_    :  str					 =     field(default="""audio-classification"""	,			metadata={"""include_in_asdict_even_if_is_default""": True}    )
 UpperCamelCase_    :  ClassVar[Features]					 =     Features({"""audio""": Audio()}    )
 UpperCamelCase_    :  ClassVar[Features]					 =     Features({"""labels""": ClassLabel}    )
 UpperCamelCase_    :  str					 =     "audio"
 UpperCamelCase_    :  str					 =     "labels"




 def 	a   (			self							:			List[str]  , a_							:			Union[str, Any]			)->       Optional[int]:



      """simple docstring"""

      if self.label_column not in features:
           raise ValueError(f'''Column {self.label_column} is not present in features.'''			)
      if not isinstance(features[self.label_column]  , a_			):
           raise ValueError(f'''Column {self.label_column} is not a ClassLabel.'''			)
      UpperCAmelCase_    :     Any            =	copy.deepcopy(self			)
      UpperCAmelCase_    :     List[str]            =	self.label_schema.copy()
      UpperCAmelCase_    :     List[str]            =	features[self.label_column]
      UpperCAmelCase_    :     Optional[Any]            =	label_schema
      return task_template






 @property
 def 	a   (			self							:			Optional[Any]			)->       Dict[str, str]:



      """simple docstring"""

      return {
          self.audio_column: "audio",
          self.label_column: "labels",
      }

