






'''simple docstring'''







import unittest

from transformers import 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
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
			import torch

			from transformers import (
			    OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST,
			    OpenAIGPTConfig,
			    OpenAIGPTDoubleHeadsModel,
			    OpenAIGPTForSequenceClassification,
			    OpenAIGPTLMHeadModel,
			    OpenAIGPTModel,
			)

class _lowercase			:




							def __init__(							self:       Optional[Any]    ,							UpperCamelCase__:       List[Any]    ,							UpperCamelCase__:       int=13    ,							UpperCamelCase__:       List[str]=7    ,							UpperCamelCase__:       Optional[Any]=True    ,							UpperCamelCase__:       Any=True    ,							UpperCamelCase__:       List[str]=True    ,							UpperCamelCase__:       Optional[Any]=99    ,							UpperCamelCase__:       Union[str, Any]=32    ,							UpperCamelCase__:       Optional[Any]=5    ,							UpperCamelCase__:       str=4    ,							UpperCamelCase__:       str=37    ,							UpperCamelCase__:       List[str]="gelu"    ,							UpperCamelCase__:       Any=0.1    ,							UpperCamelCase__:       Any=0.1    ,							UpperCamelCase__:       Optional[Any]=512    ,							UpperCamelCase__:       Dict=16    ,							UpperCamelCase__:       Union[str, Any]=2    ,							UpperCamelCase__:       Tuple=0.02    ,							UpperCamelCase__:       Union[str, Any]=3    ,							UpperCamelCase__:       Optional[int]=4    ,							UpperCamelCase__:       Any=None    ,							):
														lowerCamelCase__      :			str 						= parent
														lowerCamelCase__      :			Any 						= batch_size
														lowerCamelCase__      :			Optional[int] 						= seq_length
														lowerCamelCase__      :			List[str] 						= is_training
														lowerCamelCase__      :			str 						= use_token_type_ids
														lowerCamelCase__      :			List[Any] 						= use_labels
														lowerCamelCase__      :			str 						= vocab_size
														lowerCamelCase__      :			str 						= hidden_size
														lowerCamelCase__      :			int 						= num_hidden_layers
														lowerCamelCase__      :			Union[str, Any] 						= num_attention_heads
														lowerCamelCase__      :			str 						= intermediate_size
														lowerCamelCase__      :			Union[str, Any] 						= hidden_act
														lowerCamelCase__      :			str 						= hidden_dropout_prob
														lowerCamelCase__      :			Any 						= attention_probs_dropout_prob
														lowerCamelCase__      :			Union[str, Any] 						= max_position_embeddings
														lowerCamelCase__      :			int 						= type_vocab_size
														lowerCamelCase__      :			Any 						= type_sequence_label_size
														lowerCamelCase__      :			Optional[Any] 						= initializer_range
														lowerCamelCase__      :			Union[str, Any] 						= num_labels
														lowerCamelCase__      :			str 						= num_choices
														lowerCamelCase__      :			int 						= scope
														lowerCamelCase__      :			Dict 						= self.vocab_size - 1




							def 	lowerCamelCase_       (							self:       List[Any]  ):
														lowerCamelCase__      :			Optional[Any] 						= ids_tensor([self.batch_size, self.seq_length]    ,							self.vocab_size  )

														lowerCamelCase__      :			List[Any] 						= None
														if self.use_token_type_ids:
																					lowerCamelCase__      :			int 						= ids_tensor([self.batch_size, self.seq_length]    ,							self.type_vocab_size  )

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

														lowerCamelCase__      :			Union[str, Any] 						= OpenAIGPTConfig(
														    vocab_size=self.vocab_size    ,							n_embd=self.hidden_size    ,							n_layer=self.num_hidden_layers    ,							n_head=self.num_attention_heads    ,							n_positions=self.max_position_embeddings    ,							pad_token_id=self.pad_token_id    ,							)

														lowerCamelCase__      :			Any 						= ids_tensor([self.num_hidden_layers, self.num_attention_heads]    ,							2  )

														return (
														    config,
														    input_ids,
														    head_mask,
														    token_type_ids,
														    sequence_labels,
														    token_labels,
														    choice_labels,
														)




							def 	lowerCamelCase_       (							self:       List[Any]    ,							UpperCamelCase__:       Optional[int]    ,							UpperCamelCase__:       Dict    ,							UpperCamelCase__:       List[Any]    ,							UpperCamelCase__:       Dict    ,							*UpperCamelCase__:       Optional[Any]  ):
														lowerCamelCase__      :			int 						= OpenAIGPTModel(config=UpperCamelCase__  )
														model.to(UpperCamelCase__  )
														model.eval()

														lowerCamelCase__      :			Union[str, Any] 						= model(UpperCamelCase__    ,							token_type_ids=UpperCamelCase__    ,							head_mask=UpperCamelCase__  )
														lowerCamelCase__      :			str 						= model(UpperCamelCase__    ,							token_type_ids=UpperCamelCase__  )
														lowerCamelCase__      :			str 						= model(UpperCamelCase__  )

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




							def 	lowerCamelCase_       (							self:       Any    ,							UpperCamelCase__:       Optional[Any]    ,							UpperCamelCase__:       int    ,							UpperCamelCase__:       str    ,							UpperCamelCase__:       Optional[Any]    ,							*UpperCamelCase__:       int  ):
														lowerCamelCase__      :			str 						= OpenAIGPTLMHeadModel(UpperCamelCase__  )
														model.to(UpperCamelCase__  )
														model.eval()

														lowerCamelCase__      :			Any 						= model(UpperCamelCase__    ,							token_type_ids=UpperCamelCase__    ,							labels=UpperCamelCase__  )
														self.parent.assertEqual(result.loss.shape    ,							()  )
														self.parent.assertEqual(result.logits.shape    ,							(self.batch_size, self.seq_length, self.vocab_size)  )




							def 	lowerCamelCase_       (							self:       List[Any]    ,							UpperCamelCase__:       List[str]    ,							UpperCamelCase__:       Any    ,							UpperCamelCase__:       Dict    ,							UpperCamelCase__:       str    ,							*UpperCamelCase__:       int  ):
														lowerCamelCase__      :			List[str] 						= OpenAIGPTDoubleHeadsModel(UpperCamelCase__  )
														model.to(UpperCamelCase__  )
														model.eval()

														lowerCamelCase__      :			Tuple 						= model(UpperCamelCase__    ,							token_type_ids=UpperCamelCase__    ,							labels=UpperCamelCase__  )
														self.parent.assertEqual(result.loss.shape    ,							()  )
														self.parent.assertEqual(result.logits.shape    ,							(self.batch_size, self.seq_length, self.vocab_size)  )




							def 	lowerCamelCase_       (							self:       List[str]    ,							UpperCamelCase__:       Optional[Any]    ,							UpperCamelCase__:       str    ,							UpperCamelCase__:       str    ,							UpperCamelCase__:       Dict    ,							*UpperCamelCase__:       Optional[Any]  ):
														lowerCamelCase__      :			List[Any] 						= self.num_labels
														lowerCamelCase__      :			int 						= OpenAIGPTForSequenceClassification(UpperCamelCase__  )
														model.to(UpperCamelCase__  )
														model.eval()

														lowerCamelCase__      :			Optional[Any] 						= ids_tensor([self.batch_size]    ,							self.type_sequence_label_size  )
														lowerCamelCase__      :			List[Any] 						= model(UpperCamelCase__    ,							token_type_ids=UpperCamelCase__    ,							labels=UpperCamelCase__  )
														self.parent.assertEqual(result.logits.shape    ,							(self.batch_size, self.num_labels)  )




							def 	lowerCamelCase_       (							self:       Any  ):
														lowerCamelCase__      :			Dict 						= self.prepare_config_and_inputs()
														(
														    (
														    lowerCamelCase__
														)						,	(
														    lowerCamelCase__
														)						,	(
														    lowerCamelCase__
														)						,	(
														    lowerCamelCase__
														)						,	(
														    lowerCamelCase__
														)						,	(
														    lowerCamelCase__
														)						,	(
														    lowerCamelCase__
														)						,	
														)      :			Union[str, Any] 						= config_and_inputs
														lowerCamelCase__      :			Dict 						= {
														    """input_ids""": input_ids,
														    """token_type_ids""": token_type_ids,
														    """head_mask""": head_mask,
														}

														return config, inputs_dict



@require_torch
class _lowercase			(       _lowercase       ,   _lowercase       ,   _lowercase       ,   unittest.TestCase	):
							a          = (
							    (OpenAIGPTModel, OpenAIGPTLMHeadModel, OpenAIGPTDoubleHeadsModel, OpenAIGPTForSequenceClassification)
							    if is_torch_available()
							    else ()
							)
							a          = (
							    (OpenAIGPTLMHeadModel,) if is_torch_available() else ()
							)  # TODO (PVP): Add Double HeadsModel when generate() function is changed accordingly
							a          = (
							    {
							        """feature-extraction""": OpenAIGPTModel,
							        """text-classification""": OpenAIGPTForSequenceClassification,
							        """text-generation""": OpenAIGPTLMHeadModel,
							        """zero-shot""": OpenAIGPTForSequenceClassification,
							    }
							    if is_torch_available()
							    else {}
							)




							def 	lowerCamelCase_       (							self:       Optional[int]    ,							UpperCamelCase__:       List[str]    ,							UpperCamelCase__:       Union[str, Any]    ,							UpperCamelCase__:       int    ,							UpperCamelCase__:       List[str]    ,							UpperCamelCase__:       int  ):
														if pipeline_test_casse_name == "ZeroShotClassificationPipelineTests":
																					# Get `tokenizer does not have a padding token` error for both fast/slow tokenizers.
																					# `OpenAIGPTConfig` was never used in pipeline tests, either because of a missing checkpoint or because a
																					# tiny config could not be created.
																					return True

														return False




							def 	lowerCamelCase_       (							self:       Dict    ,							UpperCamelCase__:       Union[str, Any]    ,							UpperCamelCase__:       Dict    ,							UpperCamelCase__:       List[str]=False  ):
														lowerCamelCase__      :			Tuple 						= super()._prepare_for_class(UpperCamelCase__    ,							UpperCamelCase__    ,							return_labels=UpperCamelCase__  )

														if return_labels:
																					if model_class.__name__ == "OpenAIGPTDoubleHeadsModel":
																												lowerCamelCase__      :			Dict 						= torch.zeros(
																												    (self.model_tester.batch_size, self.model_tester.num_choices, self.model_tester.seq_length)    ,							dtype=torch.long    ,							device=UpperCamelCase__    ,							)
																												lowerCamelCase__      :			Optional[int] 						= inputs_dict["""labels"""]
																												lowerCamelCase__      :			Tuple 						= inputs_dict["""labels"""]
																												lowerCamelCase__      :			Optional[Any] 						= torch.zeros(
																												    (self.model_tester.batch_size, self.model_tester.num_choices)    ,							dtype=torch.long    ,							device=UpperCamelCase__    ,							)
																												lowerCamelCase__      :			Optional[int] 						= torch.zeros(
																												    self.model_tester.batch_size    ,							dtype=torch.long    ,							device=UpperCamelCase__  )
														return inputs_dict




							def 	lowerCamelCase_       (							self:       str  ):
														lowerCamelCase__      :			str 						= OpenAIGPTModelTester(self  )
														lowerCamelCase__      :			str 						= ConfigTester(self    ,							config_class=UpperCamelCase__    ,							n_embd=37  )




							def 	lowerCamelCase_       (							self:       Dict  ):
														self.config_tester.run_common_tests()




							def 	lowerCamelCase_       (							self:       Dict  ):
														lowerCamelCase__      :			Union[str, Any] 						= self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_openai_gpt_model(*UpperCamelCase__  )




							def 	lowerCamelCase_       (							self:       int  ):
														lowerCamelCase__      :			List[Any] 						= self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_lm_head_model(*UpperCamelCase__  )




							def 	lowerCamelCase_       (							self:       Optional[int]  ):
														lowerCamelCase__      :			Any 						= self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_double_lm_head_model(*UpperCamelCase__  )




							def 	lowerCamelCase_       (							self:       Tuple  ):
														lowerCamelCase__      :			List[str] 						= self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_openai_gpt_for_sequence_classification(*UpperCamelCase__  )




							@slow
							def 	lowerCamelCase_       (							self:       int  ):
														for model_name in OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																					lowerCamelCase__      :			Union[str, Any] 						= OpenAIGPTModel.from_pretrained(UpperCamelCase__  )
																					self.assertIsNotNone(UpperCamelCase__  )



@require_torch
class _lowercase			(       unittest.TestCase	):




							@slow
							def 	lowerCamelCase_       (							self:       Optional[int]  ):
														lowerCamelCase__      :			Union[str, Any] 						= OpenAIGPTLMHeadModel.from_pretrained("""openai-gpt"""  )
														model.to(UpperCamelCase__  )
														lowerCamelCase__      :			List[Any] 						= torch.tensor([[481, 4_735, 544]]    ,							dtype=torch.long    ,							device=UpperCamelCase__  )  # the president is
														lowerCamelCase__      :			Optional[Any] 						= [
														    481,
														    4_735,
														    544,
														    246,
														    963,
														    870,
														    762,
														    239,
														    244,
														    40_477,
														    244,
														    249,
														    719,
														    881,
														    487,
														    544,
														    240,
														    244,
														    603,
														    481,
														]  # the president is a very good man. " \n " i\'m sure he is, " said the

														lowerCamelCase__      :			Optional[int] 						= model.generate(UpperCamelCase__    ,							do_sample=UpperCamelCase__  )
														self.assertListEqual(output_ids[0].tolist()    ,							UpperCamelCase__  )









'''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			:    int					  =get_tests_dir('''fixtures/test_sentencepiece.model''')

_A			:    Tuple					  ={'''target_lang''': '''fi''', '''source_lang''': '''en'''}
_A			:    int					  ='''>>zh<<'''
_A			:    Dict					  ='''Helsinki-NLP/'''

if is_torch_available():
			_A			:    List[Any]					  ='''pt'''
elif is_tf_available():
			_A			:    Optional[int]					  ='''tf'''
else:
			_A			:    Dict					  ='''jax'''

@require_sentencepiece
class _lowercase			(       _lowercase       ,   unittest.TestCase	):
							a          = MarianTokenizer
							a          = False
							a          = True




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

														lowerCamelCase__      :			Dict 						= MarianTokenizer.from_pretrained(self.tmpdirname  )
														tokenizer.save_pretrained(self.tmpdirname  )




							def 	lowerCamelCase_       (							self:       Optional[Any]    ,							**UpperCamelCase__:       Any  ):
														return MarianTokenizer.from_pretrained(self.tmpdirname    ,							**UpperCamelCase__  )




							def 	lowerCamelCase_       (							self:       str    ,							UpperCamelCase__:       List[str]  ):
														return (
														    "This is a test",
														    "This is a test",
														)




							def 	lowerCamelCase_       (							self:       Optional[Any]  ):
														lowerCamelCase__      :			Any 						= """</s>"""
														lowerCamelCase__      :			List[Any] 						= 0

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




							def 	lowerCamelCase_       (							self:       Union[str, Any]  ):
														lowerCamelCase__      :			int 						= 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(UpperCamelCase__  )    ,							9  )




							def 	lowerCamelCase_       (							self:       int  ):
														self.assertEqual(self.get_tokenizer().vocab_size    ,							9  )




							def 	lowerCamelCase_       (							self:       int  ):
														lowerCamelCase__      :			List[Any] 						= MarianTokenizer.from_pretrained(F'''{ORG_NAME}opus-mt-en-de'''  )
														lowerCamelCase__      :			Optional[int] 						= en_de_tokenizer(["""I am a small frog"""]    ,							return_tensors=UpperCamelCase__  )
														self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )
														lowerCamelCase__      :			Optional[Any] 						= [38, 121, 14, 697, 38_848, 0]
														self.assertListEqual(UpperCamelCase__    ,							batch.input_ids[0]  )

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




							def 	lowerCamelCase_       (							self:       Tuple  ):
														lowerCamelCase__      :			List[Any] 						= self.get_tokenizer()

														lowerCamelCase__      :			Any 						= tok(
														    ["""I am a small frog""" * 1_000, """I am a small frog"""]    ,							padding=UpperCamelCase__    ,							truncation=UpperCamelCase__    ,							return_tensors=UpperCamelCase__  )
														self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )
														self.assertEqual(batch.input_ids.shape    ,							(2, 512)  )




							def 	lowerCamelCase_       (							self:       Union[str, Any]  ):
														lowerCamelCase__      :			str 						= self.get_tokenizer()
														lowerCamelCase__      :			Dict 						= tok(["""I am a tiny frog""", """I am a small frog"""]    ,							padding=UpperCamelCase__    ,							return_tensors=UpperCamelCase__  )
														self.assertIsInstance(UpperCamelCase__    ,							UpperCamelCase__  )
														self.assertEqual(batch_smaller.input_ids.shape    ,							(2, 10)  )




							@slow
							def 	lowerCamelCase_       (							self:       List[str]  ):
														# fmt: off
														lowerCamelCase__      :			int 						= {"""input_ids""": [[43_495, 462, 20, 42_164, 1_369, 52, 464, 132, 1_703, 492, 13, 7_491, 38_999, 6, 8, 464, 132, 1_703, 492, 13, 4_669, 37_867, 13, 7_525, 27, 1_593, 988, 13, 33_972, 7_029, 6, 20, 8_251, 383, 2, 270, 5_866, 3_788, 2, 2_353, 8_251, 12_338, 2, 13_958, 387, 2, 3_629, 6_953, 188, 2_900, 2, 13_958, 8_011, 11_501, 23, 8_460, 4_073, 34_009, 20, 435, 11_439, 27, 8, 8_460, 4_073, 6_004, 20, 9_988, 375, 27, 33, 266, 1_945, 1_076, 1_350, 37_867, 3_288, 5, 577, 1_076, 4_374, 8, 5_082, 5, 26_453, 257, 556, 403, 2, 242, 132, 383, 316, 492, 8, 10_767, 6, 316, 304, 4_239, 3, 0], [148, 15_722, 19, 1_839, 12, 1_350, 13, 22_327, 5_082, 5_418, 47_567, 35_938, 59, 318, 19_552, 108, 2_183, 54, 14_976, 4_835, 32, 547, 1_114, 8, 315, 2_417, 5, 92, 19_088, 3, 0, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100], [36, 6_395, 12_570, 39_147, 11_597, 6, 266, 4, 45_405, 7_296, 3, 0, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100, 58_100]], """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=UpperCamelCase__    ,							model_name="""Helsinki-NLP/opus-mt-en-de"""    ,							revision="""1a8c2263da11e68e50938f97e10cd57820bd504c"""    ,							decode_kwargs={"""use_source_tokenizer""": True}    ,							)




							def 	lowerCamelCase_       (							self:       List[str]  ):
														lowerCamelCase__      :			Union[str, Any] 						= MarianTokenizer.from_pretrained("""hf-internal-testing/test-marian-two-vocabs"""  )

														lowerCamelCase__      :			str 						= """Tämä on testi"""
														lowerCamelCase__      :			Any 						= """This is a test"""

														lowerCamelCase__      :			int 						= [76, 7, 2_047, 2]
														lowerCamelCase__      :			List[str] 						= [69, 12, 11, 940, 2]

														lowerCamelCase__      :			Tuple 						= tokenizer(UpperCamelCase__  ).input_ids
														self.assertListEqual(UpperCamelCase__    ,							UpperCamelCase__  )

														lowerCamelCase__      :			Union[str, Any] 						= tokenizer(text_target=UpperCamelCase__  ).input_ids
														self.assertListEqual(UpperCamelCase__    ,							UpperCamelCase__  )

														lowerCamelCase__      :			Tuple 						= tokenizer.decode(UpperCamelCase__    ,							skip_special_tokens=UpperCamelCase__  )
														self.assertEqual(UpperCamelCase__    ,							UpperCamelCase__  )

