



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


lowerCAmelCase__						:	Any					={'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

lowerCAmelCase__						:	Optional[Any]					={
    '''vocab_file''': {
        '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt''',
    },
    '''tokenizer_file''': {
        '''unc-nlp/lxmert-base-uncased''': (
            '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json'''
        ),
    },
}

lowerCAmelCase__						:	int					={
    '''unc-nlp/lxmert-base-uncased''': 512,
}

lowerCAmelCase__						:	str					={
    '''unc-nlp/lxmert-base-uncased''': {'''do_lower_case''': True},
}

class   UpperCAmelCase_    (  UpperCamelCase_			):

						'''simple docstring'''




						UpperCamelCase__     :					Optional[Any]							    =    VOCAB_FILES_NAMES
						UpperCamelCase__     :					List[str]							    =    PRETRAINED_VOCAB_FILES_MAP
						UpperCamelCase__     :					Optional[int]							    =    PRETRAINED_INIT_CONFIGURATION
						UpperCamelCase__     :					str							    =    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
						UpperCamelCase__     :					Dict							    =    LxmertTokenizer






						def __init__(       self ,				_A=None ,				_A=None ,				_A=True ,				_A="[UNK]" ,				_A="[SEP]" ,				_A="[PAD]" ,				_A="[CLS]" ,				_A="[MASK]" ,				_A=True ,				_A=None ,				**_A ,				):







													'''simple docstring'''

													super().__init__(
													    a_ ,				tokenizer_file=a_ ,				do_lower_case=a_ ,				unk_token=a_ ,				sep_token=a_ ,				pad_token=a_ ,				cls_token=a_ ,				mask_token=a_ ,				tokenize_chinese_chars=a_ ,				strip_accents=a_ ,				**a_ ,				)

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

													__SCREAMING_SNAKE_CASE										=   do_lower_case






						def 			_A      (       self ,				_A ,				_A=None						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   [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 			_A      (       self ,				_A ,				_A = None						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   [self.sep_token_id]
													__SCREAMING_SNAKE_CASE										=   [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 			_A      (       self ,				_A ,				_A = None						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   self._tokenizer.model.save(a_ ,				name=a_						)
													return tuple(a_						)











'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


a							   =				{
    'configuration_owlvit': [
        'OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'OwlViTConfig',
        'OwlViTOnnxConfig',
        'OwlViTTextConfig',
        'OwlViTVisionConfig',
    ],
    'processing_owlvit': ['OwlViTProcessor'],
}


try:
	if not is_vision_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a							   =				['OwlViTFeatureExtractor']
	a							   =				['OwlViTImageProcessor']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a							   =				[
	    'OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'OwlViTModel',
	    'OwlViTPreTrainedModel',
	    'OwlViTTextModel',
	    'OwlViTVisionModel',
	    'OwlViTForObjectDetection',
	]

if TYPE_CHECKING:
	from .configuration_owlvit import (
	    OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    OwlViTConfig,
	    OwlViTOnnxConfig,
	    OwlViTTextConfig,
	    OwlViTVisionConfig,
	)
	from .processing_owlvit import OwlViTProcessor

	try:
		if not is_vision_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .feature_extraction_owlvit import OwlViTFeatureExtractor
		from .image_processing_owlvit import OwlViTImageProcessor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_owlvit import (
		    OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    OwlViTForObjectDetection,
		    OwlViTModel,
		    OwlViTPreTrainedModel,
		    OwlViTTextModel,
		    OwlViTVisionModel,
		)

else:
	import sys

	a							   =				_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




