From e6c0019c80d03b86e7fc051a9c51c55d9a4e7ba7 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Mon, 23 Dec 2019 22:31:39 +0100 Subject: [PATCH] Remove unused variables in tests. --- tests/test_modeling_common.py | 3 +-- tests/test_modeling_tf_common.py | 2 +- tests/test_modeling_tf_xlm.py | 1 - tests/test_tokenization_common.py | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/test_modeling_common.py b/tests/test_modeling_common.py index 2c634ed958..719debcb3c 100644 --- a/tests/test_modeling_common.py +++ b/tests/test_modeling_common.py @@ -284,7 +284,6 @@ class ModelTesterMixin: multihead_outputs = head_mask.grad attentions = outputs[-1] - hidden_states = outputs[-2] # Remove Nan for t in attentions: @@ -590,7 +589,7 @@ class ModelTesterMixin: inputs_dict["decoder_inputs_embeds"] = wte(decoder_input_ids) with torch.no_grad(): - outputs = model(**inputs_dict) + model(**inputs_dict) class ConfigTester(object): diff --git a/tests/test_modeling_tf_common.py b/tests/test_modeling_tf_common.py index 114d69ed1b..e6fb1439c1 100644 --- a/tests/test_modeling_tf_common.py +++ b/tests/test_modeling_tf_common.py @@ -332,7 +332,7 @@ class TFModelTesterMixin: inputs_dict["encoder_inputs_embeds"] = self._get_embeds(wte, encoder_input_ids) inputs_dict["decoder_inputs_embeds"] = self._get_embeds(wte, decoder_input_ids) - outputs = model(inputs_dict) + model(inputs_dict) def ids_tensor(shape, vocab_size, rng=None, name=None, dtype=None): diff --git a/tests/test_modeling_tf_xlm.py b/tests/test_modeling_tf_xlm.py index 5160fde479..53719f63f4 100644 --- a/tests/test_modeling_tf_xlm.py +++ b/tests/test_modeling_tf_xlm.py @@ -224,7 +224,6 @@ class TFXLMModelTest(TFModelTesterMixin, unittest.TestCase): inputs = {"input_ids": input_ids, "lengths": input_lengths} - outputs = model(inputs) start_logits, end_logits = model(inputs) result = { diff --git a/tests/test_tokenization_common.py b/tests/test_tokenization_common.py index 035a0dc27f..c10dfb4785 100644 --- a/tests/test_tokenization_common.py +++ b/tests/test_tokenization_common.py @@ -159,7 +159,6 @@ class TokenizerTesterMixin: self.assertEqual(all_size_2, all_size + len(new_toks)) tokens = tokenizer.encode("aaaaa bbbbbb low cccccccccdddddddd l", add_special_tokens=False) - out_string = tokenizer.decode(tokens) self.assertGreaterEqual(len(tokens), 4) self.assertGreater(tokens[0], tokenizer.vocab_size - 1) @@ -178,7 +177,6 @@ class TokenizerTesterMixin: tokens = tokenizer.encode( ">>>>|||<||<<|<< aaaaabbbbbb low cccccccccdddddddd <<<<<|||>|>>>>|> l", add_special_tokens=False ) - out_string = tokenizer.decode(tokens) self.assertGreaterEqual(len(tokens), 6) self.assertGreater(tokens[0], tokenizer.vocab_size - 1)