




"""simple docstring"""







import math
import os
import re
import sys
import unittest
from pathlib import Path
from typing import Tuple
from unittest.mock import patch

from parameterized import parameterized

from transformers.testing_utils import (
    CaptureStderr,
    ExtendSysPath,
    TestCasePlus,
    execute_subprocess_async,
    get_gpu_count,
    get_torch_dist_unique_port,
    require_apex,
    require_bitsandbytes,
    require_fairscale,
    require_torch,
    require_torch_gpu,
    require_torch_multi_gpu,
    require_torch_non_multi_gpu,
    slow,
)
from transformers.trainer_callback import TrainerState
from transformers.trainer_utils import set_seed


a      =							os.path.abspath(os.path.dirname(__file__))
with ExtendSysPath(f"""{bindir}/../../examples/pytorch/translation"""):
		from run_translation import main  # noqa


set_seed(4_2)
a      =							'sshleifer/student_marian_en_ro_6_1'
a      =							'sshleifer/tiny-mbart'






@require_torch
class       SCREAMING_SNAKE_CASE__					(					_a					):


						def   __lowercase (							self				:			Tuple						,						lowerCAmelCase				:			Optional[Any]=False						,						lowerCAmelCase				:			str=None						,						lowerCAmelCase				:			Tuple=True						,						lowerCAmelCase				:			Union[str, Any]=True						,						lowerCAmelCase				:			str=True						,						lowerCAmelCase				:			Any=True						,						):
										lowerCAmelCase  =				self.run_trainer(
										    eval_steps=1						,						max_len=12						,						model_name=lowerCAmelCase						,						num_train_epochs=1						,						distributed=lowerCAmelCase						,						extra_args_str=lowerCAmelCase						,						predict_with_generate=lowerCAmelCase						,						do_train=lowerCAmelCase						,						do_eval=lowerCAmelCase						,						do_predict=lowerCAmelCase						,						)
										lowerCAmelCase  =				TrainerState.load_from_json(os.path.join(lowerCAmelCase						,						"""trainer_state.json"""					)					).log_history

										if not do_eval:
														return

										lowerCAmelCase  =				[log for log in logs if """eval_loss""" in log.keys()]

										lowerCAmelCase  =				eval_metrics[0]
										if predict_with_generate:
														assert "eval_bleu" in first_step_stats

														lowerCAmelCase  =				eval_metrics[-1]
														assert isinstance(last_step_stats["""eval_bleu"""]						,						lowerCAmelCase					)
														assert not math.isnan(float(last_step_stats["""eval_loss"""]					)					), "eval_loss must not be `nan`"


						@require_torch_non_multi_gpu
						def   __lowercase (							self				:			int					):
										self.run_seqaseq_quick()


						@require_torch_multi_gpu
						def   __lowercase (							self				:			List[Any]					):
										self.run_seqaseq_quick(distributed=lowerCAmelCase					)


						@require_torch_multi_gpu
						def   __lowercase (							self				:			Any					):
										self.run_seqaseq_quick(distributed=lowerCAmelCase					)


						@unittest.skip("""Requires an update of the env running those tests"""					)
						@require_torch_multi_gpu
						@require_fairscale
						def   __lowercase (							self				:			Union[str, Any]					):
										self.run_seqaseq_quick(distributed=lowerCAmelCase						,						extra_args_str="""--sharded_ddp simple"""					)


						@unittest.skip("""Requires an update of the env running those tests"""					)
						@require_torch_multi_gpu
						@require_fairscale
						def   __lowercase (							self				:			List[str]					):
										self.run_seqaseq_quick(distributed=lowerCAmelCase						,						extra_args_str="""--sharded_ddp simple --fp16"""					)


						@unittest.skip("""Requires an update of the env running those tests"""					)
						@require_torch_multi_gpu
						@require_fairscale
						def   __lowercase (							self				:			List[Any]					):
										self.run_seqaseq_quick(distributed=lowerCAmelCase						,						extra_args_str="""--sharded_ddp zero_dp_2"""						,						predict_with_generate=lowerCAmelCase					)


						@unittest.skip("""Requires an update of the env running those tests"""					)
						@require_torch_multi_gpu
						@require_fairscale
						def   __lowercase (							self				:			Tuple					):
										self.run_seqaseq_quick(
										    distributed=lowerCAmelCase						,						extra_args_str="""--sharded_ddp zero_dp_2 --fp16"""						,						predict_with_generate=lowerCAmelCase					)


						@require_apex
						@require_torch_gpu
						def   __lowercase (							self				:			List[Any]					):
										# XXX: apex breaks the trainer if it's run twice e.g. run_seq2seq.main() from the same
										# program and it breaks other tests that run from the same pytest worker, therefore until this is
										# sorted out it must be run only in an external program, that is distributed=True in this
										# test and only under one or more gpus - if we want cpu will need to make a special test
										#
										# specifically to the problem traced it to self.optimizer.step() - if it's run 2nd time via
										# 2nd main() call it botches the future eval.
										#
										self.run_seqaseq_quick(distributed=lowerCAmelCase						,						extra_args_str="""--fp16 --fp16_backend=apex"""					)
										# test 2nd time - was getting eval_loss': nan'
										# to reproduce the problem set distributed=False
										self.run_seqaseq_quick(distributed=lowerCAmelCase						,						extra_args_str="""--fp16 --fp16_backend=apex"""					)


						@parameterized.expand(["""base""", """low""", """high""", """mixed"""]					)
						@require_torch_multi_gpu
						def   __lowercase (							self				:			Any						,						lowerCAmelCase				:			int					):
										# as each sub-test is slow-ish split into multiple sub-tests to avoid CI timeout
										lowerCAmelCase  =				{
										    # test with the default log_level - should be info and thus log info once
										    """base""": {"""extra_args_str""": """""", """n_matches""": 1},
										    # test with low log_level and log_level_replica - should be noisy on all processes
										    # now the info string should appear twice on 2 processes
										    """low""": {"""extra_args_str""": """--log_level debug --log_level_replica debug""", """n_matches""": 2},
										    # test with high log_level and low log_level_replica
										    # now the info string should appear once only on the replica
										    """high""": {"""extra_args_str""": """--log_level error --log_level_replica debug""", """n_matches""": 1},
										    # test with high log_level and log_level_replica - should be quiet on all processes
										    """mixed""": {"""extra_args_str""": """--log_level error --log_level_replica error""", """n_matches""": 0},
										}

										lowerCAmelCase  =				experiments[experiment_id]
										lowerCAmelCase  =				{"""distributed""": True, """predict_with_generate""": False, """do_eval""": False, """do_predict""": False}
										lowerCAmelCase  =				"""Running training"""
										with CaptureStderr() as cl:
														self.run_seqaseq_quick(**lowerCAmelCase						,						extra_args_str=data["""extra_args_str"""]					)
										lowerCAmelCase  =				len(re.findall(lowerCAmelCase						,						cl.err					)					)
										self.assertEqual(lowerCAmelCase						,						data["""n_matches"""]					)


						@slow
						def   __lowercase (							self				:			List[str]					):
										lowerCAmelCase  =				self.run_trainer(
										    eval_steps=2						,						max_len=128						,						model_name=lowerCAmelCase						,						learning_rate=3e-4						,						num_train_epochs=10						,						distributed=lowerCAmelCase						,						)

										# Check metrics
										lowerCAmelCase  =				TrainerState.load_from_json(os.path.join(lowerCAmelCase						,						"""trainer_state.json"""					)					).log_history
										lowerCAmelCase  =				[log for log in logs if """eval_loss""" in log.keys()]
										lowerCAmelCase  =				eval_metrics[0]
										lowerCAmelCase  =				eval_metrics[-1]

										assert first_step_stats["eval_loss"] > last_step_stats["eval_loss"], "model learned nothing"
										assert isinstance(last_step_stats["""eval_bleu"""]						,						lowerCAmelCase					)

										# test if do_predict saves generations and metrics
										lowerCAmelCase  =				os.listdir(lowerCAmelCase					)
										lowerCAmelCase  =				{os.path.basename(lowerCAmelCase					) for p in contents}
										assert "generated_predictions.txt" in contents
										assert "predict_results.json" in contents


						@slow
						@require_bitsandbytes
						def   __lowercase (							self				:			Any					):
										from transformers.training_args import OptimizerNames

										def train_and_return_metrics(lowerCAmelCase				:			str					) -> Tuple[int, float]:
														lowerCAmelCase  =				"""--skip_memory_metrics 0"""

														lowerCAmelCase  =				self.run_trainer(
														    max_len=128						,						model_name=lowerCAmelCase						,						learning_rate=3e-4						,						num_train_epochs=1						,						optim=lowerCAmelCase						,						distributed=lowerCAmelCase						,						extra_args_str=lowerCAmelCase						,						do_eval=lowerCAmelCase						,						do_predict=lowerCAmelCase						,						n_gpus_to_use=1						,						)

														# Check metrics
														lowerCAmelCase  =				TrainerState.load_from_json(Path(lowerCAmelCase						,						"""trainer_state.json"""					)					).log_history
														lowerCAmelCase  =				int(logs[0]["""train_mem_gpu_peaked_delta"""] / 2**20					)
														lowerCAmelCase  =				int(logs[0]["""train_mem_gpu_alloc_delta"""] / 2**20					)

														lowerCAmelCase  =				logs[0]["""train_loss"""]
														return gpu_peak_mem_mb, gpu_alloc_mem_mb, loss

										lowerCAmelCase ,						lowerCAmelCase ,						lowerCAmelCase  =				train_and_return_metrics(OptimizerNames.ADAMW_TORCH.value					)
										lowerCAmelCase ,						lowerCAmelCase ,						lowerCAmelCase  =				train_and_return_metrics(OptimizerNames.ADAMW_BNB.value					)

										lowerCAmelCase  =				gpu_alloc_mem_orig - gpu_alloc_mem_bnb

										lowerCAmelCase  =				gpu_peak_mem_orig + gpu_alloc_mem_orig
										lowerCAmelCase  =				gpu_peak_mem_bnb + gpu_alloc_mem_bnb
										lowerCAmelCase  =				gpu_total_mem_orig - gpu_total_mem_bnb

										# sshleifer/student_marian_en_ro_6_1 has 54M parameter, 29M of which is `nn.Embedding` which
										# doesn't get quantized and remains in fp32. Therefore we only have 25M parameters quantized
										# in 2 bytes and the diff in optim memory usage is derived as so:
										#
										# - normal 25*8=~200MB (8 bytes per param)
										# - bnb    25*2= ~50MB (2 bytes per param)
										#
										# Thus we should expect ~150MB total memory saved.
										#
										# Peak memory should be the same - the total should be different by about that same margin
										#
										# After leaving a small margin to accommodate for differences between gpus let's check
										# that we have at least 120MB in savings
										lowerCAmelCase  =				120

										# uncomment the following if this test starts failing - requires py38 for a new print feature
										# gpu_peak_mem_diff = gpu_peak_mem_orig - gpu_peak_mem_bnb
										# print(f"{gpu_alloc_mem_orig=}MB {gpu_peak_mem_orig=}MB {gpu_alloc_mem_orig+gpu_peak_mem_orig=}MB")
										# print(f" {gpu_alloc_mem_bnb=}MB  {gpu_peak_mem_bnb=}MB  {gpu_alloc_mem_bnb+gpu_peak_mem_bnb=}MB")
										# print(f"{gpu_alloc_mem_diff=}MB")
										# print(f"{gpu_peak_mem_diff=}MB")
										# print(f"{gpu_total_mem_orig=}MB, {gpu_total_mem_bnb=}MB")
										# print(f"{gpu_total_mem_diff=}MB, {gpu_total_mem_diff=}MB")

										self.assertGreater(
										    lowerCAmelCase						,						lowerCAmelCase						,						"""should use ~150MB less alloc gpu memory with BNB, compared to without it for this model but got"""
										    f''' a difference of {gpu_alloc_mem_diff}MB, with gpu_alloc_mem_orig={gpu_alloc_mem_orig}MB and'''
										    f''' gpu_alloc_mem_bnb={gpu_alloc_mem_bnb}MB'''						,						)

										self.assertGreater(
										    lowerCAmelCase						,						lowerCAmelCase						,						"""should use ~150MB less total gpu memory with BNB, compared to without it for this model but got"""
										    f''' a difference of {gpu_total_mem_diff}MB, with gpu_total_mem_orig={gpu_total_mem_orig}MB and'''
										    f''' gpu_total_mem_bnb={gpu_total_mem_bnb}MB'''						,						)

										self.assertEqual(
										    lowerCAmelCase						,						lowerCAmelCase						,						f'''loss should be the same, but got loss_orig={loss_orig}, loss_bnb={loss_bnb}'''					)




						def   __lowercase (							self				:			List[Any]						,						lowerCAmelCase				:			int						,						lowerCAmelCase				:			str						,						lowerCAmelCase				:			int						,						lowerCAmelCase				:			float = 3e-3						,						lowerCAmelCase				:			str = "adafactor"						,						lowerCAmelCase				:			bool = False						,						lowerCAmelCase				:			str = None						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			bool = True						,						lowerCAmelCase				:			bool = True						,						lowerCAmelCase				:			bool = True						,						lowerCAmelCase				:			bool = True						,						lowerCAmelCase				:			int = None						,						):
										lowerCAmelCase  =				self.test_file_dir / """../fixtures/tests_samples/wmt_en_ro"""
										lowerCAmelCase  =				self.get_auto_remove_tmp_dir()
										lowerCAmelCase  =				f'''
            --model_name_or_path {model_name}
            --train_file {data_dir}/train.json
            --validation_file {data_dir}/val.json
            --test_file {data_dir}/test.json
            --output_dir {output_dir}
            --overwrite_output_dir
            --max_train_samples 8
            --max_source_length {max_len}
            --max_target_length {max_len}
            --do_train
            --num_train_epochs {str(lowerCAmelCase					)}
            --per_device_train_batch_size 4
            --learning_rate {learning_rate}
            --warmup_steps 8
            --logging_steps 0
            --logging_strategy no
            --save_steps {str(lowerCAmelCase					)}
            --group_by_length
            --label_smoothing_factor 0.1
            --target_lang ro_RO
            --source_lang en_XX
        '''.split()

										lowerCAmelCase  =				f'''
            --do_eval
            --per_device_eval_batch_size 4
            --max_eval_samples 8
            --val_max_target_length {max_len}
            --evaluation_strategy steps
            --eval_steps {str(lowerCAmelCase					)}
        '''.split()

										lowerCAmelCase  =				"""
            --do_predict
        """.split()

										lowerCAmelCase  =				[]
										if do_train:
														args += args_train

										if do_eval:
														args += args_eval

										if do_predict:
														args += args_predict

										if predict_with_generate:
														args += "--predict_with_generate".split()

										if do_train:
														if optim == "adafactor":
																		args += "--adafactor".split()
														else:
																		args += f'''--optim {optim}'''.split()

										if extra_args_str is not None:
														args += extra_args_str.split()

										if distributed:
														if n_gpus_to_use is None:
																		lowerCAmelCase  =				get_gpu_count()
														lowerCAmelCase  =				get_torch_dist_unique_port()
														lowerCAmelCase  =				f'''
                -m torch.distributed.run
                --nproc_per_node={n_gpus_to_use}
                --master_port={master_port}
                {self.examples_dir_str}/pytorch/translation/run_translation.py
            '''.split()
														lowerCAmelCase  =				[sys.executable] + distributed_args + args
														# keep for quick debug
														# print(" ".join([f"\nPYTHONPATH={self.src_dir_str}"] +cmd)); die
														execute_subprocess_async(lowerCAmelCase						,						env=self.get_env()					)
										else:
														lowerCAmelCase  =				["""run_translation.py"""] + args
														with patch.object(lowerCAmelCase						,						"""argv"""						,						lowerCAmelCase					):
																		main()

										return output_dir











"""simple docstring"""







import pickle
import shutil
import tempfile
import unittest

from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import cached_property

from ...test_tokenization_common import TokenizerTesterMixin


a      =							get_tests_dir('fixtures/test_sentencepiece.model')






@require_sentencepiece
@require_tokenizers
class       SCREAMING_SNAKE_CASE__					(					_a						,				unittest.TestCase					):
						_a    						=						XGLMTokenizer
						_a    						=						XGLMTokenizerFast
						_a    						=						True
						_a    						=						True


						def   __lowercase (							self				:			Union[str, Any]					):
										super().setUp()

										# We have a SentencePiece fixture for testing
										lowerCAmelCase  =				XGLMTokenizer(lowerCAmelCase						,						keep_accents=lowerCAmelCase					)
										tokenizer.save_pretrained(self.tmpdirname					)


						def   __lowercase (							self				:			Union[str, Any]					):
										lowerCAmelCase  =				"""<pad>"""
										lowerCAmelCase  =				1

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


						def   __lowercase (							self				:			List[str]					):
										lowerCAmelCase  =				list(self.get_tokenizer().get_vocab().keys()					)

										self.assertEqual(vocab_keys[0]						,						"""<s>"""					)
										self.assertEqual(vocab_keys[1]						,						"""<pad>"""					)
										self.assertEqual(len(lowerCAmelCase					)						,						1008					)


						def   __lowercase (							self				:			Optional[int]					):
										self.assertEqual(self.get_tokenizer().vocab_size						,						1008					)


						def   __lowercase (							self				:			int					):
										lowerCAmelCase  =				XGLMTokenizer(lowerCAmelCase						,						keep_accents=lowerCAmelCase					)

										lowerCAmelCase  =				tokenizer.tokenize("""This is a test"""					)
										self.assertListEqual(lowerCAmelCase						,						["""▁This""", """▁is""", """▁a""", """▁t""", """est"""]					)

										self.assertListEqual(
										    tokenizer.convert_tokens_to_ids(lowerCAmelCase					)						,						[value + tokenizer.fairseq_offset for value in [285, 46, 10, 170, 382]]						,						)

										lowerCAmelCase  =				tokenizer.tokenize("""I was born in 92000, and this is falsé."""					)
										self.assertListEqual(
										    lowerCAmelCase						,						[
										        SPIECE_UNDERLINE + """I""",
										        SPIECE_UNDERLINE + """was""",
										        SPIECE_UNDERLINE + """b""",
										        """or""",
										        """n""",
										        SPIECE_UNDERLINE + """in""",
										        SPIECE_UNDERLINE + """""",
										        """9""",
										        """2""",
										        """0""",
										        """0""",
										        """0""",
										        """,""",
										        SPIECE_UNDERLINE + """and""",
										        SPIECE_UNDERLINE + """this""",
										        SPIECE_UNDERLINE + """is""",
										        SPIECE_UNDERLINE + """f""",
										        """al""",
										        """s""",
										        """é""",
										        """.""",
										    ]						,						)
										lowerCAmelCase  =				tokenizer.convert_tokens_to_ids(lowerCAmelCase					)
										self.assertListEqual(
										    lowerCAmelCase						,						[
										        value + tokenizer.fairseq_offset
										        for value in [8, 21, 84, 55, 24, 19, 7, 2, 602, 347, 347, 347, 3, 12, 66, 46, 72, 80, 6, 2, 4]
										    ]						,						)

										lowerCAmelCase  =				tokenizer.convert_ids_to_tokens(lowerCAmelCase					)
										self.assertListEqual(
										    lowerCAmelCase						,						[
										        SPIECE_UNDERLINE + """I""",
										        SPIECE_UNDERLINE + """was""",
										        SPIECE_UNDERLINE + """b""",
										        """or""",
										        """n""",
										        SPIECE_UNDERLINE + """in""",
										        SPIECE_UNDERLINE + """""",
										        """<unk>""",
										        """2""",
										        """0""",
										        """0""",
										        """0""",
										        """,""",
										        SPIECE_UNDERLINE + """and""",
										        SPIECE_UNDERLINE + """this""",
										        SPIECE_UNDERLINE + """is""",
										        SPIECE_UNDERLINE + """f""",
										        """al""",
										        """s""",
										        """<unk>""",
										        """.""",
										    ]						,						)


						@cached_property
						def   __lowercase (							self				:			Optional[Any]					):
										return XGLMTokenizer.from_pretrained("""facebook/xglm-564M"""					)


						def   __lowercase (							self				:			List[str]					):
										with tempfile.NamedTemporaryFile() as f:
														shutil.copyfile(lowerCAmelCase						,						f.name					)
														lowerCAmelCase  =				XGLMTokenizer(f.name						,						keep_accents=lowerCAmelCase					)
														lowerCAmelCase  =				pickle.dumps(lowerCAmelCase					)
										pickle.loads(lowerCAmelCase					)


						def   __lowercase (							self				:			Optional[int]					):
										if not self.test_rust_tokenizer:
														return

										lowerCAmelCase  =				self.get_tokenizer()
										lowerCAmelCase  =				self.get_rust_tokenizer()

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

										lowerCAmelCase  =				tokenizer.tokenize(lowerCAmelCase					)
										lowerCAmelCase  =				rust_tokenizer.tokenize(lowerCAmelCase					)
										self.assertListEqual(lowerCAmelCase						,						lowerCAmelCase					)

										lowerCAmelCase  =				tokenizer.encode(lowerCAmelCase						,						add_special_tokens=lowerCAmelCase					)
										lowerCAmelCase  =				rust_tokenizer.encode(lowerCAmelCase						,						add_special_tokens=lowerCAmelCase					)
										self.assertListEqual(lowerCAmelCase						,						lowerCAmelCase					)

										lowerCAmelCase  =				self.get_rust_tokenizer()
										lowerCAmelCase  =				tokenizer.encode(lowerCAmelCase					)
										lowerCAmelCase  =				rust_tokenizer.encode(lowerCAmelCase					)
										self.assertListEqual(lowerCAmelCase						,						lowerCAmelCase					)


						@slow
						def   __lowercase (							self				:			Union[str, Any]					):
										lowerCAmelCase  =				"""Hello World!"""
										lowerCAmelCase  =				[2, 3_1227, 4447, 35]

										self.assertListEqual(lowerCAmelCase						,						self.big_tokenizer.encode(lowerCAmelCase					)					)


						@slow
						def   __lowercase (							self				:			str					):
										lowerCAmelCase  =				(
										    """This is a very long text with a lot of weird characters, such as: . , ~ ? ( ) \" [ ] ! : - . Also we will"""
										    """ add words that should not exsist and be tokenized to unk, such as saoneuhaoesuth"""
										)
										# fmt: off
										lowerCAmelCase  =				[2, 1018, 67, 11, 1988, 2617, 5631, 278, 11, 3407, 48, 7_1630, 2_8085, 4, 3234, 157, 13, 6, 5, 6, 4, 3526, 768, 15, 659, 57, 298, 3983, 864, 129, 21, 6, 5, 1_3675, 377, 652, 7580, 1_0341, 155, 2817, 422, 1666, 7, 1674, 53, 113, 20_2277, 1_7892, 33, 60, 87, 4, 3234, 157, 61, 2667, 5_2376, 19, 88, 23, 735]
										# fmt: on

										self.assertListEqual(lowerCAmelCase						,						self.big_tokenizer.encode(lowerCAmelCase					)					)




						@slow
						def   __lowercase (							self				:			str					):
										# fmt: off
										lowerCAmelCase  =				{
										    """input_ids""": [[2, 10_8825, 1163, 15, 8_8010, 473, 1_5898, 157, 1_3672, 1857, 312, 8, 23_8021, 1163, 53, 1_3672, 1857, 312, 8, 5_3283, 18_2396, 8, 1_8566, 16, 3_6733, 4101, 8, 230, 24_4017, 12_2553, 7, 15, 13_2597, 4, 293, 1_2511, 7610, 4, 3414, 13_2597, 9, 4, 3_2361, 362, 4, 734, 2_8512, 3_2569, 18, 4, 3_2361, 2_6096, 1_4982, 73, 1_8715, 2_1433, 23_5261, 15, 492, 1_2427, 16, 53, 1_8715, 2_1433, 6_5454, 15, 2_3659, 563, 16, 278, 597, 2843, 595, 7931, 18_2396, 6_4186, 22, 886, 595, 13_2981, 53, 2_5540, 3449, 4_3982, 3_9901, 5951, 878, 330, 4, 2_7694, 8_0269, 312, 53, 6517, 1_1780, 611, 2_0408, 5], [2, 6, 13_2597, 67, 4_2897, 33, 592, 8, 16_3729, 2_5540, 361, 13_6997, 10_9514, 17_3230, 7, 501, 60, 10_2913, 196, 5631, 235, 6_3243, 473, 6, 23_1757, 74, 5277, 7905, 53, 3095, 3_7317, 22, 454, 18_3874, 5], [2, 268, 3_1298, 4_6530, 6, 13_2935, 4_3831, 7, 597, 32, 24, 3688, 9865, 5]],
										    """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, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
										}  # noqa: E501
										# fmt: on

										self.tokenizer_integration_test_util(
										    expected_encoding=lowerCAmelCase						,						model_name="""facebook/xglm-564M"""						,						padding=lowerCAmelCase						,						)





