From 97664faf7adfc2b9d40708f80f94b5f167942e93 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger Date: Wed, 14 Apr 2021 11:12:43 -0400 Subject: [PATCH] Fix #10128 --- src/transformers/trainer_pt_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/trainer_pt_utils.py b/src/transformers/trainer_pt_utils.py index 0d3fe6407c66..ebcb7d055723 100644 --- a/src/transformers/trainer_pt_utils.py +++ b/src/transformers/trainer_pt_utils.py @@ -72,7 +72,7 @@ def torch_pad_and_concatenate(tensor1, tensor2, padding_index=-100): def numpy_pad_and_concatenate(array1, array2, padding_index=-100): """Concatenates `array1` and `array2` on first axis, applying padding on the second if necessary.""" if len(array1.shape) == 1 or array1.shape[1] == array2.shape[1]: - return np.concatenate((array1, array2), dim=0) + return np.concatenate((array1, array2), axis=0) # Let's figure out the new shape new_shape = (array1.shape[0] + array2.shape[0], max(array1.shape[1], array2.shape[1])) + array1.shape[2:]