





'''simple docstring'''



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_distilbert import DistilBertTokenizer


_SCREAMING_SNAKE_CASE					=    logging.get_logger(__name__)

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

_SCREAMING_SNAKE_CASE					=    {
    '''vocab_file''': {
        '''distilbert-base-uncased''': '''https://huggingface.co/distilbert-base-uncased/resolve/main/vocab.txt''',
        '''distilbert-base-uncased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/vocab.txt'''
        ),
        '''distilbert-base-cased''': '''https://huggingface.co/distilbert-base-cased/resolve/main/vocab.txt''',
        '''distilbert-base-cased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/vocab.txt'''
        ),
        '''distilbert-base-german-cased''': '''https://huggingface.co/distilbert-base-german-cased/resolve/main/vocab.txt''',
        '''distilbert-base-multilingual-cased''': (
            '''https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/vocab.txt'''
        ),
    },
    '''tokenizer_file''': {
        '''distilbert-base-uncased''': '''https://huggingface.co/distilbert-base-uncased/resolve/main/tokenizer.json''',
        '''distilbert-base-uncased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-cased''': '''https://huggingface.co/distilbert-base-cased/resolve/main/tokenizer.json''',
        '''distilbert-base-cased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-german-cased''': (
            '''https://huggingface.co/distilbert-base-german-cased/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-multilingual-cased''': (
            '''https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/tokenizer.json'''
        ),
    },
}

_SCREAMING_SNAKE_CASE					=    {
    '''distilbert-base-uncased''': 5_1_2,
    '''distilbert-base-uncased-distilled-squad''': 5_1_2,
    '''distilbert-base-cased''': 5_1_2,
    '''distilbert-base-cased-distilled-squad''': 5_1_2,
    '''distilbert-base-german-cased''': 5_1_2,
    '''distilbert-base-multilingual-cased''': 5_1_2,
}


_SCREAMING_SNAKE_CASE					=    {
    '''distilbert-base-uncased''': {'''do_lower_case''': True},
    '''distilbert-base-uncased-distilled-squad''': {'''do_lower_case''': True},
    '''distilbert-base-cased''': {'''do_lower_case''': False},
    '''distilbert-base-cased-distilled-squad''': {'''do_lower_case''': False},
    '''distilbert-base-german-cased''': {'''do_lower_case''': False},
    '''distilbert-base-multilingual-cased''': {'''do_lower_case''': False},
}






class 							__lowercase       (      lowerCAmelCase__						):







	'''simple docstring'''

	a    :				Optional[int]											=       VOCAB_FILES_NAMES
	a    :				Optional[Any]											=       PRETRAINED_VOCAB_FILES_MAP
	a    :				Optional[Any]											=       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	a    :				Dict											=       PRETRAINED_INIT_CONFIGURATION
	a    :				Optional[int]											=       ["input_ids", "attention_mask"]
	a    :				Tuple											=       DistilBertTokenizer


	def __init__(self     ,_lowerCamelCase=None     ,_lowerCamelCase=None     ,_lowerCamelCase=True     ,_lowerCamelCase="[UNK]"     ,_lowerCamelCase="[SEP]"     ,_lowerCamelCase="[PAD]"     ,_lowerCamelCase="[CLS]"     ,_lowerCamelCase="[MASK]"     ,_lowerCamelCase=True     ,_lowerCamelCase=None     ,**_lowerCamelCase     ,)							->							str:







				'''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     ,**_lowerCamelCase     ,)

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

				__lowercase										=							do_lower_case


	def 						_UpperCAmelCase     (self     ,_lowerCamelCase     ,_lowerCamelCase=None )							->							int:







				'''simple docstring'''





				__lowercase										=							[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 						_UpperCAmelCase     (self     ,_lowerCamelCase     ,_lowerCamelCase = None )							->							List[int]:







				'''simple docstring'''





				__lowercase										=							[self.sep_token_id]
				__lowercase										=							[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 						_UpperCAmelCase     (self     ,_lowerCamelCase     ,_lowerCamelCase = None )							->							Tuple[str]:







				'''simple docstring'''





				__lowercase										=							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


_SCREAMING_SNAKE_CASE					=    {
    '''configuration_clipseg''': [
        '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''CLIPSegConfig''',
        '''CLIPSegTextConfig''',
        '''CLIPSegVisionConfig''',
    ],
    '''processing_clipseg''': ['''CLIPSegProcessor'''],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_SCREAMING_SNAKE_CASE					=    [
	    '''CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''CLIPSegModel''',
	    '''CLIPSegPreTrainedModel''',
	    '''CLIPSegTextModel''',
	    '''CLIPSegVisionModel''',
	    '''CLIPSegForImageSegmentation''',
	]

if TYPE_CHECKING:
	from .configuration_clipseg import (
	    CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    CLIPSegConfig,
	    CLIPSegTextConfig,
	    CLIPSegVisionConfig,
	)
	from .processing_clipseg import CLIPSegProcessor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_clipseg import (
		    CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST,
		    CLIPSegForImageSegmentation,
		    CLIPSegModel,
		    CLIPSegPreTrainedModel,
		    CLIPSegTextModel,
		    CLIPSegVisionModel,
		)

else:
	import sys

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





