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


__lowercase							 =					logging.get_logger(__name__)

__lowercase							 =					{
    '''google/realm-cc-news-pretrained-embedder''': (
        '''https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/config.json'''
    ),
    '''google/realm-cc-news-pretrained-encoder''': (
        '''https://huggingface.co/google/realm-cc-news-pretrained-encoder/resolve/main/config.json'''
    ),
    '''google/realm-cc-news-pretrained-scorer''': (
        '''https://huggingface.co/google/realm-cc-news-pretrained-scorer/resolve/main/config.json'''
    ),
    '''google/realm-cc-news-pretrained-openqa''': (
        '''https://huggingface.co/google/realm-cc-news-pretrained-openqa/aresolve/main/config.json'''
    ),
    '''google/realm-orqa-nq-openqa''': '''https://huggingface.co/google/realm-orqa-nq-openqa/resolve/main/config.json''',
    '''google/realm-orqa-nq-reader''': '''https://huggingface.co/google/realm-orqa-nq-reader/resolve/main/config.json''',
    '''google/realm-orqa-wq-openqa''': '''https://huggingface.co/google/realm-orqa-wq-openqa/resolve/main/config.json''',
    '''google/realm-orqa-wq-reader''': '''https://huggingface.co/google/realm-orqa-wq-reader/resolve/main/config.json''',
    # See all REALM models at https://huggingface.co/models?filter=realm
}


class 	lowerCamelCase_     (   UpperCAmelCase_ ):






    '''simple docstring'''






    a__	:						Any						=      """realm"""







    def __init__(	self , __lowercase=30_522 , __lowercase=768 , __lowercase=128 , __lowercase=12 , __lowercase=12 , __lowercase=8 , __lowercase=3_072 , __lowercase="gelu_new" , __lowercase=0.1 , __lowercase=0.1 , __lowercase=512 , __lowercase=2 , __lowercase=0.02 , __lowercase=1E-1_2 , __lowercase=256 , __lowercase=10 , __lowercase=1E-3 , __lowercase=5 , __lowercase=320 , __lowercase=13_353_718 , __lowercase=5_000 , __lowercase=1 , __lowercase=0 , __lowercase=2 , **__lowercase , )       ->	Tuple:
        super().__init__(pad_token_id=__lowercase , bos_token_id=__lowercase , eos_token_id=__lowercase , **__lowercase)

        # Common config
        __UpperCamelCase     :Union[str, Any]			  =		vocab_size
        __UpperCamelCase     :int			  =		max_position_embeddings
        __UpperCamelCase     :List[Any]			  =		hidden_size
        __UpperCamelCase     :List[str]			  =		retriever_proj_size
        __UpperCamelCase     :int			  =		num_hidden_layers
        __UpperCamelCase     :str			  =		num_attention_heads
        __UpperCamelCase     :List[str]			  =		num_candidates
        __UpperCamelCase     :List[Any]			  =		intermediate_size
        __UpperCamelCase     :List[str]			  =		hidden_act
        __UpperCamelCase     :List[Any]			  =		hidden_dropout_prob
        __UpperCamelCase     :int			  =		attention_probs_dropout_prob
        __UpperCamelCase     :List[Any]			  =		initializer_range
        __UpperCamelCase     :Dict			  =		type_vocab_size
        __UpperCamelCase     :List[str]			  =		layer_norm_eps

        # Reader config
        __UpperCamelCase     :List[Any]			  =		span_hidden_size
        __UpperCamelCase     :int			  =		max_span_width
        __UpperCamelCase     :List[str]			  =		reader_layer_norm_eps
        __UpperCamelCase     :Optional[int]			  =		reader_beam_size
        __UpperCamelCase     :Optional[Any]			  =		reader_seq_len

        # Retrieval config
        __UpperCamelCase     :str			  =		num_block_records
        __UpperCamelCase     :Any			  =		searcher_beam_size






"""simple docstring"""






import os
import sys
import unittest


lowerCAmelCase__  :  Tuple						     =	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,
)


lowerCAmelCase__  :  Tuple						     =	os.path.join('tests', 'models', 'bert', 'test_modeling_bert.py')
lowerCAmelCase__  :  Optional[Any]						     =	os.path.join('tests', 'models', 'blip', 'test_modeling_blip.py')
class 				snake_case       ( unittest.TestCase				):




					"""simple docstring"""

					def 		__lowerCAmelCase						(				self   :	List[str]			):
									UpperCAmelCase__             =							get_test_to_tester_mapping(lowerCamelCase__			)
									UpperCAmelCase__             =							get_test_to_tester_mapping(lowerCamelCase__			)

									UpperCAmelCase__             =							{'BertModelTest': 'BertModelTester'}

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

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







					def 		__lowerCAmelCase						(				self   :	Optional[Any]			):
									UpperCAmelCase__             =							get_model_to_test_mapping(lowerCamelCase__			)
									UpperCAmelCase__             =							get_model_to_test_mapping(lowerCamelCase__			)

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

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

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







					def 		__lowerCAmelCase						(				self   :	int			):
									UpperCAmelCase__             =							get_model_to_tester_mapping(lowerCamelCase__			)
									UpperCAmelCase__             =							get_model_to_tester_mapping(lowerCamelCase__			)

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

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

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



