


'''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


_lowercase    :    List[str]			     =  logging.get_logger(__name__)

_lowercase    :    Union[str, Any]			     =  {'vocab_file': 'vocab.txt'}

_lowercase    :    str			     =  {
    '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',
    }
}

_lowercase    :    List[str]			     =  {
    'YituTech/conv-bert-base': 512,
    'YituTech/conv-bert-medium-small': 512,
    'YituTech/conv-bert-small': 512,
}


_lowercase    :    Tuple			     =  {
    '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  UpperCamelCase__(     _A ):
				__magic_name__       :   Optional[int]							= VOCAB_FILES_NAMES
				__magic_name__       :   Union[str, Any]							= PRETRAINED_VOCAB_FILES_MAP
				__magic_name__       :   Optional[int]							= PRETRAINED_INIT_CONFIGURATION
				__magic_name__       :   Optional[int]							= PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				__magic_name__       :   List[Any]							= ConvBertTokenizer




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

										"""simple docstring"""




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

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

										UpperCAmelCase         =			do_lower_case




				def   a__(	self    :				int   ,					lowerCAmelCase    :				int   ,					lowerCAmelCase    :				str=None   )->  Optional[int]:

										"""simple docstring"""




										UpperCAmelCase         =			[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   a__(	self    :				List[Any]   ,					lowerCAmelCase    :				List[int]   ,					lowerCAmelCase    :				Optional[List[int]] = None   )->  List[int]:

										"""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    :				Tuple   ,					lowerCAmelCase    :				str   ,					lowerCAmelCase    :				Optional[str] = None   )->  Tuple[str]:

										"""simple docstring"""




										UpperCAmelCase         =			self._tokenizer.model.save(UpperCamelCase__   ,					name=UpperCamelCase__   )
										return tuple(UpperCamelCase__   )









'''simple docstring'''



from typing import TYPE_CHECKING

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


_lowercase    :    Any			     =  {
    """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""],
    """configuration_maskformer_swin""": ["""MaskFormerSwinConfig"""],
}

try:
	if not is_vision_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_lowercase    :    Any			     =  ["""MaskFormerFeatureExtractor"""]
	_lowercase    :    Dict			     =  ["""MaskFormerImageProcessor"""]


try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_lowercase    :    Any			     =  [
	    """MASKFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
	    """MaskFormerForInstanceSegmentation""",
	    """MaskFormerModel""",
	    """MaskFormerPreTrainedModel""",
	]
	_lowercase    :    List[Any]			     =  [
	    """MaskFormerSwinBackbone""",
	    """MaskFormerSwinModel""",
	    """MaskFormerSwinPreTrainedModel""",
	]

if TYPE_CHECKING:
	from .configuration_maskformer import MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, MaskFormerConfig
	from .configuration_maskformer_swin import MaskFormerSwinConfig

	try:
		if not is_vision_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .feature_extraction_maskformer import MaskFormerFeatureExtractor
		from .image_processing_maskformer import MaskFormerImageProcessor
	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_maskformer import (
		    MASKFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    MaskFormerForInstanceSegmentation,
		    MaskFormerModel,
		    MaskFormerPreTrainedModel,
		)
		from .modeling_maskformer_swin import (
		    MaskFormerSwinBackbone,
		    MaskFormerSwinModel,
		    MaskFormerSwinPreTrainedModel,
		)


else:
	import sys

	_lowercase    :    List[Any]			     =  _LazyModule(__name__, globals()["""__file__"""], _import_structure)





