



from __future__ import annotations

import os
import tempfile
import unittest

from transformers import ConvBertConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
							import tensorflow as tf

							from transformers import (
							    TFConvBertForMaskedLM,
							    TFConvBertForMultipleChoice,
							    TFConvBertForQuestionAnswering,
							    TFConvBertForSequenceClassification,
							    TFConvBertForTokenClassification,
							    TFConvBertModel,
							)







class       __lowerCAmelCase   :



			def __init__(						self       :  Optional[Any]			,		A       :  Dict			,		A       :  List[str]=13			,		A       :  List[str]=7			,		A       :  Optional[Any]=True			,		A       :  Any=True			,		A       :  List[Any]=True			,		A       :  List[Any]=True			,		A       :  Dict=99			,		A       :  Union[str, Any]=32			,		A       :  Tuple=2			,		A       :  Any=4			,		A       :  Optional[int]=37			,		A       :  Optional[int]="gelu"			,		A       :  Any=0.1			,		A       :  Any=0.1			,		A       :  Any=5_12			,		A       :  str=16			,		A       :  List[Any]=2			,		A       :  Tuple=0.0_2			,		A       :  str=3			,		A       :  str=4			,		A       :  str=None			,		)       ->   List[str]:



						"""simple docstring"""






						_UpperCAmelCase			=       parent
						_UpperCAmelCase			=       13
						_UpperCAmelCase			=       7
						_UpperCAmelCase			=       True
						_UpperCAmelCase			=       True
						_UpperCAmelCase			=       True
						_UpperCAmelCase			=       True
						_UpperCAmelCase			=       99
						_UpperCAmelCase			=       3_84
						_UpperCAmelCase			=       2
						_UpperCAmelCase			=       4
						_UpperCAmelCase			=       37
						_UpperCAmelCase			=       'gelu'
						_UpperCAmelCase			=       0.1
						_UpperCAmelCase			=       0.1
						_UpperCAmelCase			=       5_12
						_UpperCAmelCase			=       16
						_UpperCAmelCase			=       2
						_UpperCAmelCase			=       0.0_2
						_UpperCAmelCase			=       3
						_UpperCAmelCase			=       4
						_UpperCAmelCase			=       1_28
						_UpperCAmelCase			=       2
						_UpperCAmelCase			=       9
						_UpperCAmelCase			=       1
						_UpperCAmelCase			=       None



			def    _lowerCamelCase	(						self       :  int)       ->   Tuple:



						"""simple docstring"""






						_UpperCAmelCase			=       ids_tensor([self.batch_size, self.seq_length]			,		self.vocab_size)

						_UpperCAmelCase			=       None
						if self.use_input_mask:
									_UpperCAmelCase			=       random_attention_mask([self.batch_size, self.seq_length])

						_UpperCAmelCase			=       None
						if self.use_token_type_ids:
									_UpperCAmelCase			=       ids_tensor([self.batch_size, self.seq_length]			,		self.type_vocab_size)

						_UpperCAmelCase			=       None
						_UpperCAmelCase			=       None
						_UpperCAmelCase			=       None
						if self.use_labels:
									_UpperCAmelCase			=       ids_tensor([self.batch_size]			,		self.type_sequence_label_size)
									_UpperCAmelCase			=       ids_tensor([self.batch_size, self.seq_length]			,		self.num_labels)
									_UpperCAmelCase			=       ids_tensor([self.batch_size]			,		self.num_choices)

						_UpperCAmelCase			=       ConvBertConfig(
						    vocab_size=self.vocab_size			,		hidden_size=self.hidden_size			,		num_hidden_layers=self.num_hidden_layers			,		num_attention_heads=self.num_attention_heads			,		intermediate_size=self.intermediate_size			,		hidden_act=self.hidden_act			,		hidden_dropout_prob=self.hidden_dropout_prob			,		attention_probs_dropout_prob=self.attention_probs_dropout_prob			,		max_position_embeddings=self.max_position_embeddings			,		type_vocab_size=self.type_vocab_size			,		initializer_range=self.initializer_range			,		return_dict=A			,		)

						return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels



			def    _lowerCamelCase	(						self       :  Optional[int]			,		A       :  Dict			,		A       :  List[str]			,		A       :  Dict			,		A       :  List[str]			,		A       :  List[str]			,		A       :  Union[str, Any]			,		A       :  Union[str, Any])       ->   List[Any]:



						"""simple docstring"""






						_UpperCAmelCase			=       TFConvBertModel(config=A)
						_UpperCAmelCase			=       {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}

						_UpperCAmelCase			=       [input_ids, input_mask]
						_UpperCAmelCase			=       model(A)

						_UpperCAmelCase			=       model(A)

						self.parent.assertEqual(result.last_hidden_state.shape			,		(self.batch_size, self.seq_length, self.hidden_size))



			def    _lowerCamelCase	(						self       :  Union[str, Any]			,		A       :  Optional[Any]			,		A       :  Tuple			,		A       :  Any			,		A       :  Optional[int]			,		A       :  Tuple			,		A       :  Any			,		A       :  Union[str, Any])       ->   List[Any]:



						"""simple docstring"""






						_UpperCAmelCase			=       TFConvBertForMaskedLM(config=A)
						_UpperCAmelCase			=       {
						    'input_ids': input_ids,
						    'attention_mask': input_mask,
						    'token_type_ids': token_type_ids,
						}
						_UpperCAmelCase			=       model(A)
						self.parent.assertEqual(result.logits.shape			,		(self.batch_size, self.seq_length, self.vocab_size))



			def    _lowerCamelCase	(						self       :  List[str]			,		A       :  Optional[int]			,		A       :  Any			,		A       :  int			,		A       :  List[Any]			,		A       :  Optional[int]			,		A       :  List[Any]			,		A       :  int)       ->   Any:



						"""simple docstring"""






						_UpperCAmelCase			=       self.num_labels
						_UpperCAmelCase			=       TFConvBertForSequenceClassification(config=A)
						_UpperCAmelCase			=       {
						    'input_ids': input_ids,
						    'attention_mask': input_mask,
						    'token_type_ids': token_type_ids,
						}

						_UpperCAmelCase			=       model(A)
						self.parent.assertEqual(result.logits.shape			,		(self.batch_size, self.num_labels))



			def    _lowerCamelCase	(						self       :  int			,		A       :  str			,		A       :  List[str]			,		A       :  List[str]			,		A       :  Optional[Any]			,		A       :  int			,		A       :  str			,		A       :  List[Any])       ->   Optional[int]:



						"""simple docstring"""






						_UpperCAmelCase			=       self.num_choices
						_UpperCAmelCase			=       TFConvBertForMultipleChoice(config=A)
						_UpperCAmelCase			=       tf.tile(tf.expand_dims(A			,		1)			,		(1, self.num_choices, 1))
						_UpperCAmelCase			=       tf.tile(tf.expand_dims(A			,		1)			,		(1, self.num_choices, 1))
						_UpperCAmelCase			=       tf.tile(tf.expand_dims(A			,		1)			,		(1, self.num_choices, 1))
						_UpperCAmelCase			=       {
						    'input_ids': multiple_choice_inputs_ids,
						    'attention_mask': multiple_choice_input_mask,
						    'token_type_ids': multiple_choice_token_type_ids,
						}
						_UpperCAmelCase			=       model(A)
						self.parent.assertEqual(result.logits.shape			,		(self.batch_size, self.num_choices))



			def    _lowerCamelCase	(						self       :  Optional[int]			,		A       :  Optional[Any]			,		A       :  Union[str, Any]			,		A       :  Optional[Any]			,		A       :  Dict			,		A       :  Optional[Any]			,		A       :  List[str]			,		A       :  List[Any])       ->   str:



						"""simple docstring"""






						_UpperCAmelCase			=       self.num_labels
						_UpperCAmelCase			=       TFConvBertForTokenClassification(config=A)
						_UpperCAmelCase			=       {
						    'input_ids': input_ids,
						    'attention_mask': input_mask,
						    'token_type_ids': token_type_ids,
						}
						_UpperCAmelCase			=       model(A)
						self.parent.assertEqual(result.logits.shape			,		(self.batch_size, self.seq_length, self.num_labels))



			def    _lowerCamelCase	(						self       :  Any			,		A       :  str			,		A       :  List[str]			,		A       :  Optional[int]			,		A       :  int			,		A       :  Optional[Any]			,		A       :  Optional[int]			,		A       :  List[Any])       ->   Tuple:



						"""simple docstring"""






						_UpperCAmelCase			=       TFConvBertForQuestionAnswering(config=A)
						_UpperCAmelCase			=       {
						    'input_ids': input_ids,
						    'attention_mask': input_mask,
						    'token_type_ids': token_type_ids,
						}

						_UpperCAmelCase			=       model(A)
						self.parent.assertEqual(result.start_logits.shape			,		(self.batch_size, self.seq_length))
						self.parent.assertEqual(result.end_logits.shape			,		(self.batch_size, self.seq_length))



			def    _lowerCamelCase	(						self       :  Union[str, Any])       ->   Tuple:



						"""simple docstring"""






						_UpperCAmelCase			=       self.prepare_config_and_inputs()
						(
						    (
						    _UpperCAmelCase
						)	,					(
						    _UpperCAmelCase
						)	,					(
						    _UpperCAmelCase
						)	,					(
						    _UpperCAmelCase
						)	,					(
						    _UpperCAmelCase
						)	,					(
						    _UpperCAmelCase
						)	,					(
						    _UpperCAmelCase
						)	,					
						)			=       config_and_inputs
						_UpperCAmelCase			=       {'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
						return config, inputs_dict







@require_tf
class       __lowerCAmelCase   (      A    ,						A    ,						unittest.TestCase						):
			UpperCamelCase        =					(
			    (
			        TFConvBertModel,
			        TFConvBertForMaskedLM,
			        TFConvBertForQuestionAnswering,
			        TFConvBertForSequenceClassification,
			        TFConvBertForTokenClassification,
			        TFConvBertForMultipleChoice,
			    )
			    if is_tf_available()
			    else ()
			)
			UpperCamelCase        =					(
			    {
			        '''feature-extraction''': TFConvBertModel,
			        '''fill-mask''': TFConvBertForMaskedLM,
			        '''question-answering''': TFConvBertForQuestionAnswering,
			        '''text-classification''': TFConvBertForSequenceClassification,
			        '''token-classification''': TFConvBertForTokenClassification,
			        '''zero-shot''': TFConvBertForSequenceClassification,
			    }
			    if is_tf_available()
			    else {}
			)
			UpperCamelCase        =					False
			UpperCamelCase        =					False
			UpperCamelCase        =					False



			def    _lowerCamelCase	(						self       :  List[str])       ->   Optional[int]:



						"""simple docstring"""






						_UpperCAmelCase			=       TFConvBertModelTester(self)
						_UpperCAmelCase			=       ConfigTester(self			,		config_class=A			,		hidden_size=37)



			def    _lowerCamelCase	(						self       :  List[Any])       ->   List[Any]:



						"""simple docstring"""






						self.config_tester.run_common_tests()



			def    _lowerCamelCase	(						self       :  Union[str, Any])       ->   int:



						"""simple docstring"""






						_UpperCAmelCase			=       self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_model(*A)



			def    _lowerCamelCase	(						self       :  Any)       ->   Optional[int]:



						"""simple docstring"""






						_UpperCAmelCase			=       self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_masked_lm(*A)



			def    _lowerCamelCase	(						self       :  Optional[Any])       ->   Dict:



						"""simple docstring"""






						_UpperCAmelCase			=       self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_multiple_choice(*A)



			def    _lowerCamelCase	(						self       :  Optional[int])       ->   Any:



						"""simple docstring"""






						_UpperCAmelCase			=       self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_question_answering(*A)



			def    _lowerCamelCase	(						self       :  int)       ->   Dict:



						"""simple docstring"""






						_UpperCAmelCase			=       self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_sequence_classification(*A)



			def    _lowerCamelCase	(						self       :  str)       ->   str:



						"""simple docstring"""






						_UpperCAmelCase			=       self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_token_classification(*A)



			@slow
			def    _lowerCamelCase	(						self       :  Tuple)       ->   int:



						"""simple docstring"""






						_UpperCAmelCase	,					_UpperCAmelCase			=       self.model_tester.prepare_config_and_inputs_for_common()
						_UpperCAmelCase			=       True
						_UpperCAmelCase			=       True

						if hasattr(A			,		'use_cache'):
									_UpperCAmelCase			=       True

						_UpperCAmelCase			=       getattr(self.model_tester			,		'encoder_seq_length'			,		self.model_tester.seq_length)
						_UpperCAmelCase			=       getattr(self.model_tester			,		'key_length'			,		A)

						for model_class in self.all_model_classes:
									_UpperCAmelCase			=       self._prepare_for_class(A			,		A)
									_UpperCAmelCase			=       model_class(A)
									_UpperCAmelCase			=       len(model(A))

									with tempfile.TemporaryDirectory() as tmpdirname:
												model.save_pretrained(A			,		saved_model=A)
												_UpperCAmelCase			=       os.path.join(A			,		'saved_model'			,		'1')
												_UpperCAmelCase			=       tf.keras.models.load_model(A)
												_UpperCAmelCase			=       model(A)

												if self.is_encoder_decoder:
															_UpperCAmelCase			=       outputs['encoder_hidden_states']
															_UpperCAmelCase			=       outputs['encoder_attentions']
												else:
															_UpperCAmelCase			=       outputs['hidden_states']
															_UpperCAmelCase			=       outputs['attentions']

												self.assertEqual(len(A)			,		A)

												_UpperCAmelCase			=       getattr(
												    self.model_tester			,		'expected_num_hidden_layers'			,		self.model_tester.num_hidden_layers + 1)

												self.assertEqual(len(A)			,		A)
												self.assertListEqual(
												    list(output_hidden_states[0].shape[-2:])			,		[self.model_tester.seq_length, self.model_tester.hidden_size]			,		)

												self.assertEqual(len(A)			,		self.model_tester.num_hidden_layers)
												self.assertListEqual(
												    list(output_attentions[0].shape[-3:])			,		[self.model_tester.num_attention_heads / 2, encoder_seq_length, encoder_key_length]			,		)



			@slow
			def    _lowerCamelCase	(						self       :  List[str])       ->   Optional[int]:



						"""simple docstring"""






						_UpperCAmelCase			=       TFConvBertModel.from_pretrained('YituTech/conv-bert-base')
						self.assertIsNotNone(A)



			def    _lowerCamelCase	(						self       :  List[Any])       ->   Dict:



						"""simple docstring"""






						_UpperCAmelCase	,					_UpperCAmelCase			=       self.model_tester.prepare_config_and_inputs_for_common()
						_UpperCAmelCase			=       True
						_UpperCAmelCase			=       getattr(self.model_tester			,		'decoder_seq_length'			,		self.model_tester.seq_length)
						_UpperCAmelCase			=       getattr(self.model_tester			,		'encoder_seq_length'			,		self.model_tester.seq_length)
						_UpperCAmelCase			=       getattr(self.model_tester			,		'key_length'			,		A)
						_UpperCAmelCase			=       getattr(self.model_tester			,		'key_length'			,		A)

						def check_decoder_attentions_output(A       :  Optional[int]):
									_UpperCAmelCase			=       len(A)
									self.assertEqual(out_len % 2			,		0)
									_UpperCAmelCase			=       outputs.decoder_attentions
									self.assertEqual(len(A)			,		self.model_tester.num_hidden_layers)
									self.assertListEqual(
									    list(decoder_attentions[0].shape[-3:])			,		[self.model_tester.num_attention_heads / 2, decoder_seq_length, decoder_key_length]			,		)

						def check_encoder_attentions_output(A       :  List[str]):
									_UpperCAmelCase			=       [
									    t.numpy() for t in (outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions)
									]
									self.assertEqual(len(A)			,		self.model_tester.num_hidden_layers)
									self.assertListEqual(
									    list(attentions[0].shape[-3:])			,		[self.model_tester.num_attention_heads / 2, encoder_seq_length, encoder_key_length]			,		)

						for model_class in self.all_model_classes:
									_UpperCAmelCase			=       True
									_UpperCAmelCase			=       False
									_UpperCAmelCase			=       model_class(A)
									_UpperCAmelCase			=       model(self._prepare_for_class(A			,		A))
									_UpperCAmelCase			=       len(A)
									self.assertEqual(config.output_hidden_states			,		A)
									check_encoder_attentions_output(A)

									if self.is_encoder_decoder:
												_UpperCAmelCase			=       model_class(A)
												_UpperCAmelCase			=       model(self._prepare_for_class(A			,		A))
												self.assertEqual(config.output_hidden_states			,		A)
												check_decoder_attentions_output(A)

									# Check that output attentions can also be changed via the config
									del inputs_dict["output_attentions"]
									_UpperCAmelCase			=       True
									_UpperCAmelCase			=       model_class(A)
									_UpperCAmelCase			=       model(self._prepare_for_class(A			,		A))
									self.assertEqual(config.output_hidden_states			,		A)
									check_encoder_attentions_output(A)

									# Check attention is always last and order is fine
									_UpperCAmelCase			=       True
									_UpperCAmelCase			=       True
									_UpperCAmelCase			=       model_class(A)
									_UpperCAmelCase			=       model(self._prepare_for_class(A			,		A))

									self.assertEqual(out_len + (2 if self.is_encoder_decoder else 1)			,		len(A))
									self.assertEqual(model.config.output_hidden_states			,		A)
									check_encoder_attentions_output(A)







@require_tf
class       __lowerCAmelCase   (      unittest.TestCase						):



			@slow
			def    _lowerCamelCase	(						self       :  Tuple)       ->   Any:



						"""simple docstring"""






						_UpperCAmelCase			=       TFConvBertModel.from_pretrained('YituTech/conv-bert-base')
						_UpperCAmelCase			=       tf.constant([[0, 1, 2, 3, 4, 5]])
						_UpperCAmelCase			=       model(A)[0]

						_UpperCAmelCase			=       [1, 6, 7_68]
						self.assertEqual(output.shape			,		A)

						_UpperCAmelCase			=       tf.constant(
						    [
						        [
						            [-0.0_3_4_7_5_4_9_3, -0.4_6_8_6_0_3_4, -0.3_0_6_3_8_8_3_2],
						            [0.2_2_6_3_7_2_4_8, -0.2_6_9_8_8_6_4_6, -0.7_4_2_3_4_2_4],
						            [0.1_0_3_2_4_8_6_8, -0.4_5_0_1_3_5_0_8, -0.5_8_2_8_0_7_8_4],
						        ]
						    ])
						tf.debugging.assert_near(output[:, :3, :3]			,		A			,		atol=1E-4)





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoFormerTokenizer
from .tokenization_utils import JiebaPreTokenizer


UpperCAmelCase__       =	logging.get_logger(__name__)

UpperCAmelCase__       =	{"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

UpperCAmelCase__       =	{
    "vocab_file": {
        "junnyu/roformer_chinese_small": "https://huggingface.co/junnyu/roformer_chinese_small/resolve/main/vocab.txt",
        "junnyu/roformer_chinese_base": "https://huggingface.co/junnyu/roformer_chinese_base/resolve/main/vocab.txt",
        "junnyu/roformer_chinese_char_small": (
            "https://huggingface.co/junnyu/roformer_chinese_char_small/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_chinese_char_base": (
            "https://huggingface.co/junnyu/roformer_chinese_char_base/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_small_discriminator": (
            "https://huggingface.co/junnyu/roformer_small_discriminator/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_small_generator": (
            "https://huggingface.co/junnyu/roformer_small_generator/resolve/main/vocab.txt"
        ),
    }
}

UpperCAmelCase__       =	{
    "junnyu/roformer_chinese_small": 1536,
    "junnyu/roformer_chinese_base": 1536,
    "junnyu/roformer_chinese_char_small": 512,
    "junnyu/roformer_chinese_char_base": 512,
    "junnyu/roformer_small_discriminator": 128,
    "junnyu/roformer_small_generator": 128,
}


UpperCAmelCase__       =	{
    "junnyu/roformer_chinese_small": {"do_lower_case": True},
    "junnyu/roformer_chinese_base": {"do_lower_case": True},
    "junnyu/roformer_chinese_char_small": {"do_lower_case": True},
    "junnyu/roformer_chinese_char_base": {"do_lower_case": True},
    "junnyu/roformer_small_discriminator": {"do_lower_case": True},
    "junnyu/roformer_small_generator": {"do_lower_case": True},
}







class       __lowerCAmelCase   (      A						):
			UpperCamelCase        =					VOCAB_FILES_NAMES
			UpperCamelCase        =					PRETRAINED_VOCAB_FILES_MAP
			UpperCamelCase        =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
			UpperCamelCase        =					PRETRAINED_INIT_CONFIGURATION
			UpperCamelCase        =					RoFormerTokenizer



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



						"""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			,		)

						_UpperCAmelCase			=       json.loads(self.backend_tokenizer.normalizer.__getstate__())
						if (
						    pre_tok_state.get('lowercase'			,		A) != do_lower_case
						    or pre_tok_state.get('strip_accents'			,		A) != strip_accents
						):
									_UpperCAmelCase			=       getattr(A			,		pre_tok_state.pop('type'))
									_UpperCAmelCase			=       do_lower_case
									_UpperCAmelCase			=       strip_accents
									_UpperCAmelCase			=       pre_tok_class(**A)

						_UpperCAmelCase			=       do_lower_case



			def __getstate__(						self       :  Optional[Any])       ->   Optional[Any]:



						"""simple docstring"""






						_UpperCAmelCase			=       self.__dict__.copy()
						_UpperCAmelCase			=       BertPreTokenizer()
						return state



			def __setstate__(						self       :  List[Any]			,		A       :  Optional[Any])       ->   List[str]:



						"""simple docstring"""






						_UpperCAmelCase			=       d
						_UpperCAmelCase			=       self.__dict__['_tokenizer'].get_vocab()
						_UpperCAmelCase			=       PreTokenizer.custom(JiebaPreTokenizer(A))



			def    _lowerCamelCase	(						self       :  List[Any]			,		A       :  Optional[int]			,		A       :  List[Any]=None)       ->   Optional[Any]:



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



						"""simple docstring"""






						_UpperCAmelCase			=       self._tokenizer.model.save(A			,		name=A)
						return tuple(A)



			def    _lowerCamelCase	(						self       :  List[Any]			,		A       :  Tuple			,		A       :  str=None			,		A       :  Union[str, Any]=None			,		A       :  Union[str, Any]=False			,		**A       :  Tuple			,		)       ->   str:



						"""simple docstring"""






						_UpperCAmelCase			=       BertPreTokenizer()
						return super().save_pretrained(A			,		A			,		A			,		A			,		**A)
