



"""simple docstring"""

from __future__ import annotations

import unittest

from transformers import AutoTokenizer, PegasusConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow
from transformers.utils import cached_property

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


if is_tf_available():
			import tensorflow as tf

			from transformers import TFAutoModelForSeqaSeqLM, TFPegasusForConditionalGeneration, TFPegasusModel







@require_tf
class    __lowercase     :







						"""simple docstring"""







						_A		:							List[str]							       =		PegasusConfig
						_A		:							str							       =		{}
						_A		:							Dict							       =		"""gelu"""







						def __init__(self   ,		lowercase__   ,		lowercase__=13   ,		lowercase__=7   ,		lowercase__=True   ,		lowercase__=False   ,		lowercase__=99   ,		lowercase__=32   ,		lowercase__=2   ,		lowercase__=4   ,		lowercase__=37   ,		lowercase__=0.1   ,		lowercase__=0.1   ,		lowercase__=40   ,		lowercase__=2   ,		lowercase__=1   ,		lowercase__=0   ,		):
											snake_case_					:		Optional[Any] 					=					parent
											snake_case_					:		str 					=					batch_size
											snake_case_					:		Any 					=					seq_length
											snake_case_					:		Tuple 					=					is_training
											snake_case_					:		Optional[int] 					=					use_labels
											snake_case_					:		Optional[Any] 					=					vocab_size
											snake_case_					:		int 					=					hidden_size
											snake_case_					:		Optional[int] 					=					num_hidden_layers
											snake_case_					:		Tuple 					=					num_attention_heads
											snake_case_					:		Optional[int] 					=					intermediate_size

											snake_case_					:		Tuple 					=					hidden_dropout_prob
											snake_case_					:		Optional[Any] 					=					attention_probs_dropout_prob
											snake_case_					:		List[Any] 					=					max_position_embeddings
											snake_case_					:		Any 					=					eos_token_id
											snake_case_					:		List[Any] 					=					pad_token_id
											snake_case_					:		Union[str, Any] 					=					bos_token_id







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Optional[Any] 					=					ids_tensor([self.batch_size, self.seq_length - 1]   ,		self.vocab_size       )
											snake_case_					:		Any 					=					tf.expand_dims(tf.constant([self.eos_token_id] * self.batch_size       )   ,		1       )
											snake_case_					:		List[Any] 					=					tf.concat([input_ids, eos_tensor]   ,		axis=1       )

											snake_case_					:		int 					=					ids_tensor([self.batch_size, self.seq_length]   ,		self.vocab_size       )

											snake_case_					:		Any 					=					self.config_cls(
											    vocab_size=self.vocab_size   ,		d_model=self.hidden_size   ,		encoder_layers=self.num_hidden_layers   ,		decoder_layers=self.num_hidden_layers   ,		encoder_attention_heads=self.num_attention_heads   ,		decoder_attention_heads=self.num_attention_heads   ,		encoder_ffn_dim=self.intermediate_size   ,		decoder_ffn_dim=self.intermediate_size   ,		dropout=self.hidden_dropout_prob   ,		attention_dropout=self.attention_probs_dropout_prob   ,		max_position_embeddings=self.max_position_embeddings   ,		eos_token_ids=[2]   ,		bos_token_id=self.bos_token_id   ,		pad_token_id=self.pad_token_id   ,		decoder_start_token_id=self.pad_token_id   ,		**self.config_updates   ,		)
											snake_case_					:		int 					=					prepare_pegasus_inputs_dict(lowercase__   ,		lowercase__   ,		lowercase__       )
											return config, inputs_dict







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__       ):
											snake_case_					:		Dict 					=					TFPegasusModel(config=lowercase__       ).get_decoder()
											snake_case_					:		int 					=					inputs_dict["""input_ids"""]

											snake_case_					:		Dict 					=					input_ids[:1, :]
											snake_case_					:		Tuple 					=					inputs_dict["""attention_mask"""][:1, :]
											snake_case_					:		Optional[Any] 					=					inputs_dict["""head_mask"""]
											snake_case_					:		Dict 					=					1

											# first forward pass
											snake_case_					:		Tuple 					=					model(lowercase__   ,		attention_mask=lowercase__   ,		head_mask=lowercase__   ,		use_cache=lowercase__       )

											snake_case_					,			snake_case_					:		List[str] 					=					outputs.to_tuple()

											# create hypothetical next token and extent to next_input_ids
											snake_case_					:		Optional[int] 					=					ids_tensor((self.batch_size, 3)   ,		config.vocab_size       )
											snake_case_					:		Tuple 					=					tf.cast(ids_tensor((self.batch_size, 3)   ,		2       )   ,		tf.inta       )

											# append to next input_ids and
											snake_case_					:		Optional[int] 					=					tf.concat([input_ids, next_tokens]   ,		axis=-1       )
											snake_case_					:		List[str] 					=					tf.concat([attention_mask, next_attn_mask]   ,		axis=-1       )

											snake_case_					:		Optional[int] 					=					model(lowercase__   ,		attention_mask=lowercase__       )[0]
											snake_case_					:		Optional[int] 					=					model(lowercase__   ,		attention_mask=lowercase__   ,		past_key_values=lowercase__       )[0]

											self.parent.assertEqual(next_tokens.shape[1]   ,		output_from_past.shape[1]       )

											# select random slice
											snake_case_					:		str 					=					int(ids_tensor((1,)   ,		output_from_past.shape[-1]       )       )
											snake_case_					:		Optional[int] 					=					output_from_no_past[:, -3:, random_slice_idx]
											snake_case_					:		List[Any] 					=					output_from_past[:, :, random_slice_idx]

											# test that outputs are equal for slice
											tf.debugging.assert_near(lowercase__   ,		lowercase__   ,		rtol=1e-3       )







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  Optional[int]				,    SCREAMING_SNAKE_CASE__ :  Optional[int]				,    SCREAMING_SNAKE_CASE__ :  Optional[int]				,    SCREAMING_SNAKE_CASE__ :  Any=None				,    SCREAMING_SNAKE_CASE__ :  Optional[Any]=None				,    SCREAMING_SNAKE_CASE__ :  Dict=None				,    SCREAMING_SNAKE_CASE__ :  List[Any]=None				,    SCREAMING_SNAKE_CASE__ :  Dict=None				,    ):



					"""simple docstring"""





					if attention_mask is None:
										snake_case_					:		Tuple 					=					tf.cast(tf.math.not_equal(SCREAMING_SNAKE_CASE__				,    config.pad_token_id			)				,    tf.inta			)
					if decoder_attention_mask is None:
										snake_case_					:		Dict 					=					tf.concat(
										    [
										        tf.ones(decoder_input_ids[:, :1].shape				,    dtype=tf.inta			),
										        tf.cast(tf.math.not_equal(decoder_input_ids[:, 1:]				,    config.pad_token_id			)				,    tf.inta			),
										    ]				,    axis=-1				,    )
					if head_mask is None:
										snake_case_					:		int 					=					tf.ones((config.encoder_layers, config.encoder_attention_heads)			)
					if decoder_head_mask is None:
										snake_case_					:		Optional[Any] 					=					tf.ones((config.decoder_layers, config.decoder_attention_heads)			)
					if cross_attn_head_mask is None:
										snake_case_					:		List[str] 					=					tf.ones((config.decoder_layers, config.decoder_attention_heads)			)
					return {
					    "input_ids": input_ids,
					    "decoder_input_ids": decoder_input_ids,
					    "attention_mask": attention_mask,
					    "decoder_attention_mask": decoder_attention_mask,
					    "head_mask": head_mask,
					    "decoder_head_mask": decoder_head_mask,
					    "cross_attn_head_mask": cross_attn_head_mask,
					}







@require_tf
class    __lowercase     (					_UpperCAmelCase					,    _UpperCAmelCase					,    unittest.TestCase):







						"""simple docstring"""







						_A		:							Union[str, Any]							       =		(TFPegasusForConditionalGeneration, TFPegasusModel) if is_tf_available() else ()
						_A		:							Optional[Any]							       =		(TFPegasusForConditionalGeneration,) if is_tf_available() else ()
						_A		:							List[str]							       =		(
						    {
						        """conversational""": TFPegasusForConditionalGeneration,
						        """feature-extraction""": TFPegasusModel,
						        """summarization""": TFPegasusForConditionalGeneration,
						        """text2text-generation""": TFPegasusForConditionalGeneration,
						        """translation""": TFPegasusForConditionalGeneration,
						    }
						    if is_tf_available()
						    else {}
						)
						_A		:							Union[str, Any]							       =		True
						_A		:							Optional[Any]							       =		False
						_A		:							Optional[int]							       =		False







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[Any] 					=					TFPegasusModelTester(self       )
											snake_case_					:		Tuple 					=					ConfigTester(self   ,		config_class=lowercase__       )







						def 						__UpperCamelCase							(self       ):
											self.config_tester.run_common_tests()







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[Any] 					=					self.model_tester.prepare_config_and_inputs_for_common()
											self.model_tester.check_decoder_model_past_large_inputs(*lowercase__       )







@require_sentencepiece
@require_tokenizers
@require_tf
class    __lowercase     (					unittest.TestCase):







						"""simple docstring"""







						_A		:							Dict							       =		[
						    """ PG&E stated it scheduled the blackouts in response to forecasts for high winds amid dry conditions. The aim is to reduce the risk of wildfires. Nearly 800 thousand customers were scheduled to be affected by the shutoffs which were expected to last through at least midday tomorrow.""",
						    """ The London trio are up for best UK act and best album, as well as getting two nominations in the best song category.\"We got told like this morning 'Oh I think you're nominated'\", said Dappy.\"And I was like 'Oh yeah, which one?' And now we've got nominated for four awards. I mean, wow!\"Bandmate Fazer added: \"We thought it's best of us to come down and mingle with everyone and say hello to the cameras. And now we find we've got four nominations.\"The band have two shots at the best song prize, getting the nod for their Tynchy Stryder collaboration Number One, and single Strong Again.Their album Uncle B will also go up against records by the likes of Beyonce and Kanye West.N-Dubz picked up the best newcomer Mobo in 2007, but female member Tulisa said they wouldn't be too disappointed if they didn't win this time around.\"At the end of the day we're grateful to be where we are in our careers.\"If it don't happen then it don't happen - live to fight another day and keep on making albums and hits for the fans.\"Dappy also revealed they could be performing live several times on the night.The group will be doing Number One and also a possible rendition of the War Child single, I Got Soul.The charity song is a  re-working of The Killers' All These Things That I've Done and is set to feature artists like Chipmunk, Ironik and Pixie Lott.This year's Mobos will be held outside of London for the first time, in Glasgow on 30 September.N-Dubz said they were looking forward to performing for their Scottish fans and boasted about their recent shows north of the border.\"We just done Edinburgh the other day,\" said Dappy.\"We smashed up an N-Dubz show over there. We done Aberdeen about three or four months ago - we smashed up that show over there! Everywhere we go we smash it up!\" """,
						]
						_A		:							Optional[Any]							       =		[
						    """California's largest electricity provider has cut power to hundreds of thousands of customers in an effort to"""
						    """ reduce the risk of wildfires.""",
						    """N-Dubz have revealed they\'re \"grateful\" to have been nominated for four Mobo Awards.""",
						]  # differs slightly from pytorch, likely due to numerical differences in linear layers
						_A		:							int							       =		"""google/pegasus-xsum"""







						@cached_property
						def 						__UpperCamelCase							(self       ):
											return AutoTokenizer.from_pretrained(self.model_name       )







						@cached_property
						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[str] 					=					TFAutoModelForSeqaSeqLM.from_pretrained(self.model_name       )
											return model







						def 						__UpperCamelCase							(self   ,		**lowercase__       ):
											snake_case_					:		Any 					=					self.translate_src_text(**lowercase__       )
											assert self.expected_text == generated_words







						def 						__UpperCamelCase							(self   ,		**lowercase__       ):
											snake_case_					:		Dict 					=					self.tokenizer(self.src_text   ,		**lowercase__   ,		padding=lowercase__   ,		return_tensors="""tf"""       )
											snake_case_					:		Dict 					=					self.model.generate(
											    model_inputs.input_ids   ,		attention_mask=model_inputs.attention_mask   ,		num_beams=2   ,		use_cache=lowercase__   ,		)
											snake_case_					:		Union[str, Any] 					=					self.tokenizer.batch_decode(generated_ids.numpy()   ,		skip_special_tokens=lowercase__       )
											return generated_words







						@slow
						def 						__UpperCamelCase							(self       ):
											self._assert_generated_batch_equal_expected()









"""simple docstring"""

import tempfile
import unittest
from pathlib import Path
from shutil import copyfile

from transformers import BatchEncoding, MarianTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow
from transformers.utils import is_sentencepiece_available, is_tf_available, is_torch_available


if is_sentencepiece_available():
			from transformers.models.marian.tokenization_marian import VOCAB_FILES_NAMES, save_json

from ...test_tokenization_common import TokenizerTesterMixin


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

a_			   =					{'''target_lang''': '''fi''', '''source_lang''': '''en'''}
a_			   =					'''>>zh<<'''
a_			   =					'''Helsinki-NLP/'''

if is_torch_available():
			a_			   =					'''pt'''
elif is_tf_available():
			a_			   =					'''tf'''
else:
			a_			   =					'''jax'''







@require_sentencepiece
class    __lowercase     (					_UpperCAmelCase					,    unittest.TestCase):







						"""simple docstring"""







						_A		:							str							       =		MarianTokenizer
						_A		:							List[str]							       =		False
						_A		:							List[str]							       =		True







						def 						__UpperCamelCase							(self       ):
											super().setUp()
											snake_case_					:		Optional[int] 					=					["""</s>""", """<unk>""", """▁This""", """▁is""", """▁a""", """▁t""", """est""", """\u0120""", """<pad>"""]
											snake_case_					:		Any 					=					dict(zip(lowercase__   ,		range(len(lowercase__       )       )       )       )
											snake_case_					:		Any 					=					Path(self.tmpdirname       )
											save_json(lowercase__   ,		save_dir / VOCAB_FILES_NAMES["""vocab"""]       )
											save_json(lowercase__   ,		save_dir / VOCAB_FILES_NAMES["""tokenizer_config_file"""]       )
											if not (save_dir / VOCAB_FILES_NAMES["source_spm"]).exists():
																copyfile(lowercase__   ,		save_dir / VOCAB_FILES_NAMES["""source_spm"""]       )
																copyfile(lowercase__   ,		save_dir / VOCAB_FILES_NAMES["""target_spm"""]       )

											snake_case_					:		Optional[Any] 					=					MarianTokenizer.from_pretrained(self.tmpdirname       )
											tokenizer.save_pretrained(self.tmpdirname       )







						def 						__UpperCamelCase							(self   ,		**lowercase__       ):
											return MarianTokenizer.from_pretrained(self.tmpdirname   ,		**lowercase__       )







						def 						__UpperCamelCase							(self   ,		lowercase__       ):
											return (
											    "This is a test",
											    "This is a test",
											)







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Union[str, Any] 					=					"""</s>"""
											snake_case_					:		Tuple 					=					0

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







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[str] 					=					list(self.get_tokenizer().get_vocab().keys()       )

											self.assertEqual(vocab_keys[0]   ,		"""</s>"""       )
											self.assertEqual(vocab_keys[1]   ,		"""<unk>"""       )
											self.assertEqual(vocab_keys[-1]   ,		"""<pad>"""       )
											self.assertEqual(len(lowercase__       )   ,		9       )







						def 						__UpperCamelCase							(self       ):
											self.assertEqual(self.get_tokenizer().vocab_size   ,		9       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Any 					=					MarianTokenizer.from_pretrained(f'{ORG_NAME}opus-mt-en-de'       )
											snake_case_					:		Tuple 					=					en_de_tokenizer(["""I am a small frog"""]   ,		return_tensors=lowercase__       )
											self.assertIsInstance(lowercase__   ,		lowercase__       )
											snake_case_					:		Dict 					=					[38, 1_21, 14, 6_97, 3_88_48, 0]
											self.assertListEqual(lowercase__   ,		batch.input_ids[0]       )

											snake_case_					:		Tuple 					=					tempfile.mkdtemp()
											en_de_tokenizer.save_pretrained(lowercase__       )
											snake_case_					:		str 					=					[x.name for x in Path(lowercase__       ).glob("""*"""       )]
											self.assertIn("""source.spm"""   ,		lowercase__       )
											MarianTokenizer.from_pretrained(lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Union[str, Any] 					=					self.get_tokenizer()

											snake_case_					:		List[str] 					=					tok(
											    ["""I am a small frog""" * 10_00, """I am a small frog"""]   ,		padding=lowercase__   ,		truncation=lowercase__   ,		return_tensors=lowercase__       )
											self.assertIsInstance(lowercase__   ,		lowercase__       )
											self.assertEqual(batch.input_ids.shape   ,		(2, 5_12)       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Tuple 					=					self.get_tokenizer()
											snake_case_					:		Tuple 					=					tok(["""I am a tiny frog""", """I am a small frog"""]   ,		padding=lowercase__   ,		return_tensors=lowercase__       )
											self.assertIsInstance(lowercase__   ,		lowercase__       )
											self.assertEqual(batch_smaller.input_ids.shape   ,		(2, 10)       )







						@slow
						def 						__UpperCamelCase							(self       ):
											# fmt: off
											snake_case_					:		str 					=					{"""input_ids""": [[4_34_95, 4_62, 20, 4_21_64, 13_69, 52, 4_64, 1_32, 17_03, 4_92, 13, 74_91, 3_89_99, 6, 8, 4_64, 1_32, 17_03, 4_92, 13, 46_69, 3_78_67, 13, 75_25, 27, 15_93, 9_88, 13, 3_39_72, 70_29, 6, 20, 82_51, 3_83, 2, 2_70, 58_66, 37_88, 2, 23_53, 82_51, 1_23_38, 2, 1_39_58, 3_87, 2, 36_29, 69_53, 1_88, 29_00, 2, 1_39_58, 80_11, 1_15_01, 23, 84_60, 40_73, 3_40_09, 20, 4_35, 1_14_39, 27, 8, 84_60, 40_73, 60_04, 20, 99_88, 3_75, 27, 33, 2_66, 19_45, 10_76, 13_50, 3_78_67, 32_88, 5, 5_77, 10_76, 43_74, 8, 50_82, 5, 2_64_53, 2_57, 5_56, 4_03, 2, 2_42, 1_32, 3_83, 3_16, 4_92, 8, 1_07_67, 6, 3_16, 3_04, 42_39, 3, 0], [1_48, 1_57_22, 19, 18_39, 12, 13_50, 13, 2_23_27, 50_82, 54_18, 4_75_67, 3_59_38, 59, 3_18, 1_95_52, 1_08, 21_83, 54, 1_49_76, 48_35, 32, 5_47, 11_14, 8, 3_15, 24_17, 5, 92, 1_90_88, 3, 0, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00], [36, 63_95, 1_25_70, 3_91_47, 1_15_97, 6, 2_66, 4, 4_54_05, 72_96, 3, 0, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00, 5_81_00]], """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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0]]}  # noqa: E501
											# fmt: on

											self.tokenizer_integration_test_util(
											    expected_encoding=lowercase__   ,		model_name="""Helsinki-NLP/opus-mt-en-de"""   ,		revision="""1a8c2263da11e68e50938f97e10cd57820bd504c"""   ,		decode_kwargs={"""use_source_tokenizer""": True}   ,		)







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Any 					=					MarianTokenizer.from_pretrained("""hf-internal-testing/test-marian-two-vocabs"""       )

											snake_case_					:		Dict 					=					"""Tämä on testi"""
											snake_case_					:		List[Any] 					=					"""This is a test"""

											snake_case_					:		Optional[int] 					=					[76, 7, 20_47, 2]
											snake_case_					:		List[str] 					=					[69, 12, 11, 9_40, 2]

											snake_case_					:		Any 					=					tokenizer(lowercase__       ).input_ids
											self.assertListEqual(lowercase__   ,		lowercase__       )

											snake_case_					:		str 					=					tokenizer(text_target=lowercase__       ).input_ids
											self.assertListEqual(lowercase__   ,		lowercase__       )

											snake_case_					:		int 					=					tokenizer.decode(lowercase__   ,		skip_special_tokens=lowercase__       )
											self.assertEqual(lowercase__   ,		lowercase__       )




