



"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


A:   Tuple								=		logging.get_logger(__name__)

A:   Any								=		{
    "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json",
}



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__ ):
   __lowerCAmelCase  :   Union[str, Any]						=						'lxmert'
   __lowerCAmelCase  :   Dict						=						{}

   def __init__(   self      ,     _SCREAMING_SNAKE_CASE=30522      ,     _SCREAMING_SNAKE_CASE=768      ,     _SCREAMING_SNAKE_CASE=12      ,     _SCREAMING_SNAKE_CASE=9500      ,     _SCREAMING_SNAKE_CASE=1600      ,     _SCREAMING_SNAKE_CASE=400      ,     _SCREAMING_SNAKE_CASE=3072      ,     _SCREAMING_SNAKE_CASE="gelu"      ,     _SCREAMING_SNAKE_CASE=0.1      ,     _SCREAMING_SNAKE_CASE=0.1      ,     _SCREAMING_SNAKE_CASE=512      ,     _SCREAMING_SNAKE_CASE=2      ,     _SCREAMING_SNAKE_CASE=0.02      ,     _SCREAMING_SNAKE_CASE=1E-12      ,     _SCREAMING_SNAKE_CASE=9      ,     _SCREAMING_SNAKE_CASE=5      ,     _SCREAMING_SNAKE_CASE=5      ,     _SCREAMING_SNAKE_CASE=2048      ,     _SCREAMING_SNAKE_CASE=4      ,     _SCREAMING_SNAKE_CASE=6.67      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=True      ,     **_SCREAMING_SNAKE_CASE      ,     )  ->      str:





    '''simple docstring'''




    UpperCAmelCase	:					List[Any]	=	vocab_size
    UpperCAmelCase	:					Dict	=	hidden_size
    UpperCAmelCase	:					Any	=	num_attention_heads
    UpperCAmelCase	:					str	=	hidden_act
    UpperCAmelCase	:					Tuple	=	intermediate_size
    UpperCAmelCase	:					List[str]	=	hidden_dropout_prob
    UpperCAmelCase	:					Union[str, Any]	=	attention_probs_dropout_prob
    UpperCAmelCase	:					str	=	max_position_embeddings
    UpperCAmelCase	:					str	=	type_vocab_size
    UpperCAmelCase	:					Optional[Any]	=	initializer_range
    UpperCAmelCase	:					str	=	layer_norm_eps
    UpperCAmelCase	:					int	=	num_qa_labels
    UpperCAmelCase	:					Optional[Any]	=	num_object_labels
    UpperCAmelCase	:					List[str]	=	num_attr_labels
    UpperCAmelCase	:					Dict	=	l_layers
    UpperCAmelCase	:					Optional[int]	=	x_layers
    UpperCAmelCase	:					Optional[Any]	=	r_layers
    UpperCAmelCase	:					int	=	visual_feat_dim
    UpperCAmelCase	:					Tuple	=	visual_pos_dim
    UpperCAmelCase	:					str	=	visual_loss_normalizer
    UpperCAmelCase	:					int	=	task_matched
    UpperCAmelCase	:					Dict	=	task_mask_lm
    UpperCAmelCase	:					Union[str, Any]	=	task_obj_predict
    UpperCAmelCase	:					str	=	task_qa
    UpperCAmelCase	:					List[str]	=	visual_obj_loss
    UpperCAmelCase	:					str	=	visual_attr_loss
    UpperCAmelCase	:					Tuple	=	visual_feat_loss
    UpperCAmelCase	:					Any	=	{"""vision""": r_layers, """cross_encoder""": x_layers, """language""": l_layers}
    super().__init__(**_SCREAMING_SNAKE_CASE						)






import os
import unittest

from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer

from ...test_tokenization_common import TokenizerTesterMixin







class __snake_case			(			a ,  unittest.TestCase		):
   UpperCAmelCase__  :    Any          =  PhobertTokenizer
   UpperCAmelCase__  :    List[str]          =  False







   def lowerCamelCase						(      self		:						str):

        """simple docstring"""


        super().setUp()

        # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
        UpperCAmelCase_          =							['''T@@''', '''i''', '''I''', '''R@@''', '''r''', '''e@@''']
        UpperCAmelCase_          =							dict(zip(_snake_case					,						range(len(_snake_case))))
        UpperCAmelCase_          =							['''#version: 0.2''', '''l à</w>''']
        UpperCAmelCase_          =							{'''unk_token''': '''<unk>'''}

        UpperCAmelCase_          =							os.path.join(self.tmpdirname					,						VOCAB_FILES_NAMES['''vocab_file'''])
        UpperCAmelCase_          =							os.path.join(self.tmpdirname					,						VOCAB_FILES_NAMES['''merges_file'''])

        with open(self.vocab_file					,						'''w'''					,						encoding='''utf-8''') as fp:
             for token in vocab_tokens:
                  fp.write(F"""{token} {vocab_tokens[token]}\n""")
        with open(self.merges_file					,						'''w'''					,						encoding='''utf-8''') as fp:
             fp.write('''\n'''.join(_snake_case))







   def lowerCamelCase						(      self		:						int					,						**_snake_case		:						Any):

        """simple docstring"""


        kwargs.update(self.special_tokens_map)
        return PhobertTokenizer.from_pretrained(self.tmpdirname					,						**_snake_case)







   def lowerCamelCase						(      self		:						Optional[Any]					,						_snake_case		:						Union[str, Any]):

        """simple docstring"""


        UpperCAmelCase_          =							'''Tôi là VinAI Research'''
        UpperCAmelCase_          =							'''T<unk> i <unk> <unk> <unk> <unk> <unk> <unk> I Re<unk> e<unk> <unk> <unk> <unk>'''
        return input_text, output_text







   def lowerCamelCase						(      self		:						List[str]):

        """simple docstring"""


        UpperCAmelCase_          =							PhobertTokenizer(self.vocab_file					,						self.merges_file					,						**self.special_tokens_map)
        UpperCAmelCase_          =							'''Tôi là VinAI Research'''
        UpperCAmelCase_          =							'''T@@ ô@@ i l@@ à V@@ i@@ n@@ A@@ I R@@ e@@ s@@ e@@ a@@ r@@ c@@ h'''.split()
        UpperCAmelCase_          =							tokenizer.tokenize(_snake_case)
        print(_snake_case)
        self.assertListEqual(_snake_case					,						_snake_case)

        UpperCAmelCase_          =							tokens + [tokenizer.unk_token]

        UpperCAmelCase_          =							[4, 3, 5, 3, 3, 3, 3, 3, 3, 6, 7, 9, 3, 9, 3, 3, 3, 3, 3]
        self.assertListEqual(tokenizer.convert_tokens_to_ids(_snake_case)					,						_snake_case)






