
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 		UpperCamelCase__  (	__lowercase   ):
   _SCREAMING_SNAKE_CASE				:							int     	=				"donut-swin"

   _SCREAMING_SNAKE_CASE				:							Dict     	=				{
       "num_attention_heads": "num_heads",
       "num_hidden_layers": "num_layers",
   }
   def __init__(self			: Optional[int] ,    snake_case_			: Tuple=2_2_4 ,    snake_case_			: Any=4 ,    snake_case_			: Optional[Any]=3 ,    snake_case_			: Optional[Any]=9_6 ,    snake_case_			: str=[2, 2, 6, 2] ,    snake_case_			: Optional[Any]=[3, 6, 1_2, 2_4] ,    snake_case_			: Optional[int]=7 ,    snake_case_			: List[str]=4.0 ,    snake_case_			: Optional[int]=True ,    snake_case_			: str=0.0 ,    snake_case_			: int=0.0 ,    snake_case_			: Union[str, Any]=0.1 ,    snake_case_			: Tuple="gelu" ,    snake_case_			: Optional[Any]=False ,    snake_case_			: Tuple=0.02 ,    snake_case_			: List[Any]=1E-5 ,    **snake_case_			: Optional[Any] ,    ):
    super().__init__(**snake_case_       )

    __a			:  Optional[int]		    =  image_size
    __a			:  Tuple		    =  patch_size
    __a			:  Tuple		    =  num_channels
    __a			:  List[Any]		    =  embed_dim
    __a			:  List[Any]		    =  depths
    __a			:  Dict		    =  len(snake_case_       )
    __a			:  Union[str, Any]		    =  num_heads
    __a			:  Optional[Any]		    =  window_size
    __a			:  Dict		    =  mlp_ratio
    __a			:  Dict		    =  qkv_bias
    __a			:  List[str]		    =  hidden_dropout_prob
    __a			:  Any		    =  attention_probs_dropout_prob
    __a			:  Dict		    =  drop_path_rate
    __a			:  int		    =  hidden_act
    __a			:  Any		    =  use_absolute_embeddings
    __a			:  Optional[Any]		    =  layer_norm_eps
    __a			:  str		    =  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			:  str		    =  int(embed_dim * 2 ** (len(snake_case_       ) - 1)       )


import os
import sys
import unittest


lowercase__          =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, 'utils'))

import get_test_info  # noqa: E402
from get_test_info import (  # noqa: E402
    get_model_to_test_mapping,
    get_model_to_tester_mapping,
    get_test_to_tester_mapping,
)


lowercase__          =os.path.join('tests', 'models', 'bert', 'test_modeling_bert.py')
lowercase__          =os.path.join('tests', 'models', 'blip', 'test_modeling_blip.py')



class 		UpperCamelCase__  (	unittest.TestCase   ):
   def 				lowerCAmelCase      (self			: List[Any]       ):
    __a			:  str		    =  get_test_to_tester_mapping(snake_case_       )
    __a			:  Tuple		    =  get_test_to_tester_mapping(snake_case_       )

    __a			:  Union[str, Any]		    =  {'''BertModelTest''': '''BertModelTester'''}

    __a			:  Tuple		    =  {
        '''BlipModelTest''': '''BlipModelTester''',
        '''BlipTextImageModelTest''': '''BlipTextImageModelsModelTester''',
        '''BlipTextModelTest''': '''BlipTextModelTester''',
        '''BlipTextRetrievalModelTest''': '''BlipTextRetrievalModelTester''',
        '''BlipVQAModelTest''': '''BlipVQAModelTester''',
        '''BlipVisionModelTest''': '''BlipVisionModelTester''',
    }

    self.assertEqual(get_test_info.to_json(snake_case_       ) ,    snake_case_       )
    self.assertEqual(get_test_info.to_json(snake_case_       ) ,    snake_case_       )
   def 				lowerCAmelCase      (self			: str       ):
    __a			:  Optional[int]		    =  get_model_to_test_mapping(snake_case_       )
    __a			:  Any		    =  get_model_to_test_mapping(snake_case_       )

    __a			:  List[Any]		    =  {
        '''BertForMaskedLM''': ['''BertModelTest'''],
        '''BertForMultipleChoice''': ['''BertModelTest'''],
        '''BertForNextSentencePrediction''': ['''BertModelTest'''],
        '''BertForPreTraining''': ['''BertModelTest'''],
        '''BertForQuestionAnswering''': ['''BertModelTest'''],
        '''BertForSequenceClassification''': ['''BertModelTest'''],
        '''BertForTokenClassification''': ['''BertModelTest'''],
        '''BertLMHeadModel''': ['''BertModelTest'''],
        '''BertModel''': ['''BertModelTest'''],
    }

    __a			:  Dict		    =  {
        '''BlipForConditionalGeneration''': ['''BlipTextImageModelTest'''],
        '''BlipForImageTextRetrieval''': ['''BlipTextRetrievalModelTest'''],
        '''BlipForQuestionAnswering''': ['''BlipVQAModelTest'''],
        '''BlipModel''': ['''BlipModelTest'''],
        '''BlipTextModel''': ['''BlipTextModelTest'''],
        '''BlipVisionModel''': ['''BlipVisionModelTest'''],
    }

    self.assertEqual(get_test_info.to_json(snake_case_       ) ,    snake_case_       )
    self.assertEqual(get_test_info.to_json(snake_case_       ) ,    snake_case_       )







   def 				lowerCAmelCase      (self			: int       ):
    __a			:  Any		    =  get_model_to_tester_mapping(snake_case_       )
    __a			:  List[str]		    =  get_model_to_tester_mapping(snake_case_       )

    __a			:  Any		    =  {
        '''BertForMaskedLM''': ['''BertModelTester'''],
        '''BertForMultipleChoice''': ['''BertModelTester'''],
        '''BertForNextSentencePrediction''': ['''BertModelTester'''],
        '''BertForPreTraining''': ['''BertModelTester'''],
        '''BertForQuestionAnswering''': ['''BertModelTester'''],
        '''BertForSequenceClassification''': ['''BertModelTester'''],
        '''BertForTokenClassification''': ['''BertModelTester'''],
        '''BertLMHeadModel''': ['''BertModelTester'''],
        '''BertModel''': ['''BertModelTester'''],
    }

    __a			:  int		    =  {
        '''BlipForConditionalGeneration''': ['''BlipTextImageModelsModelTester'''],
        '''BlipForImageTextRetrieval''': ['''BlipTextRetrievalModelTester'''],
        '''BlipForQuestionAnswering''': ['''BlipVQAModelTester'''],
        '''BlipModel''': ['''BlipModelTester'''],
        '''BlipTextModel''': ['''BlipTextModelTester'''],
        '''BlipVisionModel''': ['''BlipVisionModelTester'''],
    }

    self.assertEqual(get_test_info.to_json(snake_case_       ) ,    snake_case_       )
    self.assertEqual(get_test_info.to_json(snake_case_       ) ,    snake_case_       )
