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


SCREAMING_SNAKE_CASE			:						Union[str, Any]				  =		logging.get_logger(__name__)

SCREAMING_SNAKE_CASE			:						Tuple				  =		{
    """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  A_			(							__snake_case			):
  _SCREAMING_SNAKE_CASE     					=      'donut-swin'

  _SCREAMING_SNAKE_CASE     					=      {
      'num_attention_heads': 'num_heads',
      'num_hidden_layers': 'num_layers',
  }

  def __init__(		self			:   Optional[Any]  ,				__SCREAMING_SNAKE_CASE			:   Dict=2_24  ,				__SCREAMING_SNAKE_CASE			:   List[Any]=4  ,				__SCREAMING_SNAKE_CASE			:   int=3  ,				__SCREAMING_SNAKE_CASE			:   List[Any]=96  ,				__SCREAMING_SNAKE_CASE			:   Optional[Any]=[2, 2, 6, 2]  ,				__SCREAMING_SNAKE_CASE			:   str=[3, 6, 12, 24]  ,				__SCREAMING_SNAKE_CASE			:   Tuple=7  ,				__SCREAMING_SNAKE_CASE			:   Optional[Any]=4.0  ,				__SCREAMING_SNAKE_CASE			:   Any=True  ,				__SCREAMING_SNAKE_CASE			:   str=0.0  ,				__SCREAMING_SNAKE_CASE			:   Union[str, Any]=0.0  ,				__SCREAMING_SNAKE_CASE			:   Any=0.1  ,				__SCREAMING_SNAKE_CASE			:   int="gelu"  ,				__SCREAMING_SNAKE_CASE			:   List[Any]=False  ,				__SCREAMING_SNAKE_CASE			:   Union[str, Any]=0.02  ,				__SCREAMING_SNAKE_CASE			:   Optional[Any]=1E-5  ,				**__SCREAMING_SNAKE_CASE			:   Tuple  ,				):
   super().__init__(**A_							)

   __a							=	image_size
   __a							=	patch_size
   __a							=	num_channels
   __a							=	embed_dim
   __a							=	depths
   __a							=	len(A_							)
   __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(A_							) - 1)							)









def 						A_							(	_lowerCAmelCase				,  _lowerCAmelCase	)		->					Optional[int]:
 UpperCamelCase      :   List[Any]			      =  [1]
 for i in range(2				,  _lowerCAmelCase	):
  factorials.append(factorials[-1] * i	)
 assert 0 <= k < factorials[-1] * n, "k out of bounds"

 UpperCamelCase      :   Tuple			      =  []
 UpperCamelCase      :   str			      =  list(range(_lowerCAmelCase	)	)

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

 return permutation


if __name__ == "__main__":
    import doctest

    doctest.testmod()
