






'''simple docstring'''


import os
from shutil import copyfile
from typing import Optional, Tuple

from ...file_utils import is_sentencepiece_available
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging


if is_sentencepiece_available():
					from .tokenization_deberta_va import DebertaVaTokenizer
else:
					lowerCamelCase_					:			Optional[Any]     						=				None

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

lowerCamelCase_					:			Dict     						=				{'''vocab_file''': '''spm.model''', '''tokenizer_file''': '''tokenizer.json'''}

lowerCamelCase_					:			Union[str, Any]     						=				{
    '''vocab_file''': {
        '''microsoft/deberta-v2-xlarge''': '''https://huggingface.co/microsoft/deberta-v2-xlarge/resolve/main/spm.model''',
        '''microsoft/deberta-v2-xxlarge''': '''https://huggingface.co/microsoft/deberta-v2-xxlarge/resolve/main/spm.model''',
        '''microsoft/deberta-v2-xlarge-mnli''': (
            '''https://huggingface.co/microsoft/deberta-v2-xlarge-mnli/resolve/main/spm.model'''
        ),
        '''microsoft/deberta-v2-xxlarge-mnli''': (
            '''https://huggingface.co/microsoft/deberta-v2-xxlarge-mnli/resolve/main/spm.model'''
        ),
    }
}

lowerCamelCase_					:			int     						=				{
    '''microsoft/deberta-v2-xlarge''': 512,
    '''microsoft/deberta-v2-xxlarge''': 512,
    '''microsoft/deberta-v2-xlarge-mnli''': 512,
    '''microsoft/deberta-v2-xxlarge-mnli''': 512,
}

lowerCamelCase_					:			int     						=				{
    '''microsoft/deberta-v2-xlarge''': {'''do_lower_case''': False},
    '''microsoft/deberta-v2-xxlarge''': {'''do_lower_case''': False},
    '''microsoft/deberta-v2-xlarge-mnli''': {'''do_lower_case''': False},
    '''microsoft/deberta-v2-xxlarge-mnli''': {'''do_lower_case''': False},
}
class  _SCREAMING_SNAKE_CASE				(		SCREAMING_SNAKE_CASE						):


			'''simple docstring'''





			__a				:				Optional[int]         =       VOCAB_FILES_NAMES
			__a				:				Optional[int]         =       PRETRAINED_VOCAB_FILES_MAP
			__a				:				List[str]         =       PRETRAINED_INIT_CONFIGURATION
			__a				:				Dict         =       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
			__a				:				Optional[Any]         =       DebertaVaTokenizer






			def __init__( self				:    Union[str, Any]			,   lowercase				:    Optional[int]=None			,   lowercase				:    int=None			,   lowercase				:    Tuple=False			,   lowercase				:    List[Any]=False			,   lowercase				:    List[str]="[CLS]"			,   lowercase				:    Optional[Any]="[SEP]"			,   lowercase				:    Dict="[UNK]"			,   lowercase				:    List[Any]="[SEP]"			,   lowercase				:    Tuple="[PAD]"			,   lowercase				:    str="[CLS]"			,   lowercase				:    Union[str, Any]="[MASK]"			,   **lowercase				:    Optional[Any]			,   )				->     None:

									'''simple docstring'''







									super().__init__(
									    lowercase			,   tokenizer_file=lowercase			,   do_lower_case=lowercase			,   bos_token=lowercase			,   eos_token=lowercase			,   unk_token=lowercase			,   sep_token=lowercase			,   pad_token=lowercase			,   cls_token=lowercase			,   mask_token=lowercase			,   split_by_punct=lowercase			,   **lowercase			,   )

									UpperCamelCase__       =			do_lower_case
									UpperCamelCase__       =			split_by_punct
									UpperCamelCase__       =			vocab_file
									UpperCamelCase__       =			False if not self.vocab_file else True






			def 					A   ( self				:    Tuple			,   lowercase				:    Any			,   lowercase				:    Optional[int]=None      )				->     Dict:

									'''simple docstring'''







									if token_ids_a is None:
															return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
									UpperCamelCase__       =			[self.cls_token_id]
									UpperCamelCase__       =			[self.sep_token_id]
									return cls + token_ids_a + sep + token_ids_a + sep






			def 					A   ( self				:    Optional[Any]			,   lowercase				:    Optional[Any]			,   lowercase				:    int=None			,   lowercase				:    Tuple=False      )				->     Union[str, Any]:

									'''simple docstring'''







									if already_has_special_tokens:
															return super().get_special_tokens_mask(
															    token_ids_a=lowercase			,   token_ids_a=lowercase			,   already_has_special_tokens=lowercase      )

									if token_ids_a is not None:
															return [1] + ([0] * len(lowercase      )) + [1] + ([0] * len(lowercase      )) + [1]
									return [1] + ([0] * len(lowercase      )) + [1]






			def 					A   ( self				:    Optional[int]			,   lowercase				:    Union[str, Any]			,   lowercase				:    str=None      )				->     List[str]:

									'''simple docstring'''







									UpperCamelCase__       =			[self.sep_token_id]
									UpperCamelCase__       =			[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				:    List[Any]			,   lowercase				:    str			,   lowercase				:    Optional[str] = None      )				->     Tuple[str]:

									'''simple docstring'''







									if not self.can_save_slow_tokenizer:
															raise ValueError(
															    """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
															    """tokenizer."""      )

									if not os.path.isdir(lowercase      ):
															logger.error(f"Vocabulary path ({save_directory}) should be a directory"      )
															return
									UpperCamelCase__       =			os.path.join(
									    lowercase			,   (filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]      )

									if os.path.abspath(self.vocab_file      ) != os.path.abspath(lowercase      ):
															copyfile(self.vocab_file			,   lowercase      )

									return (out_vocab_file,)








'''simple docstring'''


from typing import TYPE_CHECKING

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


lowerCamelCase_					:			Any     						=				{
    '''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:
					lowerCamelCase_					:			Union[str, Any]     						=				[
					    '''SAM_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''SamModel''',
					    '''SamPreTrainedModel''',
					]
try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_					:			Optional[Any]     						=				[
					    '''TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''TFSamModel''',
					    '''TFSamPreTrainedModel''',
					]
try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_					:			Optional[Any]     						=				['''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

					lowerCamelCase_					:			Optional[Any]     						=				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
