





'''simple docstring'''


import os
import sys

_SCREAMING_SNAKE_CASE									=				os.path.join(os.path.dirname(__file__), "src")
sys.path.append(SRC_DIR)


from transformers import (
    AutoConfig,
    AutoModel,
    AutoModelForCausalLM,
    AutoModelForMaskedLM,
    AutoModelForQuestionAnswering,
    AutoModelForSequenceClassification,
    AutoTokenizer,
    add_start_docstrings,
)


_SCREAMING_SNAKE_CASE									=				[
    "torch",
    "numpy",
    "tokenizers",
    "filelock",
    "requests",
    "tqdm",
    "regex",
    "sentencepiece",
    "sacremoses",
    "importlib_metadata",
    "huggingface_hub",
]


@add_start_docstrings(AutoConfig.__doc__     )
def 						__a(*SCREAMING_SNAKE_CASE_	:       List[Any]		,							**SCREAMING_SNAKE_CASE_	:       str     ):



    '''simple docstring'''





    return AutoConfig.from_pretrained(*SCREAMING_SNAKE_CASE_		,							**SCREAMING_SNAKE_CASE_     )


@add_start_docstrings(AutoTokenizer.__doc__     )
def 						__a(*SCREAMING_SNAKE_CASE_	:       int		,							**SCREAMING_SNAKE_CASE_	:       List[str]     ):



    '''simple docstring'''





    return AutoTokenizer.from_pretrained(*SCREAMING_SNAKE_CASE_		,							**SCREAMING_SNAKE_CASE_     )


@add_start_docstrings(AutoModel.__doc__     )
def 						__a(*SCREAMING_SNAKE_CASE_	:       Tuple		,							**SCREAMING_SNAKE_CASE_	:       int     ):



    '''simple docstring'''





    return AutoModel.from_pretrained(*SCREAMING_SNAKE_CASE_		,							**SCREAMING_SNAKE_CASE_     )


@add_start_docstrings(AutoModelForCausalLM.__doc__     )
def 						__a(*SCREAMING_SNAKE_CASE_	:       str		,							**SCREAMING_SNAKE_CASE_	:       Dict     ):



    '''simple docstring'''





    return AutoModelForCausalLM.from_pretrained(*SCREAMING_SNAKE_CASE_		,							**SCREAMING_SNAKE_CASE_     )


@add_start_docstrings(AutoModelForMaskedLM.__doc__     )
def 						__a(*SCREAMING_SNAKE_CASE_	:       List[Any]		,							**SCREAMING_SNAKE_CASE_	:       str     ):



    '''simple docstring'''





    return AutoModelForMaskedLM.from_pretrained(*SCREAMING_SNAKE_CASE_		,							**SCREAMING_SNAKE_CASE_     )


@add_start_docstrings(AutoModelForSequenceClassification.__doc__     )
def 						__a(*SCREAMING_SNAKE_CASE_	:       Union[str, Any]		,							**SCREAMING_SNAKE_CASE_	:       Tuple     ):



    '''simple docstring'''





    return AutoModelForSequenceClassification.from_pretrained(*SCREAMING_SNAKE_CASE_		,							**SCREAMING_SNAKE_CASE_     )





@add_start_docstrings(AutoModelForQuestionAnswering.__doc__     )
def 						__a(*SCREAMING_SNAKE_CASE_	:       Tuple		,							**SCREAMING_SNAKE_CASE_	:       Optional[int]     ):



    '''simple docstring'''





    return AutoModelForQuestionAnswering.from_pretrained(*SCREAMING_SNAKE_CASE_		,							**SCREAMING_SNAKE_CASE_     )









'''simple docstring'''


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


_SCREAMING_SNAKE_CASE									=				logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE									=				{
    "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json",
    # See all Donut models at https://huggingface.co/models?filter=donut-swin
}

class  lowerCAmelCase_		(		__magic_name__		):
 __lowerCamelCase    :				Union[str, Any]								=       "donut-swin"

 __lowerCamelCase    :				int								=       {
     "num_attention_heads": "num_heads",
     "num_hidden_layers": "num_layers",
 }




 def __init__(						self      ,  _lowerCAmelCase=224      ,  _lowerCAmelCase=4      ,  _lowerCAmelCase=3      ,  _lowerCAmelCase=96      ,  _lowerCAmelCase=[2, 2, 6, 2]      ,  _lowerCAmelCase=[3, 6, 12, 24]      ,  _lowerCAmelCase=7      ,  _lowerCAmelCase=4.0      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=0.0      ,  _lowerCAmelCase=0.0      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase="gelu"      ,  _lowerCAmelCase=False      ,  _lowerCAmelCase=0.02      ,  _lowerCAmelCase=1E-5      ,  **_lowerCAmelCase      ,  )     ->				Optional[Any]:
     super().__init__(**_lowerCAmelCase		)

     _lowerCAmelCase						      =   image_size
     _lowerCAmelCase						      =   patch_size
     _lowerCAmelCase						      =   num_channels
     _lowerCAmelCase						      =   embed_dim
     _lowerCAmelCase						      =   depths
     _lowerCAmelCase						      =   len(_lowerCAmelCase		)
     _lowerCAmelCase						      =   num_heads
     _lowerCAmelCase						      =   window_size
     _lowerCAmelCase						      =   mlp_ratio
     _lowerCAmelCase						      =   qkv_bias
     _lowerCAmelCase						      =   hidden_dropout_prob
     _lowerCAmelCase						      =   attention_probs_dropout_prob
     _lowerCAmelCase						      =   drop_path_rate
     _lowerCAmelCase						      =   hidden_act
     _lowerCAmelCase						      =   use_absolute_embeddings
     _lowerCAmelCase						      =   layer_norm_eps
     _lowerCAmelCase						      =   initializer_range
     # we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
     # this indicates the channel dimension after the last stage of the model
     _lowerCAmelCase						      =   int(embed_dim * 2 ** (len(_lowerCAmelCase		) - 1)		)


