



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


UpperCAmelCase_		 =					logging.get_logger(__name__)

UpperCAmelCase_		 =					{
    """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__	(       _A):



 """simple docstring"""

 a__					: str =  "realm"

 def __init__(    self					:					List[Any]			,						__lowerCAmelCase					:					List[Any]=3_05_22			,						__lowerCAmelCase					:					List[str]=7_68			,						__lowerCAmelCase					:					str=1_28			,						__lowerCAmelCase					:					List[str]=12			,						__lowerCAmelCase					:					str=12			,						__lowerCAmelCase					:					Union[str, Any]=8			,						__lowerCAmelCase					:					Tuple=30_72			,						__lowerCAmelCase					:					Optional[int]="gelu_new"			,						__lowerCAmelCase					:					Any=0.1			,						__lowerCAmelCase					:					Any=0.1			,						__lowerCAmelCase					:					List[str]=5_12			,						__lowerCAmelCase					:					str=2			,						__lowerCAmelCase					:					Any=0.02			,						__lowerCAmelCase					:					str=1E-12			,						__lowerCAmelCase					:					Tuple=2_56			,						__lowerCAmelCase					:					List[str]=10			,						__lowerCAmelCase					:					Union[str, Any]=1E-3			,						__lowerCAmelCase					:					Optional[Any]=5			,						__lowerCAmelCase					:					List[Any]=3_20			,						__lowerCAmelCase					:					Any=13_35_37_18			,						__lowerCAmelCase					:					Tuple=50_00			,						__lowerCAmelCase					:					str=1			,						__lowerCAmelCase					:					List[str]=0			,						__lowerCAmelCase					:					Union[str, Any]=2			,						**__lowerCAmelCase					:					Dict			,						)   ->	int:
    super().__init__(pad_token_id=__lowerCAmelCase			,						bos_token_id=__lowerCAmelCase			,						eos_token_id=__lowerCAmelCase			,						**__lowerCAmelCase      )

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

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

    # Retrieval config
    _A      =       num_block_records
    _A      =       searcher_beam_size







def       a_ (       SCREAMING_SNAKE_CASE__   : bytes	):
       '''simple docstring'''





       return "".join([hex(SCREAMING_SNAKE_CASE__	)[2:].zfill(2	).upper() for byte in list(SCREAMING_SNAKE_CASE__	)]	)




def       a_ (       SCREAMING_SNAKE_CASE__   : str	):
       '''simple docstring'''





       if (len(SCREAMING_SNAKE_CASE__	) % 2) != 0:
              raise ValueError(
                  'Base16 encoded data is invalid:\nData does not have an even number of hex digits.'	)
       # Check the character set - the standard base16 alphabet
       # is uppercase according to RFC3548 section 6
       if not set(SCREAMING_SNAKE_CASE__	) <= set('0123456789ABCDEF'	):
              raise ValueError(
                  'Base16 encoded data is invalid:\nData is not uppercase hex or it contains invalid characters.'	)
       # For every two hexadecimal digits (= a byte), turn it into an integer.
       # Then, string the result together into bytes, and return it.
       return bytes(int(data[i] + data[i + 1]						,     16	) for i in range(0						,     len(SCREAMING_SNAKE_CASE__	)						,     2	)	)


if __name__ == "__main__":
 import doctest

 doctest.testmod()


