

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


lowercase_   							=  logging.get_logger(__name__)

lowercase_   							=  {
    """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	(   _UpperCAmelCase				):
  _a		     =    'donut-swin'

  _a		     =    {
      '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				,  )    ->					List[str]:
        '''simple docstring'''






        super().__init__(**SCREAMING_SNAKE_CASE_   )

        _lowercase      			=image_size
        _lowercase      			=patch_size
        _lowercase      			=num_channels
        _lowercase      			=embed_dim
        _lowercase      			=depths
        _lowercase      			=len(SCREAMING_SNAKE_CASE_   )
        _lowercase      			=num_heads
        _lowercase      			=window_size
        _lowercase      			=mlp_ratio
        _lowercase      			=qkv_bias
        _lowercase      			=hidden_dropout_prob
        _lowercase      			=attention_probs_dropout_prob
        _lowercase      			=drop_path_rate
        _lowercase      			=hidden_act
        _lowercase      			=use_absolute_embeddings
        _lowercase      			=layer_norm_eps
        _lowercase      			=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
        _lowercase      			=int(embed_dim * 2 ** (len(SCREAMING_SNAKE_CASE_   ) - 1)   )






'''simple docstring'''



from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

A__						:   Dict				=    [
    """python""",
    """tqdm""",
    """regex""",
    """requests""",
    """packaging""",
    """filelock""",
    """numpy""",
    """tokenizers""",
    """huggingface-hub""",
    """safetensors""",
    """accelerate""",
    """pyyaml""",
]

for pkg in pkgs_to_check_at_runtime:
      if pkg in deps:
            if pkg == "tokenizers":
                  # must be loaded here, or else tqdm check may fail
                  from .utils import is_tokenizers_available

                  if not is_tokenizers_available():
                        continue  # not required, check version only if installed
            elif pkg == "accelerate":
                  # must be loaded here, or else tqdm check may fail
                  from .utils import is_accelerate_available

                  # Maybe switch to is_torch_available in the future here so that Accelerate is hard dep of
                  # Transformers with PyTorch
                  if not is_accelerate_available():
                        continue  # not required, check version only if installed

            require_version_core(deps[pkg])
      else:
            raise ValueError(f'''can\'t find {pkg} in {deps.keys()}, check dependency_versions_table.py''')



def      UpperCAmelCase__   (      UpperCAmelCase_       :							List[Any] ,       UpperCAmelCase_       :							List[Any]=None				)	->						List[Any]:
     require_version(deps[pkg] ,       UpperCAmelCase_				)






