




"""simple docstring"""


import unittest

from transformers import AutoTokenizer, FalconConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
     import torch

     from transformers import (
         FalconForCausalLM,
         FalconForQuestionAnswering,
         FalconForSequenceClassification,
         FalconForTokenClassification,
         FalconModel,
     )






class  lowercase:







 '''simple docstring'''





 def __init__(    self:		Optional[Any],				a_:		Dict,				a_:		List[str]=3,				a_:		Optional[Any]=7,				a_:		Any=True,				a_:		str=True,				a_:		Union[str, Any]=False,				a_:		Any=True,				a_:		List[Any]=99,				a_:		List[str]=32,				a_:		Any=5,				a_:		Optional[Any]=4,				a_:		List[str]=37,				a_:		List[str]="gelu",				a_:		Tuple=0.1,				a_:		str=0.1,				a_:		int=512,				a_:		List[str]=16,				a_:		Union[str, Any]=2,				a_:		Union[str, Any]=0.02,				a_:		List[Any]=3,				a_:		List[str]=4,				a_:		List[str]=None,				):




   '''simple docstring'''



   _snake_case							:		Optional[Any]								=  parent
   _snake_case							:		int								=  batch_size
   _snake_case							:		Optional[Any]								=  seq_length
   _snake_case							:		str								=  is_training
   _snake_case							:		int								=  use_input_mask
   _snake_case							:		Union[str, Any]								=  use_token_type_ids
   _snake_case							:		Optional[Any]								=  use_labels
   _snake_case							:		List[Any]								=  vocab_size
   _snake_case							:		Tuple								=  hidden_size
   _snake_case							:		Optional[Any]								=  num_hidden_layers
   _snake_case							:		Dict								=  num_attention_heads
   _snake_case							:		int								=  intermediate_size
   _snake_case							:		Optional[int]								=  hidden_act
   _snake_case							:		Any								=  hidden_dropout_prob
   _snake_case							:		List[Any]								=  attention_probs_dropout_prob
   _snake_case							:		Optional[Any]								=  max_position_embeddings
   _snake_case							:		List[str]								=  type_vocab_size
   _snake_case							:		Tuple								=  type_sequence_label_size
   _snake_case							:		Tuple								=  initializer_range
   _snake_case							:		Any								=  num_labels
   _snake_case							:		Optional[int]								=  num_choices
   _snake_case							:		Tuple								=  scope


 def 			UpperCamelCase_       (    self:		Union[str, Any]		):




   '''simple docstring'''



   _snake_case							:		Dict								=  ids_tensor([self.batch_size, self.seq_length],				self.vocab_size		)

   _snake_case							:		List[Any]								=  None
   if self.use_input_mask:
     _snake_case							:		Tuple								=  random_attention_mask([self.batch_size, self.seq_length]		)

   _snake_case							:		Dict								=  None

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

   _snake_case							:		Any								=  self.get_config()

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


 def 			UpperCamelCase_       (    self:		Optional[int]		):




   '''simple docstring'''



   return FalconConfig(
       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,				is_decoder=a_,				initializer_range=self.initializer_range,				pad_token_id=1,				new_decoder_architecture=a_,				)


 def 			UpperCamelCase_       (    self:		Any,				a_:		Any,				a_:		Optional[int],				a_:		str,				a_:		Union[str, Any],				a_:		Tuple,				a_:		Any,				a_:		List[Any]		):




   '''simple docstring'''



   _snake_case							:		Tuple								=  FalconModel(config=a_		)
   model.to(a_		)
   model.eval()
   _snake_case							:		List[Any]								=  model(a_,				attention_mask=a_		)
   _snake_case							:		Tuple								=  model(a_		)
   self.parent.assertEqual(result.last_hidden_state.shape,				(self.batch_size, self.seq_length, self.hidden_size)		)


 def 			UpperCamelCase_       (    self:		List[Any],				a_:		List[str],				a_:		Union[str, Any],				a_:		Optional[Any],				a_:		Union[str, Any],				a_:		Any,				a_:		List[Any],				a_:		int,				a_:		Tuple,				a_:		int,				):




   '''simple docstring'''



   _snake_case							:		List[str]								=  True
   _snake_case							:		Any								=  FalconModel(a_		)
   model.to(a_		)
   model.eval()
   _snake_case							:		Dict								=  model(
       a_,				attention_mask=a_,				encoder_hidden_states=a_,				encoder_attention_mask=a_,				)
   _snake_case							:		Any								=  model(
       a_,				attention_mask=a_,				encoder_hidden_states=a_,				)
   _snake_case							:		Optional[int]								=  model(a_,				attention_mask=a_		)
   self.parent.assertEqual(result.last_hidden_state.shape,				(self.batch_size, self.seq_length, self.hidden_size)		)


 def 			UpperCamelCase_       (    self:		Any,				a_:		str,				a_:		Any,				a_:		Optional[int],				a_:		Union[str, Any],				a_:		Union[str, Any],				a_:		Union[str, Any],				a_:		List[str],				a_:		List[str],				a_:		List[str],				):




   '''simple docstring'''



   _snake_case							:		Optional[int]								=  FalconForCausalLM(config=a_		)
   model.to(a_		)
   model.eval()
   _snake_case							:		Tuple								=  model(a_,				attention_mask=a_,				labels=a_		)
   self.parent.assertEqual(result.logits.shape,				(self.batch_size, self.seq_length, self.vocab_size)		)


 def 			UpperCamelCase_       (    self:		List[Any],				a_:		Union[str, Any],				a_:		Optional[Any],				a_:		Optional[int],				a_:		Any,				a_:		List[Any],				a_:		List[str],				a_:		List[str],				a_:		Tuple,				a_:		Optional[Any],				):




   '''simple docstring'''



   _snake_case							:		Optional[Any]								=  True
   _snake_case							:		List[Any]								=  True
   _snake_case							:		Tuple								=  FalconForCausalLM(config=a_		)
   model.to(a_		)
   model.eval()

   # first forward pass
   _snake_case							:		str								=  model(
       a_,				attention_mask=a_,				encoder_hidden_states=a_,				encoder_attention_mask=a_,				use_cache=a_,				)
   _snake_case							:		List[str]								=  outputs.past_key_values

   # create hypothetical multiple next token and extent to next_input_ids
   _snake_case							:		int								=  ids_tensor((self.batch_size, 3),				config.vocab_size		)
   _snake_case							:		int								=  ids_tensor((self.batch_size, 3),				vocab_size=2		)

   # append to next input_ids and
   _snake_case							:		int								=  torch.cat([input_ids, next_tokens],				dim=-1		)
   _snake_case							:		Optional[int]								=  torch.cat([input_mask, next_mask],				dim=-1		)

   _snake_case							:		Optional[int]								=  model(
       a_,				attention_mask=a_,				encoder_hidden_states=a_,				encoder_attention_mask=a_,				output_hidden_states=a_,				)["""hidden_states"""][0]
   _snake_case							:		str								=  model(
       a_,				attention_mask=a_,				encoder_hidden_states=a_,				encoder_attention_mask=a_,				past_key_values=a_,				output_hidden_states=a_,				)["""hidden_states"""][0]

   # select random slice
   _snake_case							:		Optional[int]								=  ids_tensor((1,),				output_from_past.shape[-1]		).item()
   _snake_case							:		int								=  output_from_no_past[:, -3:, random_slice_idx].detach()
   _snake_case							:		int								=  output_from_past[:, :, random_slice_idx].detach()

   self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]		)

   # test that outputs are equal for slice
   self.parent.assertTrue(torch.allclose(a_,				a_,				atol=1E-3		)		)


 def 			UpperCamelCase_       (    self:		str		):




   '''simple docstring'''



   _snake_case							:		Union[str, Any]								=  self.prepare_config_and_inputs()
   (
       _snake_case 
   )							:		Tuple								=  config_and_inputs
   _snake_case							:		Dict								=  {"""input_ids""": input_ids, """attention_mask""": input_mask}
   return config, inputs_dict







@require_torch
class  lowercase(					__a	,      __a	,      __a	,      unittest.TestCase			):







 '''simple docstring'''





 lowercase__			 = (
     (
         FalconModel,
         FalconForCausalLM,
         FalconForSequenceClassification,
         FalconForTokenClassification,
         FalconForQuestionAnswering,
     )
     if is_torch_available()
     else ()
 )
 lowercase__			 = (FalconForCausalLM,) if is_torch_available() else ()
 lowercase__			 = (
     {
         "feature-extraction": FalconModel,
         "text-classification": FalconForSequenceClassification,
         "text-generation": FalconForCausalLM,
         "question-answering": FalconForQuestionAnswering,
         "token-classification": FalconForTokenClassification,
         "zero-shot": FalconForSequenceClassification,
     }
     if is_torch_available()
     else {}
 )
 lowercase__			 = False
 lowercase__			 = False


 def 			UpperCamelCase_       (    self:		str		):




   '''simple docstring'''



   _snake_case							:		Optional[Any]								=  FalconModelTester(self		)
   _snake_case							:		Union[str, Any]								=  ConfigTester(self,				config_class=a_,				hidden_size=37		)


 def 			UpperCamelCase_       (    self:		int		):




   '''simple docstring'''



   self.config_tester.run_common_tests()


 def 			UpperCamelCase_       (    self:		List[Any]		):




   '''simple docstring'''



   _snake_case							:		Union[str, Any]								=  self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_model(*a_		)


 def 			UpperCamelCase_       (    self:		Any		):




   '''simple docstring'''



   _snake_case							:		Tuple								=  self.model_tester.prepare_config_and_inputs()
   for alibi in [True, False]:
     _snake_case							:		str								=  alibi
     self.model_tester.create_and_check_model(a_,				*a_		)


 def 			UpperCamelCase_       (    self:		Union[str, Any]		):




   '''simple docstring'''



   _snake_case							:		Dict								=  self.model_tester.prepare_config_and_inputs_for_common()
   _snake_case							:		Optional[Any]								=  3
   _snake_case							:		List[Any]								=  input_dict["""input_ids"""]
   _snake_case							:		List[str]								=  input_ids.ne(1		).to(a_		)
   _snake_case							:		Tuple								=  ids_tensor([self.model_tester.batch_size],				self.model_tester.type_sequence_label_size		)
   _snake_case							:		Optional[int]								=  FalconForSequenceClassification(a_		)
   model.to(a_		)
   model.eval()
   _snake_case							:		Any								=  model(a_,				attention_mask=a_,				labels=a_		)
   self.assertEqual(result.logits.shape,				(self.model_tester.batch_size, self.model_tester.num_labels)		)


 def 			UpperCamelCase_       (    self:		Tuple		):




   '''simple docstring'''



   _snake_case							:		List[str]								=  self.model_tester.prepare_config_and_inputs_for_common()
   _snake_case							:		List[Any]								=  3
   _snake_case							:		Optional[int]								=  """single_label_classification"""
   _snake_case							:		Any								=  input_dict["""input_ids"""]
   _snake_case							:		Optional[int]								=  input_ids.ne(1		).to(a_		)
   _snake_case							:		Tuple								=  ids_tensor([self.model_tester.batch_size],				self.model_tester.type_sequence_label_size		)
   _snake_case							:		Tuple								=  FalconForSequenceClassification(a_		)
   model.to(a_		)
   model.eval()
   _snake_case							:		Dict								=  model(a_,				attention_mask=a_,				labels=a_		)
   self.assertEqual(result.logits.shape,				(self.model_tester.batch_size, self.model_tester.num_labels)		)


 def 			UpperCamelCase_       (    self:		Dict		):




   '''simple docstring'''



   _snake_case							:		Union[str, Any]								=  self.model_tester.prepare_config_and_inputs_for_common()
   _snake_case							:		str								=  input_dict["""input_ids"""]
   _snake_case							:		Tuple								=  FalconForCausalLM(a_		)
   model.to(a_		)
   model.eval()
   _snake_case							:		Dict								=  model(a_,				use_cache=a_		)
   _snake_case							:		Union[str, Any]								=  input_ids.shape[0]
   _snake_case							:		Tuple								=  model._convert_to_rw_cache(result.past_key_values		)
   _snake_case							:		Optional[Any]								=  model._convert_cache_to_standard_format(a_,				a_		)
   for layer in range(len(a_		)		):
     for tensor_idx in range(2		):
       self.assertTrue(rw_cache[layer][tensor_idx].ndim == 3		)
       self.assertTrue(result.past_key_values[layer][tensor_idx].ndim == 4		)
       self.assertTrue(
           torch.all(result.past_key_values[layer][tensor_idx] == standard_cache[layer][tensor_idx]		)		)


 def 			UpperCamelCase_       (    self:		List[str]		):




   '''simple docstring'''



   _snake_case							:		Dict								=  self.model_tester.prepare_config_and_inputs_for_common()
   _snake_case							:		Tuple								=  3
   _snake_case							:		List[Any]								=  """multi_label_classification"""
   _snake_case							:		Tuple								=  input_dict["""input_ids"""]
   _snake_case							:		str								=  input_ids.ne(1		).to(a_		)
   _snake_case							:		Any								=  ids_tensor(
       [self.model_tester.batch_size, config.num_labels],				self.model_tester.type_sequence_label_size		).to(torch.float		)
   _snake_case							:		Optional[int]								=  FalconForSequenceClassification(a_		)
   model.to(a_		)
   model.eval()
   _snake_case							:		Optional[int]								=  model(a_,				attention_mask=a_,				labels=a_		)
   self.assertEqual(result.logits.shape,				(self.model_tester.batch_size, self.model_tester.num_labels)		)


 def 			UpperCamelCase_       (    self:		Any		):




   '''simple docstring'''



   for model_class in self.all_generative_model_classes:
     _snake_case							:		List[str]								=  self.model_tester.prepare_config_and_inputs_for_common()

     # If it doesn't support cache, pass the test
     if not hasattr(a_,				"""use_cache"""		):
       return

     _snake_case							:		int								=  model_class(a_		).to(a_		)
     if "use_cache" not in inputs:
       _snake_case							:		List[Any]								=  True
     _snake_case							:		Optional[Any]								=  model(**a_		)

     # If "past_key_values" is not returned, pass the test (e.g. RWKV uses a different cache name and format)
     if "past_key_values" not in outputs:
       return

     _snake_case							:		int								=  (
         getattr(a_,				"""decoder_layers""",				a_		)
         or getattr(a_,				"""num_decoder_layers""",				a_		)
         or config.num_hidden_layers
     )
     _snake_case							:		List[Any]								=  getattr(a_,				"""num_kv_heads""",				config.num_attention_heads		)
     _snake_case							:		Optional[Any]								=  getattr(a_,				"""d_model""",				config.hidden_size		)
     _snake_case							:		Union[str, Any]								=  embed_dim // num_attention_heads

     _snake_case							:		Tuple								=  outputs["""past_key_values"""]
     self.assertEqual(len(a_		),				a_		)

     _snake_case							:		List[Any]								=  inputs["""input_ids"""].shape
     for i in range(a_		):
       if config.new_decoder_architecture:
         _snake_case							:		int								=  config.num_attention_heads
       elif config.multi_query:
         _snake_case							:		Any								=  1
       self.assertEqual(len(past_kv[0]		),				2		)  # K V for the decoder = 2
       self.assertEqual(
           past_kv[i][0].shape,				(batch_size, num_attention_heads, seq_length, per_head_embed_dim)		)
       self.assertEqual(
           past_kv[i][1].shape,				(batch_size, num_attention_heads, seq_length, per_head_embed_dim)		)







@require_torch
class  lowercase(					unittest.TestCase			):







 '''simple docstring'''





 @slow
 def 			UpperCamelCase_       (    self:		Any		):




   '''simple docstring'''



   _snake_case							:		Tuple								=  AutoTokenizer.from_pretrained("""Rocketknight1/falcon-rw-1b"""		)
   _snake_case							:		str								=  FalconForCausalLM.from_pretrained("""Rocketknight1/falcon-rw-1b"""		)
   model.eval()
   model.to(a_		)
   _snake_case							:		Union[str, Any]								=  tokenizer("""My favorite food is""",				return_tensors="""pt"""		).to(a_		)

   _snake_case							:		List[Any]								=  (
       """My favorite food is pizza. I love it so much that I have a pizza party every year for my birthday."""
   )

   _snake_case							:		Optional[Any]								=  model.generate(**a_,				do_sample=a_,				max_new_tokens=19		)
   _snake_case							:		List[str]								=  tokenizer.batch_decode(a_		)[0]

   self.assertEqual(a_,				a_		)


 @slow
 def 			UpperCamelCase_       (    self:		Tuple		):




   '''simple docstring'''



   for repo in ["Rocketknight1/tiny-random-falcon-7b", "Rocketknight1/tiny-random-falcon-40b"]:
     _snake_case							:		str								=  AutoTokenizer.from_pretrained(a_		)
     _snake_case							:		List[str]								=  FalconForCausalLM.from_pretrained(a_		)
     model.eval()
     model.to(a_		)
     _snake_case							:		Any								=  tokenizer("""My favorite food is""",				return_tensors="""pt"""		).to(a_		)

     # We just test that these run without errors - the models are randomly initialized
     # and so the actual text outputs will be garbage
     model.generate(**a_,				do_sample=a_,				max_new_tokens=4		)
     model.generate(**a_,				do_sample=a_,				max_new_tokens=4		)
     model.generate(**a_,				num_beams=2,				max_new_tokens=4		)


 @slow
 def 			UpperCamelCase_       (    self:		Union[str, Any]		):




   '''simple docstring'''



   with torch.no_grad():
     for repo in [
         "Rocketknight1/falcon-rw-1b",
         "Rocketknight1/tiny-random-falcon-7b",
         "Rocketknight1/tiny-random-falcon-40b",
     ]:
       _snake_case							:		Any								=  AutoTokenizer.from_pretrained(a_		)
       _snake_case							:		int								=  FalconForCausalLM.from_pretrained(a_		)
       model.eval()
       model.to(device=a_		)
       _snake_case							:		Optional[int]								=  tokenizer("""My favorite food is""",				return_tensors="""pt"""		).to(a_		)

       # Test results are the same with and without cache
       _snake_case							:		Optional[int]								=  model.generate(**a_,				do_sample=a_,				max_new_tokens=20,				use_cache=a_		)
       _snake_case							:		List[Any]								=  model.generate(**a_,				do_sample=a_,				max_new_tokens=20,				use_cache=a_		)
       self.assertTrue((outputs_cache - outputs_no_cache).sum().item() == 0		)





"""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_      =    get_tests_dir('''fixtures/spiece.model''')






@require_sentencepiece
@require_tokenizers
class  lowercase(					__a	,      unittest.TestCase			):







 '''simple docstring'''





 lowercase__			 = AlbertTokenizer
 lowercase__			 = AlbertTokenizerFast
 lowercase__			 = True
 lowercase__			 = True
 lowercase__			 = True


 def 			UpperCamelCase_       (    self:		str		):




   '''simple docstring'''



   super().setUp()

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


 def 			UpperCamelCase_       (    self:		Optional[int],				a_:		int		):




   '''simple docstring'''



   _snake_case							:		Dict								=  """this is a test"""
   _snake_case							:		Optional[int]								=  """this is a test"""
   return input_text, output_text


 def 			UpperCamelCase_       (    self:		str		):




   '''simple docstring'''



   _snake_case							:		str								=  """<pad>"""
   _snake_case							:		List[Any]								=  0

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


 def 			UpperCamelCase_       (    self:		Dict		):




   '''simple docstring'''



   _snake_case							:		Union[str, Any]								=  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_		),				30_000		)


 def 			UpperCamelCase_       (    self:		Optional[int]		):




   '''simple docstring'''



   self.assertEqual(self.get_tokenizer().vocab_size,				30_000		)


 def 			UpperCamelCase_       (    self:		List[str]		):




   '''simple docstring'''



   if not self.test_rust_tokenizer:
     return

   _snake_case							:		Tuple								=  self.get_tokenizer()
   _snake_case							:		List[str]								=  self.get_rust_tokenizer()

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

   _snake_case							:		Optional[Any]								=  tokenizer.tokenize(a_		)
   _snake_case							:		List[str]								=  rust_tokenizer.tokenize(a_		)
   self.assertListEqual(a_,				a_		)

   _snake_case							:		Any								=  tokenizer.encode(a_,				add_special_tokens=a_		)
   _snake_case							:		Any								=  rust_tokenizer.encode(a_,				add_special_tokens=a_		)
   self.assertListEqual(a_,				a_		)

   _snake_case							:		int								=  self.get_rust_tokenizer()
   _snake_case							:		Dict								=  tokenizer.encode(a_		)
   _snake_case							:		Optional[int]								=  rust_tokenizer.encode(a_		)
   self.assertListEqual(a_,				a_		)


 def 			UpperCamelCase_       (    self:		Optional[Any]		):




   '''simple docstring'''



   _snake_case							:		Any								=  AlbertTokenizer(a_,				keep_accents=a_		)

   _snake_case							:		Any								=  tokenizer.tokenize("""This is a test"""		)
   self.assertListEqual(a_,				["""▁this""", """▁is""", """▁a""", """▁test"""]		)

   self.assertListEqual(tokenizer.convert_tokens_to_ids(a_		),				[48, 25, 21, 1_289]		)

   _snake_case							:		Dict								=  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""", """é""", """."""]		)
   _snake_case							:		str								=  tokenizer.convert_tokens_to_ids(a_		)
   self.assertListEqual(a_,				[31, 23, 386, 19, 561, 3_050, 15, 17, 48, 25, 8_256, 18, 1, 9]		)

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


 def 			UpperCamelCase_       (    self:		Optional[Any]		):




   '''simple docstring'''



   _snake_case							:		Optional[Any]								=  AlbertTokenizer(a_		)

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

   _snake_case							:		Any								=  tokenizer.build_inputs_with_special_tokens(a_		)
   _snake_case							:		Union[str, Any]								=  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 			UpperCamelCase_       (    self:		Dict		):




   '''simple docstring'''



   _snake_case							:		Any								=  {"""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, 21_970, 13, 5, 6_092, 167, 28, 7_103, 2_153, 673, 8, 7_028, 12_051, 18, 17, 7_103, 2_153, 673, 8, 3_515, 18_684, 8, 4_461, 6, 1_927, 297, 8, 12_060, 2_607, 18, 13, 5, 4_461, 15, 10_538, 38, 8, 135, 15, 822, 58, 15, 993, 10_363, 15, 1_460, 8_005, 4_461, 15, 993, 255, 2_328, 9, 9, 9, 6, 26, 1_112, 816, 3_260, 13, 5, 103, 2_377, 6, 17, 1_112, 816, 2_782, 13, 5, 103, 10_641, 6, 29, 84, 2_512, 2_430, 782, 18_684, 2_761, 19, 808, 2_430, 2_556, 17, 855, 1_480, 9_477, 4_091, 128, 11_712, 15, 7_103, 2_153, 673, 17, 24_883, 9_990, 9, 3], [2, 11_502, 25, 1_006, 20, 782, 8, 11_809, 855, 1_732, 19_393, 18_667, 37, 367, 21_018, 69, 1_854, 34, 11_860, 19_124, 27, 156, 225, 17, 193, 4_141, 19, 65, 9_124, 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, 2_231, 886, 2_385, 17_659, 84, 14, 16_792, 1_952, 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""",				)


