


import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ....tokenization_utils_fast import PreTrainedTokenizerFast
from ....utils import logging
from .tokenization_retribert import RetriBertTokenizer


snake_case							:	List[Any]					      =				logging.get_logger(__name__)

snake_case							:	Dict					      =				{'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

snake_case							:	List[Any]					      =				{
    '''vocab_file''': {
        '''yjernite/retribert-base-uncased''': (
            '''https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/vocab.txt'''
        ),
    },
    '''tokenizer_file''': {
        '''yjernite/retribert-base-uncased''': (
            '''https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/tokenizer.json'''
        ),
    },
}

snake_case							:	Optional[Any]					      =				{
    '''yjernite/retribert-base-uncased''': 5_12,
}


snake_case							:	str					      =				{
    '''yjernite/retribert-base-uncased''': {'''do_lower_case''': True},
}







class 	snake_case_       (lowerCamelCase_				):
					UpperCAmelCase__ :   Optional[int]   				=      VOCAB_FILES_NAMES
					UpperCAmelCase__ :   Optional[int]   				=      PRETRAINED_VOCAB_FILES_MAP
					UpperCAmelCase__ :   List[str]   				=      PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
					UpperCAmelCase__ :   Any   				=      PRETRAINED_INIT_CONFIGURATION
					UpperCAmelCase__ :   Dict   				=      RetriBertTokenizer
					UpperCAmelCase__ :   Union[str, Any]   				=      ['''input_ids''', '''attention_mask''']
					def __init__(				self       :Optional[Any]      ,__snake_case       :List[Any]=None      ,__snake_case       :Optional[int]=None      ,__snake_case       :Tuple=True      ,__snake_case       :str="[UNK]"      ,__snake_case       :str="[SEP]"      ,__snake_case       :Tuple="[PAD]"      ,__snake_case       :int="[CLS]"      ,__snake_case       :Tuple="[MASK]"      ,__snake_case       :Optional[int]=True      ,__snake_case       :Union[str, Any]=None      ,**__snake_case       :Any      ,) ->   Optional[Any]:
												super().__init__(
												    __snake_case      ,tokenizer_file=__snake_case      ,do_lower_case=__snake_case      ,unk_token=__snake_case      ,sep_token=__snake_case      ,pad_token=__snake_case      ,cls_token=__snake_case      ,mask_token=__snake_case      ,tokenize_chinese_chars=__snake_case      ,strip_accents=__snake_case      ,**__snake_case      ,)

												a__					=					json.loads(self.backend_tokenizer.normalizer.__getstate__()				)
												if (
												    normalizer_state.get('lowercase'      ,__snake_case				) != do_lower_case
												    or normalizer_state.get('strip_accents'      ,__snake_case				) != strip_accents
												    or normalizer_state.get('handle_chinese_chars'      ,__snake_case				) != tokenize_chinese_chars
												):
																			a__					=					getattr(__snake_case      ,normalizer_state.pop('type'				)				)
																			a__					=					do_lower_case
																			a__					=					strip_accents
																			a__					=					tokenize_chinese_chars
																			a__					=					normalizer_class(**__snake_case				)

												a__					=					do_lower_case
					def 			lowerCamelCase__(				self       :List[Any]      ,__snake_case       :Optional[int]      ,__snake_case       :Union[str, Any]=None				) ->   int:
												a__					=					[self.cls_token_id] + token_ids_a + [self.sep_token_id]

												if token_ids_a:
																			output += token_ids_a + [self.sep_token_id]

												return output
					def 			lowerCamelCase__(				self       :str      ,__snake_case       :List[int]      ,__snake_case       :Optional[List[int]] = None				) ->   List[int]:
												a__					=					[self.sep_token_id]
												a__					=					[self.cls_token_id]
												if token_ids_a is None:
																			return len(cls + token_ids_a + sep				) * [0]
												return len(cls + token_ids_a + sep				) * [0] + len(token_ids_a + sep				) * [1]



					def 			lowerCamelCase__(				self       :List[Any]      ,__snake_case       :str      ,__snake_case       :Optional[str] = None				) ->   Tuple[str]:
												a__					=					self._tokenizer.model.save(__snake_case      ,name=__snake_case				)
												return tuple(__snake_case				)








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


snake_case							:	Optional[int]					      =				logging.get_logger(__name__)

snake_case							:	Union[str, Any]					      =				{
    '''uclanlp/visualbert-vqa''': '''https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json''',
    '''uclanlp/visualbert-vqa-pre''': '''https://huggingface.co/uclanlp/visualbert-vqa-pre/resolve/main/config.json''',
    '''uclanlp/visualbert-vqa-coco-pre''': (
        '''https://huggingface.co/uclanlp/visualbert-vqa-coco-pre/resolve/main/config.json'''
    ),
    '''uclanlp/visualbert-vcr''': '''https://huggingface.co/uclanlp/visualbert-vcr/resolve/main/config.json''',
    '''uclanlp/visualbert-vcr-pre''': '''https://huggingface.co/uclanlp/visualbert-vcr-pre/resolve/main/config.json''',
    '''uclanlp/visualbert-vcr-coco-pre''': (
        '''https://huggingface.co/uclanlp/visualbert-vcr-coco-pre/resolve/main/config.json'''
    ),
    '''uclanlp/visualbert-nlvr2''': '''https://huggingface.co/uclanlp/visualbert-nlvr2/resolve/main/config.json''',
    '''uclanlp/visualbert-nlvr2-pre''': '''https://huggingface.co/uclanlp/visualbert-nlvr2-pre/resolve/main/config.json''',
    '''uclanlp/visualbert-nlvr2-coco-pre''': (
        '''https://huggingface.co/uclanlp/visualbert-nlvr2-coco-pre/resolve/main/config.json'''
    )
    # See all VisualBERT models at https://huggingface.co/models?filter=visual_bert
}







class 	snake_case_       (lowerCamelCase_				):
					UpperCAmelCase__ :   Dict   				=      '''visual_bert'''
					def __init__(				self       :Optional[int]      ,__snake_case       :Any=3_05_22      ,__snake_case       :str=7_68      ,__snake_case       :Any=5_12      ,__snake_case       :Any=12      ,__snake_case       :int=12      ,__snake_case       :str=30_72      ,__snake_case       :int="gelu"      ,__snake_case       :Optional[int]=0.1      ,__snake_case       :str=0.1      ,__snake_case       :Union[str, Any]=5_12      ,__snake_case       :Tuple=2      ,__snake_case       :Union[str, Any]=0.02      ,__snake_case       :Optional[Any]=1E-12      ,__snake_case       :Optional[Any]=False      ,__snake_case       :int=True      ,__snake_case       :Any=1      ,__snake_case       :Optional[int]=0      ,__snake_case       :Tuple=2      ,**__snake_case       :Any      ,) ->   Union[str, Any]:
												super().__init__(pad_token_id=__snake_case      ,bos_token_id=__snake_case      ,eos_token_id=__snake_case      ,**__snake_case				)

												a__					=					vocab_size
												a__					=					max_position_embeddings
												a__					=					hidden_size
												a__					=					visual_embedding_dim
												a__					=					num_hidden_layers
												a__					=					num_attention_heads
												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
												a__					=					bypass_transformer
												a__					=					special_visual_initialize




