Unverified Commit 1073a2bd authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Switch `return_dict` to `True` by default. (#8530)

* Use the CI to identify failing tests

* Remove from all examples and tests

* More default switch

* Fixes

* More test fixes

* More fixes

* Last fixes hopefully

* Use the CI to identify failing tests

* Remove from all examples and tests

* More default switch

* Fixes

* More test fixes

* More fixes

* Last fixes hopefully

* Run on the real suite

* Fix slow tests
parent 0d0a0785
...@@ -39,7 +39,7 @@ class TFFlaubertModelIntegrationTest(unittest.TestCase): ...@@ -39,7 +39,7 @@ class TFFlaubertModelIntegrationTest(unittest.TestCase):
"attention_mask": tf.convert_to_tensor([[1, 1, 1, 1, 1, 1]], dtype=tf.int32), "attention_mask": tf.convert_to_tensor([[1, 1, 1, 1, 1, 1]], dtype=tf.int32),
} }
output = model(features, return_dict=True)["last_hidden_state"] output = model(features)["last_hidden_state"]
expected_shape = tf.TensorShape((1, 6, 768)) expected_shape = tf.TensorShape((1, 6, 768))
self.assertEqual(output.shape, expected_shape) self.assertEqual(output.shape, expected_shape)
# compare the actual values for a slice. # compare the actual values for a slice.
......
...@@ -111,7 +111,6 @@ class TFXLNetModelTester: ...@@ -111,7 +111,6 @@ class TFXLNetModelTester:
bos_token_id=self.bos_token_id, bos_token_id=self.bos_token_id,
pad_token_id=self.pad_token_id, pad_token_id=self.pad_token_id,
eos_token_id=self.eos_token_id, eos_token_id=self.eos_token_id,
return_dict=True,
) )
return ( return (
......
...@@ -78,7 +78,6 @@ class TransfoXLModelTester: ...@@ -78,7 +78,6 @@ class TransfoXLModelTester:
div_val=self.div_val, div_val=self.div_val,
n_layer=self.num_hidden_layers, n_layer=self.num_hidden_layers,
eos_token_id=self.eos_token_id, eos_token_id=self.eos_token_id,
return_dict=True,
) )
return (config, input_ids_1, input_ids_2, lm_labels) return (config, input_ids_1, input_ids_2, lm_labels)
......
...@@ -116,7 +116,6 @@ class XLMModelTester: ...@@ -116,7 +116,6 @@ class XLMModelTester:
use_proj=self.use_proj, use_proj=self.use_proj,
num_labels=self.num_labels, num_labels=self.num_labels,
bos_token_id=self.bos_token_id, bos_token_id=self.bos_token_id,
return_dict=True,
) )
return ( return (
......
...@@ -32,7 +32,7 @@ if is_torch_available(): ...@@ -32,7 +32,7 @@ if is_torch_available():
class XLMRobertaModelIntegrationTest(unittest.TestCase): class XLMRobertaModelIntegrationTest(unittest.TestCase):
@slow @slow
def test_xlm_roberta_base(self): def test_xlm_roberta_base(self):
model = XLMRobertaModel.from_pretrained("xlm-roberta-base", return_dict=True) model = XLMRobertaModel.from_pretrained("xlm-roberta-base")
input_ids = torch.tensor([[0, 581, 10269, 83, 99942, 136, 60742, 23, 70, 80583, 18276, 2]]) input_ids = torch.tensor([[0, 581, 10269, 83, 99942, 136, 60742, 23, 70, 80583, 18276, 2]])
# The dog is cute and lives in the garden house # The dog is cute and lives in the garden house
...@@ -51,7 +51,7 @@ class XLMRobertaModelIntegrationTest(unittest.TestCase): ...@@ -51,7 +51,7 @@ class XLMRobertaModelIntegrationTest(unittest.TestCase):
@slow @slow
def test_xlm_roberta_large(self): def test_xlm_roberta_large(self):
model = XLMRobertaModel.from_pretrained("xlm-roberta-large", return_dict=True) model = XLMRobertaModel.from_pretrained("xlm-roberta-large")
input_ids = torch.tensor([[0, 581, 10269, 83, 99942, 136, 60742, 23, 70, 80583, 18276, 2]]) input_ids = torch.tensor([[0, 581, 10269, 83, 99942, 136, 60742, 23, 70, 80583, 18276, 2]])
# The dog is cute and lives in the garden house # The dog is cute and lives in the garden house
......
...@@ -148,7 +148,6 @@ class XLNetModelTester: ...@@ -148,7 +148,6 @@ class XLNetModelTester:
bos_token_id=self.bos_token_id, bos_token_id=self.bos_token_id,
pad_token_id=self.pad_token_id, pad_token_id=self.pad_token_id,
eos_token_id=self.eos_token_id, eos_token_id=self.eos_token_id,
return_dict=True,
) )
return ( return (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment