
"""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_convbert import ConvBertTokenizer


UpperCAmelCase__   :					str												=				logging.get_logger(__name__)

UpperCAmelCase__   :					Optional[int]												=				{'vocab_file': 'vocab.txt'}

UpperCAmelCase__   :					Optional[Any]												=				{
    'vocab_file': {
        'YituTech/conv-bert-base': 'https://huggingface.co/YituTech/conv-bert-base/resolve/main/vocab.txt',
        'YituTech/conv-bert-medium-small': (
            'https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/vocab.txt'
        ),
        'YituTech/conv-bert-small': 'https://huggingface.co/YituTech/conv-bert-small/resolve/main/vocab.txt',
    }
}

UpperCAmelCase__   :					Union[str, Any]												=				{
    'YituTech/conv-bert-base': 5_1_2,
    'YituTech/conv-bert-medium-small': 5_1_2,
    'YituTech/conv-bert-small': 5_1_2,
}


UpperCAmelCase__   :					Dict												=				{
    'YituTech/conv-bert-base': {'do_lower_case': True},
    'YituTech/conv-bert-medium-small': {'do_lower_case': True},
    'YituTech/conv-bert-small': {'do_lower_case': True},
}



class 			lowerCAmelCase_		(a__						):


				"""simple docstring"""



				__UpperCamelCase   :		Any       =     VOCAB_FILES_NAMES
				__UpperCamelCase   :		Tuple       =     PRETRAINED_VOCAB_FILES_MAP
				__UpperCamelCase   :		Optional[int]       =     PRETRAINED_INIT_CONFIGURATION
				__UpperCamelCase   :		str       =     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				__UpperCamelCase   :		List[str]       =     ConvBertTokenizer



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



											"""simple docstring"""




											super().__init__(
											    SCREAMING_SNAKE_CASE__     , tokenizer_file=SCREAMING_SNAKE_CASE__     , do_lower_case=SCREAMING_SNAKE_CASE__     , unk_token=SCREAMING_SNAKE_CASE__     , sep_token=SCREAMING_SNAKE_CASE__     , pad_token=SCREAMING_SNAKE_CASE__     , cls_token=SCREAMING_SNAKE_CASE__     , mask_token=SCREAMING_SNAKE_CASE__     , tokenize_chinese_chars=SCREAMING_SNAKE_CASE__     , strip_accents=SCREAMING_SNAKE_CASE__     , **SCREAMING_SNAKE_CASE__     , )

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

											SCREAMING_SNAKE_CASE__		: Any     =     do_lower_case



				def 			__magic_name__					(self     , SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__=None					)      ->	Dict:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Tuple     =     [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 			__magic_name__					(self     , SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__ = None					)      ->	List[int]:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Any     =     [self.sep_token_id]
											SCREAMING_SNAKE_CASE__		: int     =     [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 			__magic_name__					(self     , SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__ = None					)      ->	Tuple[str]:



											"""simple docstring"""




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






"""simple docstring"""




from typing import TYPE_CHECKING

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


UpperCAmelCase__   :					Tuple												=				{
    'configuration_mask2former': [
        'MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'Mask2FormerConfig',
    ],
}

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCAmelCase__   :					str												=				['Mask2FormerImageProcessor']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCAmelCase__   :					Any												=				[
					    'MASK2FORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'Mask2FormerForUniversalSegmentation',
					    'Mask2FormerModel',
					    'Mask2FormerPreTrainedModel',
					]

if TYPE_CHECKING:
					from .configuration_maskaformer import MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, MaskaFormerConfig

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .image_processing_maskaformer import MaskaFormerImageProcessor

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_maskaformer import (
										    MASK2FORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    MaskaFormerForUniversalSegmentation,
										    MaskaFormerModel,
										    MaskaFormerPreTrainedModel,
										)


else:
					import sys

					UpperCAmelCase__   :					Union[str, Any]												=				_LazyModule(__name__, globals()['__file__'], _import_structure)




