





"""simple docstring"""




from collections import OrderedDict
from typing import Mapping

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


UpperCamelCase_           =logging.get_logger(__name__)

UpperCamelCase_           ={
    """flaubert/flaubert_small_cased""": """https://huggingface.co/flaubert/flaubert_small_cased/resolve/main/config.json""",
    """flaubert/flaubert_base_uncased""": """https://huggingface.co/flaubert/flaubert_base_uncased/resolve/main/config.json""",
    """flaubert/flaubert_base_cased""": """https://huggingface.co/flaubert/flaubert_base_cased/resolve/main/config.json""",
    """flaubert/flaubert_large_cased""": """https://huggingface.co/flaubert/flaubert_large_cased/resolve/main/config.json""",
}




class  _a						(      _lowerCAmelCase				):
				UpperCamelCase								=    '''flaubert'''
				UpperCamelCase								=    {
				    '''hidden_size''': '''emb_dim''',
				    '''num_attention_heads''': '''n_heads''',
				    '''num_hidden_layers''': '''n_layers''',
				    '''n_words''': '''vocab_size''',  # For backward compatibility
				}






				def __init__( self		:    Union[str, Any], lowerCAmelCase__		:    List[str]=False, lowerCAmelCase__		:    Optional[Any]=0.0, lowerCAmelCase__		:    Dict=3_0_1_4_5, lowerCAmelCase__		:    Optional[Any]=2_0_4_8, lowerCAmelCase__		:    Tuple=1_2, lowerCAmelCase__		:    Union[str, Any]=1_6, lowerCAmelCase__		:    int=0.1, lowerCAmelCase__		:    Any=0.1, lowerCAmelCase__		:    Union[str, Any]=True, lowerCAmelCase__		:    List[Any]=False, lowerCAmelCase__		:    str=False, lowerCAmelCase__		:    Tuple=False, lowerCAmelCase__		:    List[Any]=1, lowerCAmelCase__		:    int=True, lowerCAmelCase__		:    str=5_1_2, lowerCAmelCase__		:    str=2_0_4_8**-0.5, lowerCAmelCase__		:    Dict=1e-1_2, lowerCAmelCase__		:    Optional[int]=0.02, lowerCAmelCase__		:    Optional[Any]=0, lowerCAmelCase__		:    List[str]=1, lowerCAmelCase__		:    str=2, lowerCAmelCase__		:    str=3, lowerCAmelCase__		:    Optional[int]=5, lowerCAmelCase__		:    List[str]=True, lowerCAmelCase__		:    Dict="first", lowerCAmelCase__		:    Union[str, Any]=True, lowerCAmelCase__		:    List[Any]=None, lowerCAmelCase__		:    Optional[int]=True, lowerCAmelCase__		:    List[Any]=0.1, lowerCAmelCase__		:    Optional[Any]=5, lowerCAmelCase__		:    Optional[int]=5, lowerCAmelCase__		:    List[str]=0, lowerCAmelCase__		:    Optional[int]=0, lowerCAmelCase__		:    str=2, lowerCAmelCase__		:    Optional[int]=0, **lowerCAmelCase__		:    Optional[Any], )	->      Union[str, Any]:




										'''simple docstring'''



										_UpperCamelCase			:					List[str]     =    pre_norm
										_UpperCamelCase			:					Any     =    layerdrop
										_UpperCamelCase			:					Optional[int]     =    vocab_size
										_UpperCamelCase			:					Optional[Any]     =    emb_dim
										_UpperCamelCase			:					Optional[int]     =    n_layers
										_UpperCamelCase			:					int     =    n_heads
										_UpperCamelCase			:					Tuple     =    dropout
										_UpperCamelCase			:					str     =    attention_dropout
										_UpperCamelCase			:					Optional[int]     =    gelu_activation
										_UpperCamelCase			:					Dict     =    sinusoidal_embeddings
										_UpperCamelCase			:					Tuple     =    causal
										_UpperCamelCase			:					Any     =    asm
										_UpperCamelCase			:					int     =    n_langs
										_UpperCamelCase			:					Dict     =    use_lang_emb
										_UpperCamelCase			:					Union[str, Any]     =    layer_norm_eps
										_UpperCamelCase			:					str     =    bos_index
										_UpperCamelCase			:					Dict     =    eos_index
										_UpperCamelCase			:					Dict     =    pad_index
										_UpperCamelCase			:					Optional[Any]     =    unk_index
										_UpperCamelCase			:					int     =    mask_index
										_UpperCamelCase			:					str     =    is_encoder
										_UpperCamelCase			:					int     =    max_position_embeddings
										_UpperCamelCase			:					Dict     =    embed_init_std
										_UpperCamelCase			:					Any     =    init_std
										_UpperCamelCase			:					Any     =    summary_type
										_UpperCamelCase			:					List[str]     =    summary_use_proj
										_UpperCamelCase			:					Tuple     =    summary_activation
										_UpperCamelCase			:					Optional[int]     =    summary_proj_to_labels
										_UpperCamelCase			:					int     =    summary_first_dropout
										_UpperCamelCase			:					List[str]     =    start_n_top
										_UpperCamelCase			:					Optional[Any]     =    end_n_top
										_UpperCamelCase			:					Any     =    mask_token_id
										_UpperCamelCase			:					str     =    lang_id

										if "n_words" in kwargs:
																_UpperCamelCase			:					Tuple     =    kwargs['''n_words''']

										super().__init__(pad_token_id=lowerCAmelCase__, bos_token_id=lowerCAmelCase__, **lowerCAmelCase__							)




class  _a						(      _lowerCAmelCase				):






				@property
				def 				snake_case	( self		:    Any							)	->      Mapping[str, Mapping[int, str]]:




										'''simple docstring'''



										if self.task == "multiple-choice":
																_UpperCamelCase			:					List[str]     =    {0: '''batch''', 1: '''choice''', 2: '''sequence'''}
										else:
																_UpperCamelCase			:					List[Any]     =    {0: '''batch''', 1: '''sequence'''}
										return OrderedDict(
										    [
										        ('''input_ids''', dynamic_axis),
										        ('''attention_mask''', dynamic_axis),
										    ]							)






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


UpperCamelCase__     :					Dict								=			{
    "configuration_donut_swin": ["DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP", "DonutSwinConfig"],
    "processing_donut": ["DonutProcessor"],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCamelCase__     :					Optional[int]								=			[
           "DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST",
           "DonutSwinModel",
           "DonutSwinPreTrainedModel",
       ]

try:
       if not is_vision_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCamelCase__     :					List[Any]								=			["DonutFeatureExtractor"]
       UpperCamelCase__     :					Dict								=			["DonutImageProcessor"]


if TYPE_CHECKING:
       from .configuration_donut_swin import DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP, DonutSwinConfig
       from .processing_donut import DonutProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_donut_swin import (
                  DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST,
                  DonutSwinModel,
                  DonutSwinPreTrainedModel,
              )

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .feature_extraction_donut import DonutFeatureExtractor
              from .image_processing_donut import DonutImageProcessor

else:
       import sys

       UpperCamelCase__     :					Tuple								=			_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


