



from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


a_								=    logging.get_logger(__name__)

a_								=    {
    'xlm-mlm-en-2048': 'https://huggingface.co/xlm-mlm-en-2048/resolve/main/config.json',
    'xlm-mlm-ende-1024': 'https://huggingface.co/xlm-mlm-ende-1024/resolve/main/config.json',
    'xlm-mlm-enfr-1024': 'https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/config.json',
    'xlm-mlm-enro-1024': 'https://huggingface.co/xlm-mlm-enro-1024/resolve/main/config.json',
    'xlm-mlm-tlm-xnli15-1024': 'https://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/config.json',
    'xlm-mlm-xnli15-1024': 'https://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/config.json',
    'xlm-clm-enfr-1024': 'https://huggingface.co/xlm-clm-enfr-1024/resolve/main/config.json',
    'xlm-clm-ende-1024': 'https://huggingface.co/xlm-clm-ende-1024/resolve/main/config.json',
    'xlm-mlm-17-1280': 'https://huggingface.co/xlm-mlm-17-1280/resolve/main/config.json',
    'xlm-mlm-100-1280': 'https://huggingface.co/xlm-mlm-100-1280/resolve/main/config.json',
}



class        __lowerCAmelCase   (		lowercase_      ):
 lowerCAmelCase__				    =     """xlm"""
 lowerCAmelCase__				    =     {
     """hidden_size""": """emb_dim""",
     """num_attention_heads""": """n_heads""",
     """num_hidden_layers""": """n_layers""",
     """n_words""": """vocab_size""",  # For backward compatibility
 }




 def __init__(  self		, __UpperCAmelCase=30145		, __UpperCAmelCase=2048		, __UpperCAmelCase=12		, __UpperCAmelCase=16		, __UpperCAmelCase=0.1		, __UpperCAmelCase=0.1		, __UpperCAmelCase=True		, __UpperCAmelCase=False		, __UpperCAmelCase=False		, __UpperCAmelCase=False		, __UpperCAmelCase=1		, __UpperCAmelCase=True		, __UpperCAmelCase=512		, __UpperCAmelCase=2048**-0.5		, __UpperCAmelCase=1E-1_2		, __UpperCAmelCase=0.02		, __UpperCAmelCase=0		, __UpperCAmelCase=1		, __UpperCAmelCase=2		, __UpperCAmelCase=3		, __UpperCAmelCase=5		, __UpperCAmelCase=True		, __UpperCAmelCase="first"		, __UpperCAmelCase=True		, __UpperCAmelCase=None		, __UpperCAmelCase=True		, __UpperCAmelCase=0.1		, __UpperCAmelCase=5		, __UpperCAmelCase=5		, __UpperCAmelCase=0		, __UpperCAmelCase=0		, __UpperCAmelCase=2		, __UpperCAmelCase=0		, **__UpperCAmelCase		, ):



    '''simple docstring'''
    __lowerCamelCase  							=			vocab_size
    __lowerCamelCase  							=			emb_dim
    __lowerCamelCase  							=			n_layers
    __lowerCamelCase  							=			n_heads
    __lowerCamelCase  							=			dropout
    __lowerCamelCase  							=			attention_dropout
    __lowerCamelCase  							=			gelu_activation
    __lowerCamelCase  							=			sinusoidal_embeddings
    __lowerCamelCase  							=			causal
    __lowerCamelCase  							=			asm
    __lowerCamelCase  							=			n_langs
    __lowerCamelCase  							=			use_lang_emb
    __lowerCamelCase  							=			layer_norm_eps
    __lowerCamelCase  							=			bos_index
    __lowerCamelCase  							=			eos_index
    __lowerCamelCase  							=			pad_index
    __lowerCamelCase  							=			unk_index
    __lowerCamelCase  							=			mask_index
    __lowerCamelCase  							=			is_encoder
    __lowerCamelCase  							=			max_position_embeddings
    __lowerCamelCase  							=			embed_init_std
    __lowerCamelCase  							=			init_std
    __lowerCamelCase  							=			summary_type
    __lowerCamelCase  							=			summary_use_proj
    __lowerCamelCase  							=			summary_activation
    __lowerCamelCase  							=			summary_proj_to_labels
    __lowerCamelCase  							=			summary_first_dropout
    __lowerCamelCase  							=			start_n_top
    __lowerCamelCase  							=			end_n_top
    __lowerCamelCase  							=			mask_token_id
    __lowerCamelCase  							=			lang_id

    if "n_words" in kwargs:
       __lowerCamelCase  							=			kwargs['''n_words''']

    super().__init__(pad_token_id=__UpperCAmelCase		, bos_token_id=__UpperCAmelCase		, **__UpperCAmelCase )



class        __lowerCAmelCase   (		lowercase_      ):




 @property
 def 				lowerCamelCase					(  self ):



    '''simple docstring'''







    if self.task == "multiple-choice":
       __lowerCamelCase  							=			{0: '''batch''', 1: '''choice''', 2: '''sequence'''}
    else:
       __lowerCamelCase  							=			{0: '''batch''', 1: '''sequence'''}
    return OrderedDict(
        [
            ('''input_ids''', dynamic_axis),
            ('''attention_mask''', dynamic_axis),
            ('''token_type_ids''', dynamic_axis),
        ] )










'''simple docstring'''

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


lowerCamelCase							:   int  						=	logging.get_logger(__name__)

lowerCamelCase							:   List[Any]  						=	{
    '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						(lowercase_     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Optional[int]  					=							"""realm"""



      def __init__(self    :    str   ,						UpperCamelCase    :    List[Any]=30522   ,						UpperCamelCase    :    List[Any]=768   ,						UpperCamelCase    :    int=128   ,						UpperCamelCase    :    Any=12   ,						UpperCamelCase    :    Tuple=12   ,						UpperCamelCase    :    List[Any]=8   ,						UpperCamelCase    :    Union[str, Any]=3072   ,						UpperCamelCase    :    List[str]="gelu_new"   ,						UpperCamelCase    :    Any=0.1   ,						UpperCamelCase    :    List[str]=0.1   ,						UpperCamelCase    :    Dict=512   ,						UpperCamelCase    :    Dict=2   ,						UpperCamelCase    :    List[Any]=0.02   ,						UpperCamelCase    :    List[Any]=1E-12   ,						UpperCamelCase    :    Dict=256   ,						UpperCamelCase    :    Union[str, Any]=10   ,						UpperCamelCase    :    Optional[int]=1E-3   ,						UpperCamelCase    :    Tuple=5   ,						UpperCamelCase    :    Optional[int]=320   ,						UpperCamelCase    :    List[str]=13353718   ,						UpperCamelCase    :    Optional[Any]=5000   ,						UpperCamelCase    :    str=1   ,						UpperCamelCase    :    Union[str, Any]=0   ,						UpperCamelCase    :    List[Any]=2   ,						**UpperCamelCase    :    int   ,						):

             '''simple docstring'''







             super().__init__(pad_token_id=UpperCamelCase   ,						bos_token_id=UpperCamelCase   ,						eos_token_id=UpperCamelCase   ,						**UpperCamelCase )

             # Common config
             lowercase__      			= vocab_size
             lowercase__      			= max_position_embeddings
             lowercase__      			= hidden_size
             lowercase__      			= retriever_proj_size
             lowercase__      			= num_hidden_layers
             lowercase__      			= num_attention_heads
             lowercase__      			= num_candidates
             lowercase__      			= intermediate_size
             lowercase__      			= hidden_act
             lowercase__      			= hidden_dropout_prob
             lowercase__      			= attention_probs_dropout_prob
             lowercase__      			= initializer_range
             lowercase__      			= type_vocab_size
             lowercase__      			= layer_norm_eps

             # Reader config
             lowercase__      			= span_hidden_size
             lowercase__      			= max_span_width
             lowercase__      			= reader_layer_norm_eps
             lowercase__      			= reader_beam_size
             lowercase__      			= reader_seq_len

             # Retrieval config
             lowercase__      			= num_block_records
             lowercase__      			= searcher_beam_size




