





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


_lowerCamelCase   				=			logging.get_logger(__name__)

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

_lowerCamelCase   				=			{
    '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'
        ),
    },
}

_lowerCamelCase   				=			{
    'distilbert-base-uncased': 512,
    'distilbert-base-uncased-distilled-squad': 512,
    'distilbert-base-cased': 512,
    'distilbert-base-cased-distilled-squad': 512,
    'distilbert-base-german-cased': 512,
    'distilbert-base-multilingual-cased': 512,
}


_lowerCamelCase   				=			{
    '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   UpperCamelCase_       (     UpperCamelCase__    ):
							lowerCamelCase_           =					VOCAB_FILES_NAMES
							lowerCamelCase_           =					PRETRAINED_VOCAB_FILES_MAP
							lowerCamelCase_           =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							lowerCamelCase_           =					PRETRAINED_INIT_CONFIGURATION
							lowerCamelCase_           =					["input_ids", "attention_mask"]
							lowerCamelCase_           =					DistilBertTokenizer


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



									"""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      _snake_case  (							self    :Any							,				__A    :Tuple							,				__A    :str=None		)   ->   Optional[Any]:



									"""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      _snake_case  (							self    :Union[str, Any]							,				__A    :List[int]							,				__A    :Optional[List[int]] = None		)   ->   List[int]:



									"""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      _snake_case  (							self    :int							,				__A    :str							,				__A    :Optional[str] = None		)   ->   Tuple[str]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__			=      self._tokenizer.model.save(__A							,				name=__A		)
									return tuple(__A		)






from ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowerCamelCase   				=			logging.get_logger(__name__)




class   UpperCamelCase_       (     UpperCamelCase__    ):
							lowerCamelCase_           =					"timm_backbone"


							def __init__(							self    :Union[str, Any]							,				__A    :str=None							,				__A    :Union[str, Any]=3							,				__A    :str=True							,				__A    :Any=True							,				__A    :Optional[Any]=None							,				**__A    :List[str]							,				)   ->   Tuple:



									"""simple docstring"""



									super().__init__(**__A		)
									SCREAMING_SNAKE_CASE__			=      backbone
									SCREAMING_SNAKE_CASE__			=      num_channels
									SCREAMING_SNAKE_CASE__			=      features_only
									SCREAMING_SNAKE_CASE__			=      use_pretrained_backbone
									SCREAMING_SNAKE_CASE__			=      True
									SCREAMING_SNAKE_CASE__			=      out_indices if out_indices is not None else (-1,)