
'''simple docstring'''





import gc
import random
import unittest

import torch

from diffusers import (
    IFImgaImgPipeline,
    IFImgaImgSuperResolutionPipeline,
    IFInpaintingPipeline,
    IFInpaintingSuperResolutionPipeline,
    IFPipeline,
    IFSuperResolutionPipeline,
)
from diffusers.models.attention_processor import AttnAddedKVProcessor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import floats_tensor, load_numpy, require_torch_gpu, skip_mps, slow, torch_device

from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference
from . import IFPipelineTesterMixin


@skip_mps
class        UpperCamelCase__     (			snake_case__					,   snake_case__					,   unittest.TestCase):
 UpperCAmelCase__			:			str   =    IFPipeline
 UpperCAmelCase__			:			List[Any]   =    TEXT_TO_IMAGE_PARAMS - {"""width""", """height""", """latents"""}
 UpperCAmelCase__			:			Any   =    TEXT_TO_IMAGE_BATCH_PARAMS
 UpperCAmelCase__			:			Dict   =    PipelineTesterMixin.required_optional_params - {"""latents"""}






 def 		lowercase_  (	self     :Tuple	) ->	List[Any]:







       '''simple docstring'''



       return self._get_dummy_components()






 def 		lowercase_  (	self     :str		, _A     :int		, _A     :Optional[int]=0	) ->	Optional[Any]:







       '''simple docstring'''



       if str(_A	).startswith('mps'	):
             __A						=	torch.manual_seed(_A	)
       else:
             __A						=	torch.Generator(device=_A	).manual_seed(_A	)

       __A						=	{
           'prompt': 'A painting of a squirrel eating a burger',
           'generator': generator,
           'num_inference_steps': 2,
           'output_type': 'numpy',
       }

       return inputs






 def 		lowercase_  (	self     :Union[str, Any]	) ->	Optional[Any]:







       '''simple docstring'''



       self._test_save_load_optional_components()






 @unittest.skipIf(torch_device != 'cuda'		, reason='float16 requires CUDA'	)
 def 		lowercase_  (	self     :int	) ->	Optional[int]:







       '''simple docstring'''



       super().test_save_load_floataa(expected_max_diff=1E-1	)






 def 		lowercase_  (	self     :Optional[Any]	) ->	str:







       '''simple docstring'''



       self._test_attention_slicing_forward_pass(expected_max_diff=1E-2	)






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







       '''simple docstring'''



       self._test_save_load_local()






 def 		lowercase_  (	self     :Dict	) ->	List[str]:







       '''simple docstring'''



       self._test_inference_batch_single_identical(
           expected_max_diff=1E-2		, )






 @unittest.skipIf(
     torch_device != 'cuda' or not is_xformers_available()		, reason='XFormers attention is only available with CUDA and `xformers` installed'		, )
 def 		lowercase_  (	self     :Tuple	) ->	Dict:







       '''simple docstring'''



       self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1E-3	)


@slow
@require_torch_gpu
class        UpperCamelCase__     (			unittest.TestCase):






 def 		lowercase_  (	self     :Tuple	) ->	str:







       '''simple docstring'''



       super().tearDown()
       gc.collect()
       torch.cuda.empty_cache()






 def 		lowercase_  (	self     :Dict	) ->	Optional[int]:







       '''simple docstring'''



       __A						=	IFPipeline.from_pretrained('DeepFloyd/IF-I-XL-v1.0'		, variant='fp16'		, torch_dtype=torch.floataa	)

       __A						=	IFSuperResolutionPipeline.from_pretrained(
           'DeepFloyd/IF-II-L-v1.0'		, variant='fp16'		, torch_dtype=torch.floataa		, text_encoder=_A		, tokenizer=_A	)

       # pre compute text embeddings and remove T5 to save memory

       pipe_a.text_encoder.to('cuda'	)

       __A		,					__A						=	pipe_a.encode_prompt('anime turtle'		, device='cuda'	)

       del pipe_a.tokenizer
       del pipe_a.text_encoder
       gc.collect()

       __A						=	None
       __A						=	None

       pipe_a.enable_model_cpu_offload()
       pipe_a.enable_model_cpu_offload()

       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()	)
       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()	)

       self._test_if(_A		, _A		, _A		, _A	)

       pipe_a.remove_all_hooks()
       pipe_a.remove_all_hooks()

       # img2img

       __A						=	IFImgaImgPipeline(**pipe_a.components	)
       __A						=	IFImgaImgSuperResolutionPipeline(**pipe_a.components	)

       pipe_a.enable_model_cpu_offload()
       pipe_a.enable_model_cpu_offload()

       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()	)
       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()	)

       self._test_if_imgaimg(_A		, _A		, _A		, _A	)

       pipe_a.remove_all_hooks()
       pipe_a.remove_all_hooks()

       # inpainting

       __A						=	IFInpaintingPipeline(**pipe_a.components	)
       __A						=	IFInpaintingSuperResolutionPipeline(**pipe_a.components	)

       pipe_a.enable_model_cpu_offload()
       pipe_a.enable_model_cpu_offload()

       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()	)
       pipe_a.unet.set_attn_processor(AttnAddedKVProcessor()	)

       self._test_if_inpainting(_A		, _A		, _A		, _A	)






 def 		lowercase_  (	self     :Optional[Any]		, _A     :Dict		, _A     :int		, _A     :Optional[Any]		, _A     :Dict	) ->	Dict:







       '''simple docstring'''



       _start_torch_memory_measurement()

       __A						=	torch.Generator(device='cpu'	).manual_seed(0	)
       __A						=	pipe_a(
           prompt_embeds=_A		, negative_prompt_embeds=_A		, num_inference_steps=2		, generator=_A		, output_type='np'		, )

       __A						=	output.images[0]

       assert image.shape == (64, 64, 3)

       __A						=	torch.cuda.max_memory_allocated()
       assert mem_bytes < 13 * 10**9

       __A						=	load_numpy(
           'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if.npy'	)
       assert_mean_pixel_difference(_A		, _A	)

       # pipeline 2

       _start_torch_memory_measurement()

       __A						=	torch.Generator(device='cpu'	).manual_seed(0	)

       __A						=	floats_tensor((1, 3, 64, 64)		, rng=random.Random(0	)	).to(_A	)

       __A						=	pipe_a(
           prompt_embeds=_A		, negative_prompt_embeds=_A		, image=_A		, generator=_A		, num_inference_steps=2		, output_type='np'		, )

       __A						=	output.images[0]

       assert image.shape == (256, 256, 3)

       __A						=	torch.cuda.max_memory_allocated()
       assert mem_bytes < 4 * 10**9

       __A						=	load_numpy(
           'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_superresolution_stage_II.npy'	)
       assert_mean_pixel_difference(_A		, _A	)






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







       '''simple docstring'''



       _start_torch_memory_measurement()

       __A						=	floats_tensor((1, 3, 64, 64)		, rng=random.Random(0	)	).to(_A	)

       __A						=	torch.Generator(device='cpu'	).manual_seed(0	)

       __A						=	pipe_a(
           prompt_embeds=_A		, negative_prompt_embeds=_A		, image=_A		, num_inference_steps=2		, generator=_A		, output_type='np'		, )

       __A						=	output.images[0]

       assert image.shape == (64, 64, 3)

       __A						=	torch.cuda.max_memory_allocated()
       assert mem_bytes < 10 * 10**9

       __A						=	load_numpy(
           'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_img2img.npy'	)
       assert_mean_pixel_difference(_A		, _A	)

       # pipeline 2

       _start_torch_memory_measurement()

       __A						=	torch.Generator(device='cpu'	).manual_seed(0	)

       __A						=	floats_tensor((1, 3, 256, 256)		, rng=random.Random(0	)	).to(_A	)
       __A						=	floats_tensor((1, 3, 64, 64)		, rng=random.Random(0	)	).to(_A	)

       __A						=	pipe_a(
           prompt_embeds=_A		, negative_prompt_embeds=_A		, image=_A		, original_image=_A		, generator=_A		, num_inference_steps=2		, output_type='np'		, )

       __A						=	output.images[0]

       assert image.shape == (256, 256, 3)

       __A						=	torch.cuda.max_memory_allocated()
       assert mem_bytes < 4 * 10**9

       __A						=	load_numpy(
           'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_img2img_superresolution_stage_II.npy'	)
       assert_mean_pixel_difference(_A		, _A	)






 def 		lowercase_  (	self     :Tuple		, _A     :Dict		, _A     :Optional[Any]		, _A     :Optional[int]		, _A     :Dict	) ->	str:







       '''simple docstring'''



       _start_torch_memory_measurement()

       __A						=	floats_tensor((1, 3, 64, 64)		, rng=random.Random(0	)	).to(_A	)
       __A						=	floats_tensor((1, 3, 64, 64)		, rng=random.Random(1	)	).to(_A	)

       __A						=	torch.Generator(device='cpu'	).manual_seed(0	)
       __A						=	pipe_a(
           prompt_embeds=_A		, negative_prompt_embeds=_A		, image=_A		, mask_image=_A		, num_inference_steps=2		, generator=_A		, output_type='np'		, )

       __A						=	output.images[0]

       assert image.shape == (64, 64, 3)

       __A						=	torch.cuda.max_memory_allocated()
       assert mem_bytes < 10 * 10**9

       __A						=	load_numpy(
           'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_inpainting.npy'	)
       assert_mean_pixel_difference(_A		, _A	)

       # pipeline 2

       _start_torch_memory_measurement()

       __A						=	torch.Generator(device='cpu'	).manual_seed(0	)

       __A						=	floats_tensor((1, 3, 64, 64)		, rng=random.Random(0	)	).to(_A	)
       __A						=	floats_tensor((1, 3, 256, 256)		, rng=random.Random(0	)	).to(_A	)
       __A						=	floats_tensor((1, 3, 256, 256)		, rng=random.Random(1	)	).to(_A	)

       __A						=	pipe_a(
           prompt_embeds=_A		, negative_prompt_embeds=_A		, image=_A		, mask_image=_A		, original_image=_A		, generator=_A		, num_inference_steps=2		, output_type='np'		, )

       __A						=	output.images[0]

       assert image.shape == (256, 256, 3)

       __A						=	torch.cuda.max_memory_allocated()
       assert mem_bytes < 4 * 10**9

       __A						=	load_numpy(
           'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/if/test_if_inpainting_superresolution_stage_II.npy'	)
       assert_mean_pixel_difference(_A		, _A	)





def 				snake_case							(						)->	Union[str, Any]:







      """simple docstring"""
      torch.cuda.empty_cache()
      torch.cuda.reset_max_memory_allocated()
      torch.cuda.reset_peak_memory_stats()












import unittest

from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin


UpperCamelCase__    			=			get_tests_dir("""fixtures/spiece.model""")
@require_sentencepiece
@require_tokenizers
class 			a__    (					snake_case__ ,				unittest.TestCase      ):
						_a							:    Optional[Any]					=    DebertaVaTokenizer
						_a							:    Optional[Any]					=    DebertaVaTokenizerFast
						_a							:    List[str]					=    True
						_a							:    Optional[Any]					=    True






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											super().setUp()

											# We have a SentencePiece fixture for testing
											__lowerCAmelCase				   =       DebertaVaTokenizer(_A		,			unk_token="<unk>"			)
											tokenizer.save_pretrained(self.tmpdirname			)






						def 				__SCREAMING_SNAKE_CASE(   self		,			_A			):




											"""simple docstring"""



											__lowerCAmelCase				   =       "this is a test"
											__lowerCAmelCase				   =       "this is a test"
											return input_text, output_text






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       "<pad>"
											__lowerCAmelCase				   =       0

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






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       list(self.get_tokenizer().get_vocab().keys()			)
											self.assertEqual(vocab_keys[0]		,			"<pad>"			)
											self.assertEqual(vocab_keys[1]		,			"<unk>"			)
											self.assertEqual(vocab_keys[-1]		,			"[PAD]"			)
											self.assertEqual(len(_A			)		,			3_0_0_0_1			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											self.assertEqual(self.get_tokenizer().vocab_size		,			3_0_0_0_0			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       " \tHeLLo!how  \n Are yoU?  "
											__lowerCAmelCase				   =       ["▁hello", "!", "how", "▁are", "▁you", "?"]
											# fmt: on

											__lowerCAmelCase				   =       DebertaVaTokenizer(_A		,			do_lower_case=_A			)
											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       DebertaVaTokenizerFast(_A		,			do_lower_case=_A			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)






						@unittest.skip("There is an inconsistency between slow and fast tokenizer due to a bug in the fast one."			)
						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											pass






						@unittest.skip("There is an inconsistency between slow and fast tokenizer due to a bug in the fast one."			)
						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											pass






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       "I was born in 92000, and this is falsé."
											__lowerCAmelCase				   =       ["▁", "<unk>", "▁was", "▁born", "▁in", "▁9", "2000", "▁", ",", "▁and", "▁this", "▁is", "▁fal", "s", "<unk>", "▁", ".", ]
											# fmt: on

											__lowerCAmelCase				   =       DebertaVaTokenizer(_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       DebertaVaTokenizerFast(_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       "I was born in 92000, and this is falsé."
											__lowerCAmelCase				   =       ["▁i", "▁was", "▁born", "▁in", "▁9", "2000", "▁", ",", "▁and", "▁this", "▁is", "▁fal", "s", "<unk>", "▁", ".", ]
											# fmt: on

											__lowerCAmelCase				   =       DebertaVaTokenizer(_A		,			do_lower_case=_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(tokenizer.encode(_A		,			add_special_tokens=_A			)			)
											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       DebertaVaTokenizerFast(_A		,			do_lower_case=_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(_A		,			add_special_tokens=_A			)			)
											self.assertListEqual(_A		,			_A			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       "I was born in 92000, and this is falsé."
											__lowerCAmelCase				   =       ["▁i", "▁was", "▁born", "▁in", "▁9", "2000", ",", "▁and", "▁this", "▁is", "▁fal", "s", "<unk>", ".", ]
											# fmt: on

											__lowerCAmelCase				   =       DebertaVaTokenizer(_A		,			do_lower_case=_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       DebertaVaTokenizerFast(_A		,			do_lower_case=_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       "I was born in 92000, and this is falsé."
											__lowerCAmelCase				   =       ["▁", "<unk>", "▁was", "▁born", "▁in", "▁9", "2000", "▁", ",", "▁and", "▁this", "▁is", "▁fal", "s", "<unk>", "▁", ".", ]
											# fmt: on

											__lowerCAmelCase				   =       DebertaVaTokenizer(_A		,			do_lower_case=_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       DebertaVaTokenizerFast(_A		,			do_lower_case=_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       " \tHeLLo!how  \n Are yoU?  "
											__lowerCAmelCase				   =       ["▁", "<unk>", "e", "<unk>", "o", "!", "how", "▁", "<unk>", "re", "▁yo", "<unk>", "?"]
											# fmt: on

											__lowerCAmelCase				   =       DebertaVaTokenizer(_A		,			do_lower_case=_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       DebertaVaTokenizerFast(_A		,			do_lower_case=_A		,			split_by_punct=_A			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(_A		,			add_special_tokens=_A			)			)

											self.assertListEqual(_A		,			_A			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       self.get_tokenizer()
											__lowerCAmelCase				   =       self.get_rust_tokenizer()

											__lowerCAmelCase				   =       "I was born in 92000, and this is falsé."

											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(tokenizer.encode(_A		,			add_special_tokens=_A			)			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(rust_tokenizer.encode(_A		,			add_special_tokens=_A			)			)
											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       tokenizer.encode(_A		,			add_special_tokens=_A			)
											__lowerCAmelCase				   =       rust_tokenizer.encode(_A		,			add_special_tokens=_A			)
											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       self.get_rust_tokenizer()
											__lowerCAmelCase				   =       tokenizer.encode(_A			)
											__lowerCAmelCase				   =       rust_tokenizer.encode(_A			)
											self.assertListEqual(_A		,			_A			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       "This is a test"
											__lowerCAmelCase				   =       [1_3, 1, 4_3_9_8, 2_5, 2_1, 1_2_8_9]
											__lowerCAmelCase				   =       ["▁", "T", "his", "▁is", "▁a", "▁test"]
											__lowerCAmelCase				   =       ["▁", "<unk>", "his", "▁is", "▁a", "▁test"]

											__lowerCAmelCase				   =       DebertaVaTokenizer(_A		,			keep_accents=_A			)
											__lowerCAmelCase				   =       DebertaVaTokenizerFast(_A		,			keep_accents=_A			)

											__lowerCAmelCase				   =       tokenizer.encode(_A		,			add_special_tokens=_A			)
											self.assertListEqual(_A		,			_A			)
											__lowerCAmelCase				   =       tokenizer.tokenize(_A			)
											self.assertListEqual(_A		,			_A			)
											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(_A			)
											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       rust_tokenizer.encode(_A		,			add_special_tokens=_A			)
											self.assertListEqual(_A		,			_A			)
											__lowerCAmelCase				   =       rust_tokenizer.tokenize(_A			)
											self.assertListEqual(_A		,			_A			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(_A			)
											self.assertListEqual(_A		,			_A			)

											# fmt: off
											__lowerCAmelCase				   =       "I was born in 92000, and this is falsé."
											__lowerCAmelCase				   =       [1_3, 1, 2_3, 3_8_6, 1_9, 5_6_1, 3_0_5_0, 1_5, 1_7, 4_8, 2_5, 8_2_5_6, 1_8, 1, 9]
											__lowerCAmelCase				   =       ["▁", "I", "▁was", "▁born", "▁in", "▁9", "2000", ",", "▁and", "▁this", "▁is", "▁fal", "s", "é", ".", ]
											__lowerCAmelCase				   =       ["▁", "<unk>", "▁was", "▁born", "▁in", "▁9", "2000", ",", "▁and", "▁this", "▁is", "▁fal", "s", "<unk>", ".", ]
											# fmt: on

											__lowerCAmelCase				   =       tokenizer.encode(_A		,			add_special_tokens=_A			)
											self.assertListEqual(_A		,			_A			)
											__lowerCAmelCase				   =       tokenizer.tokenize(_A			)
											self.assertListEqual(_A		,			_A			)
											__lowerCAmelCase				   =       tokenizer.convert_ids_to_tokens(_A			)
											self.assertListEqual(_A		,			_A			)

											__lowerCAmelCase				   =       rust_tokenizer.encode(_A		,			add_special_tokens=_A			)
											self.assertListEqual(_A		,			_A			)
											__lowerCAmelCase				   =       rust_tokenizer.tokenize(_A			)
											self.assertListEqual(_A		,			_A			)
											__lowerCAmelCase				   =       rust_tokenizer.convert_ids_to_tokens(_A			)
											self.assertListEqual(_A		,			_A			)






						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       DebertaVaTokenizer(_A			)

											__lowerCAmelCase				   =       tokenizer.encode("sequence builders"			)
											__lowerCAmelCase				   =       tokenizer.encode("multi-sequence build"			)

											__lowerCAmelCase				   =       tokenizer.build_inputs_with_special_tokens(_A			)
											__lowerCAmelCase				   =       tokenizer.build_inputs_with_special_tokens(_A		,			_A			)

											self.assertEqual([tokenizer.cls_token_id] + text + [tokenizer.sep_token_id]		,			_A			)
											self.assertEqual(
											    [tokenizer.cls_token_id] + text + [tokenizer.sep_token_id] + text_a + [tokenizer.sep_token_id]		,			_A		,			)






						@slow
						def 				__SCREAMING_SNAKE_CASE(   self			):




											"""simple docstring"""



											__lowerCAmelCase				   =       {"input_ids": [[1, 3_9_8_6_7, 3_6, 1_9_3_9_0, 4_8_6, 2_7, 3_5_0_5_2, 8_1_4_3_6, 1_8, 6_0_6_8_5, 1_2_2_5, 7, 3_5_0_5_2, 8_1_4_3_6, 1_8, 9_3_6_7, 1_6_8_9_9, 1_8, 1_5_9_3_7, 5_3, 5_9_4, 7_7_3, 1_8, 1_6_2_8_7, 3_0_4_6_5, 3_6, 1_5_9_3_7, 6, 4_1_1_3_9, 3_8, 3_6_9_7_9, 6_0_7_6_3, 1_9_1, 6, 3_4_1_3_2, 9_9, 6, 5_0_5_3_8, 3_9_0, 4_3_2_3_0, 6, 3_4_1_3_2, 2_7_7_9, 2_0_8_5_0, 1_4, 6_9_9, 1_0_7_2, 1_1_9_4, 3_6, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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]]}  # noqa: E501
											# fmt: on

											self.tokenizer_integration_test_util(
											    expected_encoding=_A		,			model_name="microsoft/deberta-v2-xlarge"		,			revision="ad6e42c1532ddf3a15c39246b63f5559d558b670"		,			)




