
import logging
import os
import sys
from dataclasses import dataclass, field
from typing import Optional

from seqaseq_trainer import SeqaSeqTrainer
from seqaseq_training_args import SeqaSeqTrainingArguments

import transformers
from transformers import (
    AutoConfig,
    AutoModelForSeqaSeqLM,
    AutoTokenizer,
    HfArgumentParser,
    MBartTokenizer,
    MBartTokenizerFast,
    set_seed,
)
from transformers.trainer_utils import EvaluationStrategy, is_main_process
from transformers.training_args import ParallelMode
from utils import (
    SeqaSeqDataCollator,
    SeqaSeqDataset,
    assert_all_frozen,
    build_compute_metrics_fn,
    check_output_dir,
    freeze_embeds,
    freeze_params,
    lmap,
    save_json,
    use_task_specific_params,
    write_txt_file,
)


UpperCamelCase_ 						=						logging.getLogger(__name__)

@dataclass
class    a		:
							lowercase_		:    str 				=	field(
							    metadata={'help': 'Path to pretrained model or model identifier from huggingface.co/models'}       )
							lowercase_		:    Optional[str] 				=	field(
							    default=a__   ,						metadata={'help': 'Pretrained config name or path if not the same as model_name'}       )
							lowercase_		:    Optional[str] 				=	field(
							    default=a__   ,						metadata={'help': 'Pretrained tokenizer name or path if not the same as model_name'}       )
							lowercase_		:    Optional[str] 				=	field(
							    default=a__   ,						metadata={'help': 'Where do you want to store the pretrained models downloaded from huggingface.co'}   ,						)
							lowercase_		:    bool 				=	field(default=a__   ,						metadata={'help': 'Whether tp freeze the encoder.'}       )
							lowercase_		:    bool 				=	field(default=a__   ,						metadata={'help': 'Whether  to freeze the embeddings.'}       )

@dataclass
class    a		:
							lowercase_		:    str 				=	field(
							    metadata={'help': 'The input data dir. Should contain the .tsv files (or other data files) for the task.'}       )
							lowercase_		:    Optional[str] 				=	field(
							    default='summarization'   ,						metadata={'help': 'Task name, summarization (or summarization_{dataset} for pegasus) or translation'}   ,						)
							lowercase_		:    Optional[int] 				=	field(
							    default=1_024   ,						metadata={
							        'help': (
							            'The maximum total input sequence length after tokenization. Sequences longer '
							            'than this will be truncated, sequences shorter will be padded.'
							        )
							    }   ,						)
							lowercase_		:    Optional[int] 				=	field(
							    default=128   ,						metadata={
							        'help': (
							            'The maximum total sequence length for target text after tokenization. Sequences longer '
							            'than this will be truncated, sequences shorter will be padded.'
							        )
							    }   ,						)
							lowercase_		:    Optional[int] 				=	field(
							    default=142   ,						metadata={
							        'help': (
							            'The maximum total sequence length for validation target text after tokenization. Sequences longer '
							            'than this will be truncated, sequences shorter will be padded. '
							            'This argument is also used to override the ``max_length`` param of ``model.generate``, which is used '
							            'during ``evaluate`` and ``predict``.'
							        )
							    }   ,						)
							lowercase_		:    Optional[int] 				=	field(
							    default=142   ,						metadata={
							        'help': (
							            'The maximum total sequence length for test target text after tokenization. Sequences longer '
							            'than this will be truncated, sequences shorter will be padded.'
							        )
							    }   ,						)
							lowercase_		:    Optional[int] 				=	field(default=-1   ,						metadata={'help': '# training examples. -1 means use all.'}       )
							lowercase_		:    Optional[int] 				=	field(default=-1   ,						metadata={'help': '# validation examples. -1 means use all.'}       )
							lowercase_		:    Optional[int] 				=	field(default=-1   ,						metadata={'help': '# test examples. -1 means use all.'}       )
							lowercase_		:    Optional[str] 				=	field(default=a__   ,						metadata={'help': 'Source language id for translation.'}       )
							lowercase_		:    Optional[str] 				=	field(default=a__   ,						metadata={'help': 'Target language id for translation.'}       )
							lowercase_		:    Optional[int] 				=	field(default=a__   ,						metadata={'help': '# num_beams to use for evaluation.'}       )
							lowercase_		:    bool 				=	field(
							    default=a__   ,						metadata={'help': 'If only pad tokens should be ignored. This assumes that `config.pad_token_id` is defined.'}   ,						)






def 		_UpperCAmelCase (						UpperCamelCase:  Optional[int]      ,				UpperCamelCase:  str      ,				UpperCamelCase:  int	):






	"""simple docstring"""


	logger.info(F"***** {split} metrics *****"	)
	for key in sorted(metrics.keys()	):
		logger.info(F"  {key} = {metrics[key]}"	)
	save_json(_lowercase      ,				os.path.join(_lowercase      ,				F"{split}_results.json"	)	)






def 		_UpperCAmelCase (						):






	"""simple docstring"""


	__lowerCAmelCase    =				HfArgumentParser((ModelArguments, DataTrainingArguments, SeqaSeqTrainingArguments)	)

	if len(sys.argv	) == 2 and sys.argv[1].endswith(".json"	):
		# If we pass only one argument to the script and it's the path to a json file,
		# let's parse it to get our arguments.
		__lowerCAmelCase    =				parser.parse_json_file(json_file=os.path.abspath(sys.argv[1]	)	)
	else:
		__lowerCAmelCase    =				parser.parse_args_into_dataclasses()

	check_output_dir(_lowercase	)

	# Setup logging
	logging.basicConfig(
	    format="%(asctime)s - %(levelname)s - %(name)s - %(message)s"      ,				datefmt="%m/%d/%Y %H:%M:%S"      ,				level=logging.INFO if training_args.local_rank in [-1, 0] else logging.WARN      ,				)
	logger.warning(
	    "Process rank: %s, device: %s, n_gpu: %s, distributed training: %s, 16-bits training: %s"      ,				training_args.local_rank      ,				training_args.device      ,				training_args.n_gpu      ,				bool(training_args.parallel_mode == ParallelMode.DISTRIBUTED	)      ,				training_args.fpaa      ,				)
	transformers.utils.logging.enable_default_handler()
	transformers.utils.logging.enable_explicit_format()
	# Set the verbosity to info of the Transformers logger (on main process only):
	if is_main_process(training_args.local_rank	):
		transformers.utils.logging.set_verbosity_info()
	logger.info("Training/evaluation parameters %s"      ,				_lowercase	)

	# Set seed
	set_seed(training_args.seed	)

	# Load pretrained model and tokenizer
	#
	# Distributed training:
	# The .from_pretrained methods guarantee that only one local process can concurrently
	# download model & vocab.

	__lowerCAmelCase    =				AutoConfig.from_pretrained(
	    model_args.config_name if model_args.config_name else model_args.model_name_or_path      ,				cache_dir=model_args.cache_dir      ,				)

	__lowerCAmelCase    =				("encoder_layerdrop", "decoder_layerdrop", "dropout", "attention_dropout")
	for p in extra_model_params:
		if getattr(_lowercase      ,				_lowercase      ,				_lowercase	):
			assert hasattr(_lowercase      ,				_lowercase	), F"({config.__class__.__name__}) doesn't have a `{p}` attribute"
			setattr(_lowercase      ,				_lowercase      ,				getattr(_lowercase      ,				_lowercase	)	)

	__lowerCAmelCase    =				AutoTokenizer.from_pretrained(
	    model_args.tokenizer_name if model_args.tokenizer_name else model_args.model_name_or_path      ,				cache_dir=model_args.cache_dir      ,				)
	__lowerCAmelCase    =				AutoModelForSeqaSeqLM.from_pretrained(
	    model_args.model_name_or_path      ,				from_tf=".ckpt" in model_args.model_name_or_path      ,				config=_lowercase      ,				cache_dir=model_args.cache_dir      ,				)

	# use task specific params
	use_task_specific_params(_lowercase      ,				data_args.task	)

	# set num_beams for evaluation
	if data_args.eval_beams is None:
		__lowerCAmelCase    =				model.config.num_beams

	# set decoder_start_token_id for MBart
	if model.config.decoder_start_token_id is None and isinstance(_lowercase      ,				(MBartTokenizer, MBartTokenizerFast)	):
		assert (
		    data_args.tgt_lang is not None and data_args.src_lang is not None
		), "mBart requires --tgt_lang and --src_lang"
		if isinstance(_lowercase      ,				_lowercase	):
			__lowerCAmelCase    =				tokenizer.lang_code_to_id[data_args.tgt_lang]
		else:
			__lowerCAmelCase    =				tokenizer.convert_tokens_to_ids(data_args.tgt_lang	)

	if model_args.freeze_embeds:
		freeze_embeds(_lowercase	)
	if model_args.freeze_encoder:
		freeze_params(model.get_encoder()	)
		assert_all_frozen(model.get_encoder()	)

	__lowerCAmelCase    =				SeqaSeqDataset

	# Get datasets
	__lowerCAmelCase    =				(
	    dataset_class(
	        _lowercase      ,				type_path="train"      ,				data_dir=data_args.data_dir      ,				n_obs=data_args.n_train      ,				max_target_length=data_args.max_target_length      ,				max_source_length=data_args.max_source_length      ,				prefix=model.config.prefix or ""      ,				)
	    if training_args.do_train
	    else None
	)
	__lowerCAmelCase    =				(
	    dataset_class(
	        _lowercase      ,				type_path="val"      ,				data_dir=data_args.data_dir      ,				n_obs=data_args.n_val      ,				max_target_length=data_args.val_max_target_length      ,				max_source_length=data_args.max_source_length      ,				prefix=model.config.prefix or ""      ,				)
	    if training_args.do_eval or training_args.evaluation_strategy != EvaluationStrategy.NO
	    else None
	)
	__lowerCAmelCase    =				(
	    dataset_class(
	        _lowercase      ,				type_path="test"      ,				data_dir=data_args.data_dir      ,				n_obs=data_args.n_test      ,				max_target_length=data_args.test_max_target_length      ,				max_source_length=data_args.max_source_length      ,				prefix=model.config.prefix or ""      ,				)
	    if training_args.do_predict
	    else None
	)

	# Initialize our Trainer
	__lowerCAmelCase    =				(
	    build_compute_metrics_fn(data_args.task      ,				_lowercase	) if training_args.predict_with_generate else None
	)
	__lowerCAmelCase    =				SeqaSeqTrainer(
	    model=_lowercase      ,				args=_lowercase      ,				data_args=_lowercase      ,				train_dataset=_lowercase      ,				eval_dataset=_lowercase      ,				data_collator=SeqaSeqDataCollator(
	        _lowercase      ,				_lowercase      ,				model.config.decoder_start_token_id      ,				training_args.tpu_num_cores	)      ,				compute_metrics=_lowercase      ,				tokenizer=_lowercase      ,				)

	__lowerCAmelCase    =				{}
	# Training
	if training_args.do_train:
		logger.info("*** Train ***"	)

		__lowerCAmelCase    =				trainer.train(
		    model_path=model_args.model_name_or_path if os.path.isdir(model_args.model_name_or_path	) else None	)
		__lowerCAmelCase    =				train_result.metrics
		__lowerCAmelCase    =				data_args.n_train

		trainer.save_model()  # this also saves the tokenizer

		if trainer.is_world_process_zero():
			handle_metrics("train"      ,				_lowercase      ,				training_args.output_dir	)
			all_metrics.update(_lowercase	)

			# Need to save the state, since Trainer.save_model saves only the tokenizer with the model
			trainer.state.save_to_json(os.path.join(training_args.output_dir      ,				"trainer_state.json"	)	)

			# For convenience, we also re-save the tokenizer to the same directory,
			# so that you can share your model easily on huggingface.co/models =)
			tokenizer.save_pretrained(training_args.output_dir	)

    # Evaluation
	if training_args.do_eval:
		logger.info("*** Evaluate ***"	)

		__lowerCAmelCase    =				trainer.evaluate(metric_key_prefix="val"	)
		__lowerCAmelCase    =				data_args.n_val
		__lowerCAmelCase    =				round(metrics["val_loss"]      ,				4	)

		if trainer.is_world_process_zero():
			handle_metrics("val"      ,				_lowercase      ,				training_args.output_dir	)
			all_metrics.update(_lowercase	)

	if training_args.do_predict:
		logger.info("*** Predict ***"	)

		__lowerCAmelCase    =				trainer.predict(test_dataset=_lowercase      ,				metric_key_prefix="test"	)
		__lowerCAmelCase    =				test_output.metrics
		__lowerCAmelCase    =				data_args.n_test

		if trainer.is_world_process_zero():
			__lowerCAmelCase    =				round(metrics["test_loss"]      ,				4	)
			handle_metrics("test"      ,				_lowercase      ,				training_args.output_dir	)
			all_metrics.update(_lowercase	)

			if training_args.predict_with_generate:
				__lowerCAmelCase    =				tokenizer.batch_decode(
				    test_output.predictions      ,				skip_special_tokens=_lowercase      ,				clean_up_tokenization_spaces=_lowercase	)
				__lowerCAmelCase    =				lmap(str.strip      ,				_lowercase	)
				write_txt_file(_lowercase      ,				os.path.join(training_args.output_dir      ,				"test_generations.txt"	)	)

	if trainer.is_world_process_zero():
		save_json(_lowercase      ,				os.path.join(training_args.output_dir      ,				"all_results.json"	)	)

	return all_metrics






def 		_UpperCAmelCase (						UpperCamelCase:  List[Any]	):






	"""simple docstring"""


	main()


if __name__ == "__main__":
					main()













"""simple docstring"""




import gc
import unittest

from transformers import CTRLConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

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


if is_torch_available():
		import torch

		from transformers import (
		    CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
		    CTRLForSequenceClassification,
		    CTRLLMHeadModel,
		    CTRLModel,
		)


class 			__UpperCamelCase							:






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






							def        __a  (  self )      ->					int:
								a :						Optional[Any]      =							ids_tensor([self.batch_size, self.seq_length] ,   self.vocab_size )

								a :						str      =							None
								if self.use_input_mask:
									a :						Dict      =							random_attention_mask([self.batch_size, self.seq_length] )

								a :						Tuple      =							None
								if self.use_token_type_ids:
									a :						int      =							ids_tensor([self.batch_size, self.seq_length] ,   self.type_vocab_size )

								a :						int      =							None
								if self.use_mc_token_ids:
									a :						Dict      =							ids_tensor([self.batch_size, self.num_choices] ,   self.seq_length )

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

								a :						Tuple      =							self.get_config()

								a :						int      =							ids_tensor([self.num_hidden_layers, self.num_attention_heads] ,   2 )

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






							def        __a  (  self )      ->					Tuple:
								return CTRLConfig(
								    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 ,   )






							def        __a  (  self ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   *lowerCAmelCase__ )      ->					str:
								a :						Union[str, Any]      =							CTRLModel(config=lowerCAmelCase__ )
								model.to(lowerCAmelCase__ )
								model.eval()

								model(lowerCAmelCase__ ,   token_type_ids=lowerCAmelCase__ ,   head_mask=lowerCAmelCase__ )
								model(lowerCAmelCase__ ,   token_type_ids=lowerCAmelCase__ )
								a :						List[Any]      =							model(lowerCAmelCase__ )
								self.parent.assertEqual(result.last_hidden_state.shape ,   (self.batch_size, self.seq_length, self.hidden_size) )
								self.parent.assertEqual(len(result.past_key_values ) ,   config.n_layer )






							def        __a  (  self ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   *lowerCAmelCase__ )      ->					Optional[int]:
								a :						Tuple      =							CTRLLMHeadModel(lowerCAmelCase__ )
								model.to(lowerCAmelCase__ )
								model.eval()

								a :						List[str]      =							model(lowerCAmelCase__ ,   token_type_ids=lowerCAmelCase__ ,   labels=lowerCAmelCase__ )
								self.parent.assertEqual(result.loss.shape ,   () )
								self.parent.assertEqual(result.logits.shape ,   (self.batch_size, self.seq_length, self.vocab_size) )






							def        __a  (  self )      ->					Optional[int]:
								a :						Tuple      =							self.prepare_config_and_inputs()

								(
								    (
								    a
								),			(
								    a
								),			(
								    a
								),			(
								    a
								),			(
								    a
								),			(
								    a
								),			(
								    a
								),			(
								    a
								),			(
								    a
								),			
								) :						Optional[Any]      =							config_and_inputs

								a :						List[Any]      =							{"input_ids": input_ids, "token_type_ids": token_type_ids, "head_mask": head_mask}

								return config, inputs_dict






							def        __a  (  self ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   *lowerCAmelCase__ )      ->					Optional[Any]:
								a :						List[str]      =							self.num_labels
								a :						Union[str, Any]      =							CTRLForSequenceClassification(lowerCAmelCase__ )
								model.to(lowerCAmelCase__ )
								model.eval()
								a :						Optional[int]      =							ids_tensor([self.batch_size] ,   self.type_sequence_label_size )
								a :						Dict      =							model(lowerCAmelCase__ ,   token_type_ids=lowerCAmelCase__ ,   labels=lowerCAmelCase__ )
								self.parent.assertEqual(result.logits.shape ,   (self.batch_size, self.num_labels) )


@require_torch
class 			__UpperCamelCase							(		a__						,			a__						,			a__						,			unittest.TestCase		):
							lowerCamelCase  :   Tuple    =(CTRLModel, CTRLLMHeadModel, CTRLForSequenceClassification) if is_torch_available() else ()
							lowerCamelCase  :   List[Any]    =(CTRLLMHeadModel,) if is_torch_available() else ()
							lowerCamelCase  :   List[Any]    =(
							    {
							        """feature-extraction""": CTRLModel,
							        """text-classification""": CTRLForSequenceClassification,
							        """text-generation""": CTRLLMHeadModel,
							        """zero-shot""": CTRLForSequenceClassification,
							    }
							    if is_torch_available()
							    else {}
							)
							lowerCamelCase  :   Optional[int]    =True
							lowerCamelCase  :   List[str]    =False
							lowerCamelCase  :   Optional[Any]    =False






							def        __a  (  self ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ ,   lowerCAmelCase__ )      ->					Optional[int]:
								if pipeline_test_casse_name == "ZeroShotClassificationPipelineTests":
									# Get `tokenizer does not have a padding token` error for both fast/slow tokenizers.
									# `CTRLConfig` 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        __a  (  self )      ->					str:
								a :						str      =							CTRLModelTester(self )
								a :						Dict      =							ConfigTester(self ,   config_class=lowerCAmelCase__ ,   n_embd=37 )






							def        __a  (  self )      ->					Tuple:
								super().tearDown()
								# clean-up as much as possible GPU memory occupied by PyTorch
								gc.collect()
								torch.cuda.empty_cache()






							def        __a  (  self )      ->					Optional[Any]:
								self.config_tester.run_common_tests()






							def        __a  (  self )      ->					Union[str, Any]:
								a :						Optional[int]      =							self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_ctrl_model(*lowerCAmelCase__ )






							def        __a  (  self )      ->					int:
								a :						List[str]      =							self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_lm_head_model(*lowerCAmelCase__ )






							@unittest.skip("Will be fixed soon by reducing the size of the model used for common tests." )
							def        __a  (  self )      ->					Tuple:
								pass






							@slow
							def        __a  (  self )      ->					Optional[Any]:
								for model_name in CTRL_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									a :						Union[str, Any]      =							CTRLModel.from_pretrained(lowerCAmelCase__ )
									self.assertIsNotNone(lowerCAmelCase__ )






							@unittest.skip("The model doesn't support left padding" )  # and it's not used enough to be worth fixing :)
							def        __a  (  self )      ->					Tuple:
								pass


@require_torch
class 			__UpperCamelCase							(		unittest.TestCase		):






							def        __a  (  self )      ->					int:
								super().tearDown()
								# clean-up as much as possible GPU memory occupied by PyTorch
								gc.collect()
								torch.cuda.empty_cache()






							@slow
							def        __a  (  self )      ->					Dict:
								a :						Dict      =							CTRLLMHeadModel.from_pretrained("ctrl" )
								model.to(lowerCAmelCase__ )
								a :						List[str]      =							torch.tensor(
								    [[1_1859, 0, 1611, 8]] ,   dtype=torch.long ,   device=lowerCAmelCase__ )  # Legal the president is
								a :						Any      =							[
								    1_1859,
								    0,
								    1611,
								    8,
								    5,
								    150,
								    2_6449,
								    2,
								    19,
								    348,
								    469,
								    3,
								    2595,
								    48,
								    2_0740,
								    24_6533,
								    24_6533,
								    19,
								    30,
								    5,
								]  # Legal the president is a good guy and I don't want to lose my job. \n \n I have a

								a :						str      =							model.generate(lowerCAmelCase__ ,   do_sample=lowerCAmelCase__ )
								self.assertListEqual(output_ids[0].tolist() ,   lowerCAmelCase__ )


