




import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_splinter import SplinterTokenizer


lowercase__      :			Any           =					logging.get_logger(__name__)

lowercase__      :			Any           =					{"vocab_file": "vocab.txt"}

lowercase__      :			Optional[int]           =					{
    "vocab_file": {
        "tau/splinter-base": "https://huggingface.co/tau/splinter-base/resolve/main/vocab.txt",
        "tau/splinter-base-qass": "https://huggingface.co/tau/splinter-base-qass/resolve/main/vocab.txt",
        "tau/splinter-large": "https://huggingface.co/tau/splinter-large/resolve/main/vocab.txt",
        "tau/splinter-large-qass": "https://huggingface.co/tau/splinter-large-qass/resolve/main/vocab.txt",
    }
}

lowercase__      :			str           =					{
    "tau/splinter-base": 512,
    "tau/splinter-base-qass": 512,
    "tau/splinter-large": 512,
    "tau/splinter-large-qass": 512,
}

lowercase__      :			Optional[int]           =					{
    "tau/splinter-base": {"do_lower_case": False},
    "tau/splinter-base-qass": {"do_lower_case": False},
    "tau/splinter-large": {"do_lower_case": False},
    "tau/splinter-large-qass": {"do_lower_case": False},
}




class 			a__       (					lowerCAmelCase__      ):
     a		:			Optional[Any]							=	VOCAB_FILES_NAMES
     a		:			Dict							=	PRETRAINED_VOCAB_FILES_MAP
     a		:			Optional[Any]							=	PRETRAINED_INIT_CONFIGURATION
     a		:			Tuple							=	PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     a		:			Tuple							=	SplinterTokenizer







     def __init__(	self  ,		A=None  ,		A=None  ,		A=True  ,		A="[UNK]"  ,		A="[SEP]"  ,		A="[PAD]"  ,		A="[CLS]"  ,		A="[MASK]"  ,		A="[QUESTION]"  ,		A=True  ,		A=None  ,		**A  ,		)  ->    List[Any]:



          '''simple docstring'''



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

          a      =      json.loads(self.backend_tokenizer.normalizer.__getstate__() )
          if (
              pre_tok_state.get("lowercase"  ,		_lowerCamelCase ) != do_lower_case
              or pre_tok_state.get("strip_accents"  ,		_lowerCamelCase ) != strip_accents
          ):
               a      =      getattr(_lowerCamelCase  ,		pre_tok_state.pop("type" ) )
               a      =      do_lower_case
               a      =      strip_accents
               a      =      pre_tok_class(**_lowerCamelCase )

          a      =      do_lower_case







     @property
     def 			lowerCAmelCase_				(	self )  ->    int:



          '''simple docstring'''



          return self.convert_tokens_to_ids(self.question_token )







     def 			lowerCAmelCase_				(	self  ,		A  ,		A = None )  ->    List[int]:



          '''simple docstring'''



          if token_ids_a is None:
               return [self.cls_token_id] + token_ids_a + [self.sep_token_id]

          a      =      [self.cls_token_id]
          a      =      [self.sep_token_id]
          a      =      [self.question_token_id] + [self.convert_tokens_to_ids("." )]
          if self.padding_side == "right":
               # Input is question-then-context
               return cls + token_ids_a + question_suffix + sep + token_ids_a + sep
          else:
               # Input is context-then-question
               return cls + token_ids_a + sep + token_ids_a + question_suffix + sep







     def 			lowerCAmelCase_				(	self  ,		A  ,		A = None )  ->    List[int]:



          '''simple docstring'''



          a      =      [self.sep_token_id]
          a      =      [self.cls_token_id]
          a      =      [self.question_token_id] + [self.convert_tokens_to_ids("." )]
          if token_ids_a is None:
               return len(cls + token_ids_a + sep ) * [0]

          if self.padding_side == "right":
               # Input is question-then-context
               return len(cls + token_ids_a + question_suffix + sep ) * [0] + len(token_ids_a + sep ) * [1]
          else:
               # Input is context-then-question
               return len(cls + token_ids_a + sep ) * [0] + len(token_ids_a + question_suffix + sep ) * [1]







     def 			lowerCAmelCase_				(	self  ,		A  ,		A = None )  ->    Tuple[str]:



          '''simple docstring'''



          a      =      self._tokenizer.model.save(_lowerCamelCase  ,		name=_lowerCamelCase )
          return tuple(_lowerCamelCase )








'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_SCREAMING_SNAKE_CASE    =			{
    '''configuration_deformable_detr''': ['''DEFORMABLE_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DeformableDetrConfig'''],
}

try:
	if not is_vision_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_SCREAMING_SNAKE_CASE    =			['''DeformableDetrFeatureExtractor''']
	_SCREAMING_SNAKE_CASE    =			['''DeformableDetrImageProcessor''']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_SCREAMING_SNAKE_CASE    =			[
	    '''DEFORMABLE_DETR_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''DeformableDetrForObjectDetection''',
	    '''DeformableDetrModel''',
	    '''DeformableDetrPreTrainedModel''',
	]


if TYPE_CHECKING:
	from .configuration_deformable_detr import DEFORMABLE_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP, DeformableDetrConfig

	try:
		if not is_vision_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .feature_extraction_deformable_detr import DeformableDetrFeatureExtractor
		from .image_processing_deformable_detr import DeformableDetrImageProcessor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_deformable_detr import (
		    DEFORMABLE_DETR_PRETRAINED_MODEL_ARCHIVE_LIST,
		    DeformableDetrForObjectDetection,
		    DeformableDetrModel,
		    DeformableDetrPreTrainedModel,
		)

else:
	import sys

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





