



'''simple docstring'''




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 			UpperCamelCase_ :





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





	def  _lowercase(  self    )			->			List[str]:
								UpperCAmelCase     :		List[str]							     =		ids_tensor([self.batch_size, self.seq_length]		,		self.vocab_size    )

								UpperCAmelCase     :		Union[str, Any]							     =		None
								if self.use_input_mask:
															UpperCAmelCase     :		Dict							     =		random_attention_mask([self.batch_size, self.seq_length]    )

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

								UpperCAmelCase     :		int							     =		None
								UpperCAmelCase     :		List[Any]							     =		None
								UpperCAmelCase     :		Any							     =		None
								if self.use_labels:
															UpperCAmelCase     :		int							     =		ids_tensor([self.batch_size]		,		self.type_sequence_label_size    )
															UpperCAmelCase     :		Any							     =		ids_tensor([self.batch_size, self.seq_length]		,		self.num_labels    )
															UpperCAmelCase     :		Tuple							     =		ids_tensor([self.batch_size]		,		self.num_choices    )

								UpperCAmelCase     :		Optional[Any]							     =		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  _lowercase(  self		,		A		,		A		,		A		,		A		,		A		,		A		,		A    )			->			Optional[Any]:
								UpperCAmelCase     :		List[Any]							     =		TFConvBertModel(config=A    )
								UpperCAmelCase     :		Dict							     =		{"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}

								UpperCAmelCase     :		Union[str, Any]							     =		[input_ids, input_mask]
								UpperCAmelCase     :		str							     =		model(A    )

								UpperCAmelCase     :		Tuple							     =		model(A    )

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





	def  _lowercase(  self		,		A		,		A		,		A		,		A		,		A		,		A		,		A    )			->			Any:
								UpperCAmelCase     :		Any							     =		TFConvBertForMaskedLM(config=A    )
								UpperCAmelCase     :		List[Any]							     =		{
								    """input_ids""": input_ids,
								    """attention_mask""": input_mask,
								    """token_type_ids""": token_type_ids,
								}
								UpperCAmelCase     :		List[Any]							     =		model(A    )
								self.parent.assertEqual(result.logits.shape		,		(self.batch_size, self.seq_length, self.vocab_size)    )





	def  _lowercase(  self		,		A		,		A		,		A		,		A		,		A		,		A		,		A    )			->			Tuple:
								UpperCAmelCase     :		Optional[Any]							     =		self.num_labels
								UpperCAmelCase     :		Optional[int]							     =		TFConvBertForSequenceClassification(config=A    )
								UpperCAmelCase     :		str							     =		{
								    """input_ids""": input_ids,
								    """attention_mask""": input_mask,
								    """token_type_ids""": token_type_ids,
								}

								UpperCAmelCase     :		Union[str, Any]							     =		model(A    )
								self.parent.assertEqual(result.logits.shape		,		(self.batch_size, self.num_labels)    )





	def  _lowercase(  self		,		A		,		A		,		A		,		A		,		A		,		A		,		A    )			->			Optional[Any]:
								UpperCAmelCase     :		Any							     =		self.num_choices
								UpperCAmelCase     :		Optional[Any]							     =		TFConvBertForMultipleChoice(config=A    )
								UpperCAmelCase     :		Optional[Any]							     =		tf.tile(tf.expand_dims(A		,		1    )		,		(1, self.num_choices, 1)    )
								UpperCAmelCase     :		Dict							     =		tf.tile(tf.expand_dims(A		,		1    )		,		(1, self.num_choices, 1)    )
								UpperCAmelCase     :		Any							     =		tf.tile(tf.expand_dims(A		,		1    )		,		(1, self.num_choices, 1)    )
								UpperCAmelCase     :		Union[str, Any]							     =		{
								    """input_ids""": multiple_choice_inputs_ids,
								    """attention_mask""": multiple_choice_input_mask,
								    """token_type_ids""": multiple_choice_token_type_ids,
								}
								UpperCAmelCase     :		Tuple							     =		model(A    )
								self.parent.assertEqual(result.logits.shape		,		(self.batch_size, self.num_choices)    )





	def  _lowercase(  self		,		A		,		A		,		A		,		A		,		A		,		A		,		A    )			->			Any:
								UpperCAmelCase     :		int							     =		self.num_labels
								UpperCAmelCase     :		Optional[int]							     =		TFConvBertForTokenClassification(config=A    )
								UpperCAmelCase     :		Union[str, Any]							     =		{
								    """input_ids""": input_ids,
								    """attention_mask""": input_mask,
								    """token_type_ids""": token_type_ids,
								}
								UpperCAmelCase     :		Dict							     =		model(A    )
								self.parent.assertEqual(result.logits.shape		,		(self.batch_size, self.seq_length, self.num_labels)    )





	def  _lowercase(  self		,		A		,		A		,		A		,		A		,		A		,		A		,		A    )			->			Union[str, Any]:
								UpperCAmelCase     :		Optional[int]							     =		TFConvBertForQuestionAnswering(config=A    )
								UpperCAmelCase     :		Optional[Any]							     =		{
								    """input_ids""": input_ids,
								    """attention_mask""": input_mask,
								    """token_type_ids""": token_type_ids,
								}

								UpperCAmelCase     :		List[str]							     =		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  _lowercase(  self    )			->			List[Any]:
								UpperCAmelCase     :		Optional[int]							     =		self.prepare_config_and_inputs()
								(
								    (
								    UpperCAmelCase
								)     ,     (
								    UpperCAmelCase
								)     ,     (
								    UpperCAmelCase
								)     ,     (
								    UpperCAmelCase
								)     ,     (
								    UpperCAmelCase
								)     ,     (
								    UpperCAmelCase
								)     ,     (
								    UpperCAmelCase
								)     ,     
								)     :		int							     =		config_and_inputs
								UpperCAmelCase     :		Union[str, Any]							     =		{"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
								return config, inputs_dict




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





	def  _lowercase(  self    )			->			List[Any]:
								UpperCAmelCase     :		List[Any]							     =		TFConvBertModelTester(self    )
								UpperCAmelCase     :		List[Any]							     =		ConfigTester(self		,		config_class=A		,		hidden_size=37    )





	def  _lowercase(  self    )			->			Any:
								self.config_tester.run_common_tests()





	def  _lowercase(  self    )			->			int:
								UpperCAmelCase     :		List[Any]							     =		self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*A    )





	def  _lowercase(  self    )			->			List[str]:
								UpperCAmelCase     :		Tuple							     =		self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_masked_lm(*A    )





	def  _lowercase(  self    )			->			Any:
								UpperCAmelCase     :		str							     =		self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_multiple_choice(*A    )





	def  _lowercase(  self    )			->			Dict:
								UpperCAmelCase     :		Optional[Any]							     =		self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_question_answering(*A    )





	def  _lowercase(  self    )			->			int:
								UpperCAmelCase     :		Any							     =		self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_sequence_classification(*A    )





	def  _lowercase(  self    )			->			int:
								UpperCAmelCase     :		Dict							     =		self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_token_classification(*A    )





	@slow
	def  _lowercase(  self    )			->			List[str]:
								UpperCAmelCase     ,     UpperCAmelCase     :		List[str]							     =		self.model_tester.prepare_config_and_inputs_for_common()
								UpperCAmelCase     :		List[Any]							     =		True
								UpperCAmelCase     :		int							     =		True

								if hasattr(A		,		"""use_cache"""    ):
															UpperCAmelCase     :		Union[str, Any]							     =		True

								UpperCAmelCase     :		Optional[int]							     =		getattr(self.model_tester		,		"""encoder_seq_length"""		,		self.model_tester.seq_length    )
								UpperCAmelCase     :		Tuple							     =		getattr(self.model_tester		,		"""key_length"""		,		A    )

								for model_class in self.all_model_classes:
															UpperCAmelCase     :		Union[str, Any]							     =		self._prepare_for_class(A		,		A    )
															UpperCAmelCase     :		Tuple							     =		model_class(A    )
															UpperCAmelCase     :		str							     =		len(model(A    )    )

															with tempfile.TemporaryDirectory() as tmpdirname:
																						model.save_pretrained(A		,		saved_model=A    )
																						UpperCAmelCase     :		List[Any]							     =		os.path.join(A		,		"""saved_model"""		,		"""1"""    )
																						UpperCAmelCase     :		Dict							     =		tf.keras.models.load_model(A    )
																						UpperCAmelCase     :		Optional[int]							     =		model(A    )

																						if self.is_encoder_decoder:
																													UpperCAmelCase     :		Dict							     =		outputs["""encoder_hidden_states"""]
																													UpperCAmelCase     :		Tuple							     =		outputs["""encoder_attentions"""]
																						else:
																													UpperCAmelCase     :		Tuple							     =		outputs["""hidden_states"""]
																													UpperCAmelCase     :		int							     =		outputs["""attentions"""]

																						self.assertEqual(len(A    )		,		A    )

																						UpperCAmelCase     :		str							     =		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  _lowercase(  self    )			->			Any:
								UpperCAmelCase     :		int							     =		TFConvBertModel.from_pretrained("""YituTech/conv-bert-base"""    )
								self.assertIsNotNone(A    )






	def  _lowercase(  self    )			->			str:
								UpperCAmelCase     ,     UpperCAmelCase     :		Tuple							     =		self.model_tester.prepare_config_and_inputs_for_common()
								UpperCAmelCase     :		Tuple							     =		True
								UpperCAmelCase     :		Optional[Any]							     =		getattr(self.model_tester		,		"""decoder_seq_length"""		,		self.model_tester.seq_length    )
								UpperCAmelCase     :		Union[str, Any]							     =		getattr(self.model_tester		,		"""encoder_seq_length"""		,		self.model_tester.seq_length    )
								UpperCAmelCase     :		str							     =		getattr(self.model_tester		,		"""key_length"""		,		A    )
								UpperCAmelCase     :		Tuple							     =		getattr(self.model_tester		,		"""key_length"""		,		A    )

								def check_decoder_attentions_output(A    ):
															UpperCAmelCase     :		Optional[Any]							     =		len(A    )
															self.assertEqual(out_len % 2		,		0    )
															UpperCAmelCase     :		Tuple							     =		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    ):
															UpperCAmelCase     :		Union[str, Any]							     =		[
															    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     :		int							     =		True
															UpperCAmelCase     :		Tuple							     =		False
															UpperCAmelCase     :		Dict							     =		model_class(A    )
															UpperCAmelCase     :		Dict							     =		model(self._prepare_for_class(A		,		A    )    )
															UpperCAmelCase     :		Union[str, Any]							     =		len(A    )
															self.assertEqual(config.output_hidden_states		,		A    )
															check_encoder_attentions_output(A    )

															if self.is_encoder_decoder:
																						UpperCAmelCase     :		List[Any]							     =		model_class(A    )
																						UpperCAmelCase     :		Dict							     =		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     :		List[str]							     =		True
															UpperCAmelCase     :		int							     =		model_class(A    )
															UpperCAmelCase     :		List[Any]							     =		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     :		Dict							     =		True
															UpperCAmelCase     :		Union[str, Any]							     =		True
															UpperCAmelCase     :		List[str]							     =		model_class(A    )
															UpperCAmelCase     :		str							     =		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 			UpperCamelCase_ (							unittest.TestCase			):





	@slow
	def  _lowercase(  self    )			->			List[str]:
								UpperCAmelCase     :		List[str]							     =		TFConvBertModel.from_pretrained("""YituTech/conv-bert-base"""    )
								UpperCAmelCase     :		Tuple							     =		tf.constant([[0, 1, 2, 3, 4, 5]]    )
								UpperCAmelCase     :		Tuple							     =		model(A    )[0]

								UpperCAmelCase     :		int							     =		[1, 6, 768]
								self.assertEqual(output.shape		,		A    )

								UpperCAmelCase     :		Union[str, Any]							     =		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    )






'''simple docstring'''




import unittest

from transformers import AlbertTokenizer, AlbertTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin


a   :			Any					  =    get_tests_dir("""fixtures/spiece.model""")

@require_sentencepiece
@require_tokenizers
class 			UpperCamelCase_ (							__magic_name__      ,     unittest.TestCase			):
	lowercase          = AlbertTokenizer
	lowercase          = AlbertTokenizerFast
	lowercase          = True
	lowercase          = True
	lowercase          = True





	def  _lowercase(  self    )			->			str:
								super().setUp()

								# We have a SentencePiece fixture for testing
								UpperCAmelCase     :		Optional[int]							     =		AlbertTokenizer(A    )
								tokenizer.save_pretrained(self.tmpdirname    )





	def  _lowercase(  self		,		A    )			->			int:
								UpperCAmelCase     :		Optional[int]							     =		"""this is a test"""
								UpperCAmelCase     :		Dict							     =		"""this is a test"""
								return input_text, output_text





	def  _lowercase(  self    )			->			int:
								UpperCAmelCase     :		Tuple							     =		"""<pad>"""
								UpperCAmelCase     :		Optional[int]							     =		0

								self.assertEqual(self.get_tokenizer()._convert_token_to_id(A    )		,		A    )
								self.assertEqual(self.get_tokenizer()._convert_id_to_token(A    )		,		A    )





	def  _lowercase(  self    )			->			Any:
								UpperCAmelCase     :		str							     =		list(self.get_tokenizer().get_vocab().keys()    )

								self.assertEqual(vocab_keys[0]		,		"""<pad>"""    )
								self.assertEqual(vocab_keys[1]		,		"""<unk>"""    )
								self.assertEqual(vocab_keys[-1]		,		"""▁eloquent"""    )
								self.assertEqual(len(A    )		,		30000    )





	def  _lowercase(  self    )			->			Tuple:
								self.assertEqual(self.get_tokenizer().vocab_size		,		30000    )





	def  _lowercase(  self    )			->			Union[str, Any]:
								if not self.test_rust_tokenizer:
															return

								UpperCAmelCase     :		int							     =		self.get_tokenizer()
								UpperCAmelCase     :		List[str]							     =		self.get_rust_tokenizer()

								UpperCAmelCase     :		Optional[Any]							     =		"""I was born in 92000, and this is falsé."""

								UpperCAmelCase     :		str							     =		tokenizer.tokenize(A    )
								UpperCAmelCase     :		Optional[int]							     =		rust_tokenizer.tokenize(A    )
								self.assertListEqual(A		,		A    )

								UpperCAmelCase     :		Any							     =		tokenizer.encode(A		,		add_special_tokens=A    )
								UpperCAmelCase     :		Optional[int]							     =		rust_tokenizer.encode(A		,		add_special_tokens=A    )
								self.assertListEqual(A		,		A    )

								UpperCAmelCase     :		Optional[Any]							     =		self.get_rust_tokenizer()
								UpperCAmelCase     :		Union[str, Any]							     =		tokenizer.encode(A    )
								UpperCAmelCase     :		Optional[int]							     =		rust_tokenizer.encode(A    )
								self.assertListEqual(A		,		A    )





	def  _lowercase(  self    )			->			Any:
								UpperCAmelCase     :		List[Any]							     =		AlbertTokenizer(A		,		keep_accents=A    )

								UpperCAmelCase     :		Optional[int]							     =		tokenizer.tokenize("""This is a test"""    )
								self.assertListEqual(A		,		["""▁this""", """▁is""", """▁a""", """▁test"""]    )

								self.assertListEqual(tokenizer.convert_tokens_to_ids(A    )		,		[48, 25, 21, 1289]    )

								UpperCAmelCase     :		Optional[Any]							     =		tokenizer.tokenize("""I was born in 92000, and this is falsé."""    )
								self.assertListEqual(
								    A		,		["""▁i""", """▁was""", """▁born""", """▁in""", """▁9""", """2000""", """,""", """▁and""", """▁this""", """▁is""", """▁fal""", """s""", """é""", """."""]    )
								UpperCAmelCase     :		str							     =		tokenizer.convert_tokens_to_ids(A    )
								self.assertListEqual(A		,		[31, 23, 386, 19, 561, 3050, 15, 17, 48, 25, 8256, 18, 1, 9]    )

								UpperCAmelCase     :		List[str]							     =		tokenizer.convert_ids_to_tokens(A    )
								self.assertListEqual(
								    A		,		["""▁i""", """▁was""", """▁born""", """▁in""", """▁9""", """2000""", """,""", """▁and""", """▁this""", """▁is""", """▁fal""", """s""", """<unk>""", """."""]		,		)





	def  _lowercase(  self    )			->			Optional[Any]:
								UpperCAmelCase     :		str							     =		AlbertTokenizer(A    )

								UpperCAmelCase     :		Optional[int]							     =		tokenizer.encode("""sequence builders"""    )
								UpperCAmelCase     :		Any							     =		tokenizer.encode("""multi-sequence build"""    )

								UpperCAmelCase     :		Optional[Any]							     =		tokenizer.build_inputs_with_special_tokens(A    )
								UpperCAmelCase     :		List[str]							     =		tokenizer.build_inputs_with_special_tokens(A		,		A    )

								assert encoded_sentence == [tokenizer.cls_token_id] + text + [tokenizer.sep_token_id]
								assert encoded_pair == [tokenizer.cls_token_id] + text + [tokenizer.sep_token_id] + text_a + [
								    tokenizer.sep_token_id
								]






	@slow
	def  _lowercase(  self    )			->			Dict:
								# fmt: off
								UpperCAmelCase     :		Tuple							     =		{"""attention_mask""": [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], """input_ids""": [[2, 21970, 13, 5, 6092, 167, 28, 7103, 2153, 673, 8, 7028, 12051, 18, 17, 7103, 2153, 673, 8, 3515, 18684, 8, 4461, 6, 1927, 297, 8, 12060, 2607, 18, 13, 5, 4461, 15, 10538, 38, 8, 135, 15, 822, 58, 15, 993, 10363, 15, 1460, 8005, 4461, 15, 993, 255, 2328, 9, 9, 9, 6, 26, 1112, 816, 3260, 13, 5, 103, 2377, 6, 17, 1112, 816, 2782, 13, 5, 103, 10641, 6, 29, 84, 2512, 2430, 782, 18684, 2761, 19, 808, 2430, 2556, 17, 855, 1480, 9477, 4091, 128, 11712, 15, 7103, 2153, 673, 17, 24883, 9990, 9, 3], [2, 11502, 25, 1006, 20, 782, 8, 11809, 855, 1732, 19393, 18667, 37, 367, 21018, 69, 1854, 34, 11860, 19124, 27, 156, 225, 17, 193, 4141, 19, 65, 9124, 9, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 14, 2231, 886, 2385, 17659, 84, 14, 16792, 1952, 9, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], """token_type_ids""": [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]}  # noqa: E501
								# fmt: on

								self.tokenizer_integration_test_util(
								    expected_encoding=A		,		model_name="""albert-base-v2"""		,		revision="""6b6560eaf5ff2e250b00c50f380c5389a9c2d82e"""		,		)

