

from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCAmelCase							:  Any            =						logging.get_logger(__name__)

lowerCAmelCase							:  List[Any]            =						{
    """facebook/xmod-base""": """https://huggingface.co/facebook/xmod-base/resolve/main/config.json""",
    """facebook/xmod-large-prenorm""": """https://huggingface.co/facebook/xmod-large-prenorm/resolve/main/config.json""",
    """facebook/xmod-base-13-125k""": """https://huggingface.co/facebook/xmod-base-13-125k/resolve/main/config.json""",
    """facebook/xmod-base-30-125k""": """https://huggingface.co/facebook/xmod-base-30-125k/resolve/main/config.json""",
    """facebook/xmod-base-30-195k""": """https://huggingface.co/facebook/xmod-base-30-195k/resolve/main/config.json""",
    """facebook/xmod-base-60-125k""": """https://huggingface.co/facebook/xmod-base-60-125k/resolve/main/config.json""",
    """facebook/xmod-base-60-265k""": """https://huggingface.co/facebook/xmod-base-60-265k/resolve/main/config.json""",
    """facebook/xmod-base-75-125k""": """https://huggingface.co/facebook/xmod-base-75-125k/resolve/main/config.json""",
    """facebook/xmod-base-75-269k""": """https://huggingface.co/facebook/xmod-base-75-269k/resolve/main/config.json""",
}



class   __lowercase    (			UpperCAmelCase_     ):




			"""simple docstring"""







			_UpperCAmelCase       :							Dict      							=					'''xmod'''



			def __init__(			self  :					str       ,						lowerCAmelCase__  :					Any=3_0522       ,						lowerCAmelCase__  :					Tuple=768       ,						lowerCAmelCase__  :					Tuple=12       ,						lowerCAmelCase__  :					int=12       ,						lowerCAmelCase__  :					Dict=3072       ,						lowerCAmelCase__  :					List[str]="gelu"       ,						lowerCAmelCase__  :					Any=0.1       ,						lowerCAmelCase__  :					Any=0.1       ,						lowerCAmelCase__  :					Dict=512       ,						lowerCAmelCase__  :					Optional[Any]=2       ,						lowerCAmelCase__  :					str=0.02       ,						lowerCAmelCase__  :					Union[str, Any]=1E-12       ,						lowerCAmelCase__  :					int=1       ,						lowerCAmelCase__  :					List[Any]=0       ,						lowerCAmelCase__  :					Optional[int]=2       ,						lowerCAmelCase__  :					Any="absolute"       ,						lowerCAmelCase__  :					Tuple=True       ,						lowerCAmelCase__  :					List[Any]=None       ,						lowerCAmelCase__  :					Any=False       ,						lowerCAmelCase__  :					Union[str, Any]=2       ,						lowerCAmelCase__  :					Dict=False       ,						lowerCAmelCase__  :					Any=True       ,						lowerCAmelCase__  :					str=True       ,						lowerCAmelCase__  :					Optional[Any]=("en_XX",)       ,						lowerCAmelCase__  :					int=None       ,						**lowerCAmelCase__  :					int       ,						):
									super().__init__(pad_token_id=lowerCAmelCase__       ,						bos_token_id=lowerCAmelCase__       ,						eos_token_id=lowerCAmelCase__       ,						**lowerCAmelCase__)

									SCREAMING_SNAKE_CASE_:			Union[str, Any]   		=	vocab_size
									SCREAMING_SNAKE_CASE_:			List[Any]   		=	hidden_size
									SCREAMING_SNAKE_CASE_:			Tuple   		=	num_hidden_layers
									SCREAMING_SNAKE_CASE_:			str   		=	num_attention_heads
									SCREAMING_SNAKE_CASE_:			str   		=	hidden_act
									SCREAMING_SNAKE_CASE_:			Union[str, Any]   		=	intermediate_size
									SCREAMING_SNAKE_CASE_:			Any   		=	hidden_dropout_prob
									SCREAMING_SNAKE_CASE_:			Dict   		=	attention_probs_dropout_prob
									SCREAMING_SNAKE_CASE_:			str   		=	max_position_embeddings
									SCREAMING_SNAKE_CASE_:			List[Any]   		=	type_vocab_size
									SCREAMING_SNAKE_CASE_:			Tuple   		=	initializer_range
									SCREAMING_SNAKE_CASE_:			str   		=	layer_norm_eps
									SCREAMING_SNAKE_CASE_:			Union[str, Any]   		=	position_embedding_type
									SCREAMING_SNAKE_CASE_:			Tuple   		=	use_cache
									SCREAMING_SNAKE_CASE_:			Optional[int]   		=	classifier_dropout
									SCREAMING_SNAKE_CASE_:			Dict   		=	pre_norm
									SCREAMING_SNAKE_CASE_:			str   		=	adapter_reduction_factor
									SCREAMING_SNAKE_CASE_:			List[str]   		=	adapter_layer_norm
									SCREAMING_SNAKE_CASE_:			int   		=	adapter_reuse_layer_norm
									SCREAMING_SNAKE_CASE_:			str   		=	ln_before_adapter
									SCREAMING_SNAKE_CASE_:			str   		=	list(lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_:			Optional[Any]   		=	default_language







class   __lowercase    (			UpperCAmelCase_     ):




			"""simple docstring"""







			@property
			def 	_SCREAMING_SNAKE_CASE      (			self  :					Union[str, Any]):
									if self.task == "multiple-choice":
															SCREAMING_SNAKE_CASE_:			str   		=	{0: "batch", 1: "choice", 2: "sequence"}
									else:
															SCREAMING_SNAKE_CASE_:			str   		=	{0: "batch", 1: "sequence"}
									return OrderedDict(
									    [
									        ("input_ids", dynamic_axis),
									        ("attention_mask", dynamic_axis),
									    ])









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


lowerCAmelCase							:  Any            =						logging.get_logger(__name__)

lowerCAmelCase							:  Dict            =						{"""vocab_file""": """vocab.txt"""}

lowerCAmelCase							:  List[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""",
    }
}

lowerCAmelCase							:  List[Any]            =						{
    """YituTech/conv-bert-base""": 512,
    """YituTech/conv-bert-medium-small""": 512,
    """YituTech/conv-bert-small""": 512,
}


lowerCAmelCase							:  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   __lowercase    (			UpperCAmelCase_     ):




			"""simple docstring"""







			_UpperCAmelCase       :							str      							=					VOCAB_FILES_NAMES
			_UpperCAmelCase       :							List[str]      							=					PRETRAINED_VOCAB_FILES_MAP
			_UpperCAmelCase       :							List[Any]      							=					PRETRAINED_INIT_CONFIGURATION
			_UpperCAmelCase       :							Optional[Any]      							=					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
			_UpperCAmelCase       :							Dict      							=					ConvBertTokenizer



			def __init__(			self  :					Optional[Any]       ,						lowerCAmelCase__  :					Optional[int]=None       ,						lowerCAmelCase__  :					List[str]=None       ,						lowerCAmelCase__  :					str=True       ,						lowerCAmelCase__  :					Any="[UNK]"       ,						lowerCAmelCase__  :					Optional[Any]="[SEP]"       ,						lowerCAmelCase__  :					Any="[PAD]"       ,						lowerCAmelCase__  :					Dict="[CLS]"       ,						lowerCAmelCase__  :					Dict="[MASK]"       ,						lowerCAmelCase__  :					Tuple=True       ,						lowerCAmelCase__  :					str=None       ,						**lowerCAmelCase__  :					Dict       ,						):
									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__       ,						)

									SCREAMING_SNAKE_CASE_:			List[str]  		=	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
									):
															SCREAMING_SNAKE_CASE_:			Optional[int]  		=	getattr(lowerCAmelCase__       ,						normalizer_state.pop("type"))
															SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	do_lower_case
															SCREAMING_SNAKE_CASE_:			List[str]  		=	strip_accents
															SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	tokenize_chinese_chars
															SCREAMING_SNAKE_CASE_:			Optional[int]  		=	normalizer_class(**lowerCAmelCase__)

									SCREAMING_SNAKE_CASE_:			Optional[int]  		=	do_lower_case



			def 	_SCREAMING_SNAKE_CASE      (			self  :					str       ,						lowerCAmelCase__  :					Optional[int]       ,						lowerCAmelCase__  :					Union[str, Any]=None):
									SCREAMING_SNAKE_CASE_:			List[str]  		=	[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 	_SCREAMING_SNAKE_CASE      (			self  :					Optional[Any]       ,						lowerCAmelCase__  :					List[int]       ,						lowerCAmelCase__  :					Optional[List[int]] = None):
									SCREAMING_SNAKE_CASE_:			Optional[int]  		=	[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 	_SCREAMING_SNAKE_CASE      (			self  :					List[Any]       ,						lowerCAmelCase__  :					str       ,						lowerCAmelCase__  :					Optional[str] = None):
									SCREAMING_SNAKE_CASE_:			Any  		=	self._tokenizer.model.save(lowerCAmelCase__       ,						name=lowerCAmelCase__)
									return tuple(lowerCAmelCase__)






