






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


A__     :      Optional[Any]             =			logging.get_logger(__name__)

A__     :      Dict             =			{"vocab_file": "vocab.txt"}

A__     :      Optional[Any]             =			{
    "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",
    }
}

A__     :      Tuple             =			{
    "tau/splinter-base": 5_12,
    "tau/splinter-base-qass": 5_12,
    "tau/splinter-large": 5_12,
    "tau/splinter-large-qass": 5_12,
}

A__     :      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 				_UpperCAmelCase (	SCREAMING_SNAKE_CASE__     ):
				lowercase__    							=	VOCAB_FILES_NAMES
				lowercase__    							=	PRETRAINED_VOCAB_FILES_MAP
				lowercase__    							=	PRETRAINED_INIT_CONFIGURATION
				lowercase__    							=	PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				lowercase__    							=	SplinterTokenizer




				def __init__(					self						:   Optional[int],  lowerCamelCase						:   Tuple=None,  lowerCamelCase						:   List[Any]=None,  lowerCamelCase						:   Union[str, Any]=True,  lowerCamelCase						:   Tuple="[UNK]",  lowerCamelCase						:   Any="[SEP]",  lowerCamelCase						:   Dict="[PAD]",  lowerCamelCase						:   int="[CLS]",  lowerCamelCase						:   Union[str, Any]="[MASK]",  lowerCamelCase						:   str="[QUESTION]",  lowerCamelCase						:   Optional[int]=True,  lowerCamelCase						:   Optional[int]=None,  **lowerCamelCase						:   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,  )

								lowercase__       			=      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
								):
												lowercase__       			=      getattr(lowerCamelCase,  pre_tok_state.pop('''type'''  )  )
												lowercase__       			=      do_lower_case
												lowercase__       			=      strip_accents
												lowercase__       			=      pre_tok_class(**lowerCamelCase  )

								lowercase__       			=      do_lower_case




				@property
				def     lowercase__       (					self						:   str  ):

								'''simple docstring'''
								return self.convert_tokens_to_ids(self.question_token  )




				def     lowercase__       (					self						:   Union[str, Any],  lowerCamelCase						:   List[int],  lowerCamelCase						:   Optional[List[int]] = None  ):

								'''simple docstring'''

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

								lowercase__       			=      [self.cls_token_id]
								lowercase__       			=      [self.sep_token_id]
								lowercase__       			=      [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     lowercase__       (					self						:   Union[str, Any],  lowerCamelCase						:   List[int],  lowerCamelCase						:   Optional[List[int]] = None  ):

								'''simple docstring'''
								lowercase__       			=      [self.sep_token_id]
								lowercase__       			=      [self.cls_token_id]
								lowercase__       			=      [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     lowercase__       (					self						:   str,  lowerCamelCase						:   str,  lowerCamelCase						:   Optional[str] = None  ):

								'''simple docstring'''
								lowercase__       			=      self._tokenizer.model.save(lowerCamelCase,  name=lowerCamelCase  )
								return tuple(lowerCamelCase  )












from typing import TYPE_CHECKING

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


A__     :      int             =			{
    'configuration_sam': [
        'SAM_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'SamConfig',
        'SamMaskDecoderConfig',
        'SamPromptEncoderConfig',
        'SamVisionConfig',
    ],
    'processing_sam': ['SamProcessor'],
}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      List[Any]             =			[
							    'SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'SamModel',
							    'SamPreTrainedModel',
							]
try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      int             =			[
							    'TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'TFSamModel',
							    'TFSamPreTrainedModel',
							]
try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      Tuple             =			['SamImageProcessor']


if TYPE_CHECKING:
							from .configuration_sam import (
							    SAM_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    SamConfig,
							    SamMaskDecoderConfig,
							    SamPromptEncoderConfig,
							    SamVisionConfig,
							)
							from .processing_sam import SamProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_sam import SAM_PRETRAINED_MODEL_ARCHIVE_LIST, SamModel, SamPreTrainedModel

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_sam import TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST, TFSamModel, TFSamPreTrainedModel

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .image_processing_sam import SamImageProcessor

else:
							import sys

							A__     :      Dict             =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




