[Bart] enable test_torchscript, update test_tie_weights (#5457)

* Passing all but one torchscript test

* Style

* move comment

* remove unneeded assert
This commit is contained in:
Sam Shleifer
2020-07-07 10:06:48 -04:00
committed by GitHub
parent e49393c361
commit d4886173b2
2 changed files with 1 additions and 7 deletions

View File

@@ -612,15 +612,11 @@ class ModelTesterMixin:
if model_not_tied.get_output_embeddings() is None:
continue
params_not_tied = list(model_not_tied.parameters())
config_tied = copy.deepcopy(config)
config_tied.torchscript = False
model_tied = model_class(config_tied)
params_tied = list(model_tied.parameters())
# Check that the embedding layer and decoding layer are the same in size and in value
self.assertGreater(len(params_not_tied), len(params_tied))
# self.assertTrue(check_same_values(embeddings, decoding))
# # Check that after modification, they remain the same.
@@ -638,7 +634,6 @@ class ModelTesterMixin:
# Check that after resize they remain tied.
model_tied.resize_token_embeddings(config.vocab_size + 10)
params_tied_2 = list(model_tied.parameters())
self.assertGreater(len(params_not_tied), len(params_tied))
self.assertEqual(len(params_tied_2), len(params_tied))
# decoding.weight.data.mul_(20)