






"""simple docstring"""





from typing import TYPE_CHECKING

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


__lowerCamelCase							=  {
    'configuration_ctrl': ['CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CTRLConfig'],
    'tokenization_ctrl': ['CTRLTokenizer'],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__lowerCamelCase							=  [
							    'CTRL_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'CTRLForSequenceClassification',
							    'CTRLLMHeadModel',
							    'CTRLModel',
							    'CTRLPreTrainedModel',
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__lowerCamelCase							=  [
							    'TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'TFCTRLForSequenceClassification',
							    'TFCTRLLMHeadModel',
							    'TFCTRLModel',
							    'TFCTRLPreTrainedModel',
							]


if TYPE_CHECKING:
							from .configuration_ctrl import CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRLConfig
							from .tokenization_ctrl import CTRLTokenizer

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_ctrl import (
														    CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
														    CTRLForSequenceClassification,
														    CTRLLMHeadModel,
														    CTRLModel,
														    CTRLPreTrainedModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_ctrl import (
														    TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFCTRLForSequenceClassification,
														    TFCTRLLMHeadModel,
														    TFCTRLModel,
														    TFCTRLPreTrainedModel,
														)

else:
							import sys

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











"""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_squeezebert import SqueezeBertTokenizer


__lowerCamelCase							=  logging.get_logger(__name__)

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

__lowerCamelCase							=  {
    'vocab_file': {
        'squeezebert/squeezebert-uncased': (
            'https://huggingface.co/squeezebert/squeezebert-uncased/resolve/main/vocab.txt'
        ),
        'squeezebert/squeezebert-mnli': 'https://huggingface.co/squeezebert/squeezebert-mnli/resolve/main/vocab.txt',
        'squeezebert/squeezebert-mnli-headless': (
            'https://huggingface.co/squeezebert/squeezebert-mnli-headless/resolve/main/vocab.txt'
        ),
    },
    'tokenizer_file': {
        'squeezebert/squeezebert-uncased': (
            'https://huggingface.co/squeezebert/squeezebert-uncased/resolve/main/tokenizer.json'
        ),
        'squeezebert/squeezebert-mnli': (
            'https://huggingface.co/squeezebert/squeezebert-mnli/resolve/main/tokenizer.json'
        ),
        'squeezebert/squeezebert-mnli-headless': (
            'https://huggingface.co/squeezebert/squeezebert-mnli-headless/resolve/main/tokenizer.json'
        ),
    },
}

__lowerCamelCase							=  {
    'squeezebert/squeezebert-uncased': 5_12,
    'squeezebert/squeezebert-mnli': 5_12,
    'squeezebert/squeezebert-mnli-headless': 5_12,
}


__lowerCamelCase							=  {
    'squeezebert/squeezebert-uncased': {'do_lower_case': True},
    'squeezebert/squeezebert-mnli': {'do_lower_case': True},
    'squeezebert/squeezebert-mnli-headless': {'do_lower_case': True},
}



class       __A		(   SCREAMING_SNAKE_CASE_			):
					UpperCAmelCase__								=				VOCAB_FILES_NAMES
					UpperCAmelCase__								=				PRETRAINED_VOCAB_FILES_MAP
					UpperCAmelCase__								=				PRETRAINED_INIT_CONFIGURATION
					UpperCAmelCase__								=				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
					UpperCAmelCase__								=				SqueezeBertTokenizer

					def __init__(			self  :      Tuple     ,		__snake_case  :      str=None     ,		__snake_case  :      Optional[Any]=None     ,		__snake_case  :      str=True     ,		__snake_case  :      str="[UNK]"     ,		__snake_case  :      int="[SEP]"     ,		__snake_case  :      int="[PAD]"     ,		__snake_case  :      Any="[CLS]"     ,		__snake_case  :      List[Any]="[MASK]"     ,		__snake_case  :      Union[str, Any]=True     ,		__snake_case  :      Dict=None     ,		**__snake_case  :      str     ,		)			->							List[Any]:
											super().__init__(
											    __snake_case     ,		tokenizer_file=__snake_case     ,		do_lower_case=__snake_case     ,		unk_token=__snake_case     ,		sep_token=__snake_case     ,		pad_token=__snake_case     ,		cls_token=__snake_case     ,		mask_token=__snake_case     ,		tokenize_chinese_chars=__snake_case     ,		strip_accents=__snake_case     ,		**__snake_case     ,		)

											__magic_name__:	List[Any]							=       json.loads(self.backend_tokenizer.normalizer.__getstate__()					)
											if (
											    normalizer_state.get("""lowercase"""     ,		__snake_case					) != do_lower_case
											    or normalizer_state.get("""strip_accents"""     ,		__snake_case					) != strip_accents
											    or normalizer_state.get("""handle_chinese_chars"""     ,		__snake_case					) != tokenize_chinese_chars
											):
																	__magic_name__:	Dict							=       getattr(__snake_case     ,		normalizer_state.pop("""type"""					)					)
																	__magic_name__:	Optional[Any]							=       do_lower_case
																	__magic_name__:	Any							=       strip_accents
																	__magic_name__:	Any							=       tokenize_chinese_chars
																	__magic_name__:	Union[str, Any]							=       normalizer_class(**__snake_case					)

											__magic_name__:	Optional[Any]							=       do_lower_case

					def   lowerCamelCase__   (			self  :      Optional[Any]     ,		__snake_case  :      List[Any]     ,		__snake_case  :      int=None					)			->							Optional[int]:
											__magic_name__:	int							=       [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   lowerCamelCase__   (			self  :      Any     ,		__snake_case  :      List[int]     ,		__snake_case  :      Optional[List[int]] = None					)			->							List[int]:
											__magic_name__:	Dict							=       [self.sep_token_id]
											__magic_name__:	List[str]							=       [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   lowerCamelCase__   (			self  :      Dict     ,		__snake_case  :      str     ,		__snake_case  :      Optional[str] = None					)			->							Tuple[str]:
											__magic_name__:	Any							=       self._tokenizer.model.save(__snake_case     ,		name=__snake_case					)
											return tuple(__snake_case					)



