





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


a__      :     List[Any]         =		logging.get_logger(__name__)

a__      :     int         =		{
    '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 UpperCAmelCase_				( _SCREAMING_SNAKE_CASE ):
  __lowerCAmelCase   :						Dict							=   """donut-swin"""

  __lowerCAmelCase   :						Union[str, Any]							=   {
      """num_attention_heads""": """num_heads""",
      """num_hidden_layers""": """num_layers""",
  }


  def __init__(							self ,__snake_case=2_2_4 ,__snake_case=4 ,__snake_case=3 ,__snake_case=9_6 ,__snake_case=[2, 2, 6, 2] ,__snake_case=[3, 6, 1_2, 2_4] ,__snake_case=7 ,__snake_case=4.0 ,__snake_case=True ,__snake_case=0.0 ,__snake_case=0.0 ,__snake_case=0.1 ,__snake_case="gelu" ,__snake_case=False ,__snake_case=0.02 ,__snake_case=1E-5 ,**__snake_case ,):



       """simple docstring"""





       super().__init__(**__snake_case )

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










def      UpperCAmelCase_    (    _UpperCAmelCase							:Any  ,						_UpperCAmelCase							:Dict				)	->				Union[str, Any]:
     '''simple docstring'''


     A_          =       [1]
     for i in range(2  ,						_UpperCAmelCase				):
          factorials.append(factorials[-1] * i				)
     assert 0 <= k < factorials[-1] * n, "k out of bounds"

     A_          =       []
     A_          =       list(range(_UpperCAmelCase				)				)

     # Find permutation
     while factorials:
          A_          =       factorials.pop()
          A_   ,    A_          =       divmod(_UpperCAmelCase  ,						_UpperCAmelCase				)
          permutation.append(elements[number]				)
          elements.remove(elements[number]				)
     permutation.append(elements[0]				)

     return permutation


if __name__ == "__main__":
      import doctest

      doctest.testmod()



