





'''simple docstring'''




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


__SCREAMING_SNAKE_CASE     :Tuple       =				logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE     :List[str]       =				{
    '''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   A_	(  lowerCAmelCase_			):
 _lowerCamelCase  : int           =							"""trocr"""
 _lowerCamelCase  : List[str]           =							["""past_key_values"""]
 _lowerCamelCase  : int           =							{
     """num_attention_heads""": """decoder_attention_heads""",
     """hidden_size""": """d_model""",
     """num_hidden_layers""": """decoder_layers""",
 }




 def __init__(					self       :    Union[str, Any]	,			snake_case_       :    Dict=5_0_2_6_5	,			snake_case_       :    Dict=1_0_2_4	,			snake_case_       :    Optional[Any]=1_2	,			snake_case_       :    int=1_6	,			snake_case_       :    Tuple=4_0_9_6	,			snake_case_       :    List[Any]="gelu"	,			snake_case_       :    Dict=5_1_2	,			snake_case_       :    str=0.1	,			snake_case_       :    Optional[Any]=0.0	,			snake_case_       :    Optional[int]=0.0	,			snake_case_       :    List[str]=2	,			snake_case_       :    int=0.0_2	,			snake_case_       :    int=0.0	,			snake_case_       :    Union[str, Any]=True	,			snake_case_       :    str=False	,			snake_case_       :    Tuple=True	,			snake_case_       :    List[str]=True	,			snake_case_       :    Optional[int]=1	,			snake_case_       :    int=0	,			snake_case_       :    Dict=2	,			**snake_case_       :    List[Any]	,			):
      _UpperCAmelCase     							=   vocab_size
      _UpperCAmelCase     							=   d_model
      _UpperCAmelCase     							=   decoder_layers
      _UpperCAmelCase     							=   decoder_attention_heads
      _UpperCAmelCase     							=   decoder_ffn_dim
      _UpperCAmelCase     							=   activation_function
      _UpperCAmelCase     							=   max_position_embeddings
      _UpperCAmelCase     							=   dropout
      _UpperCAmelCase     							=   attention_dropout
      _UpperCAmelCase     							=   activation_dropout
      _UpperCAmelCase     							=   init_std
      _UpperCAmelCase     							=   decoder_layerdrop
      _UpperCAmelCase     							=   use_cache
      _UpperCAmelCase     							=   scale_embedding
      _UpperCAmelCase     							=   use_learned_position_embeddings
      _UpperCAmelCase     							=   layernorm_embedding

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











'''simple docstring'''
import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict
@pytest.mark.parametrize(
    'split_dict'				,  [
        SplitDict(),
        SplitDict({'train': SplitInfo(name='train'				,  num_bytes=1337				,  num_examples=42				,  dataset_name='my_dataset'     )}     ),
        SplitDict({'train': SplitInfo(name='train'				,  num_bytes=1337				,  num_examples=42     )}     ),
        SplitDict({'train': SplitInfo()}     ),
    ]				,  )
def 				lowercase__   (   __lowercase						:  SplitDict     ) ->      int:



       """simple docstring"""






       __UpperCamelCase       =  split_dict._to_yaml_list()
       assert len(__lowercase     ) == len(__lowercase     )
       __UpperCamelCase       =  SplitDict._from_yaml_list(__lowercase     )
       for split_name, split_info in split_dict.items():
              # dataset_name field is deprecated, and is therefore not part of the YAML dump
              __UpperCamelCase       =  None
              # the split name of split_dict takes over the name of the split info object
              __UpperCamelCase       =  split_name
       assert split_dict == reloaded


@pytest.mark.parametrize(
    'split_info'				,  [SplitInfo(), SplitInfo(dataset_name=__lowercase     ), SplitInfo(dataset_name='my_dataset'     )]     )
def 				lowercase__   (   __lowercase						:  Dict     ) ->      Any:



       """simple docstring"""






       __UpperCamelCase       =  asdict(SplitDict({'train': split_info}     )     )
       assert "dataset_name" in split_dict_asdict["train"]
       assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name
