Simplify re-raising exceptions.

Most module use the simpler `raise` version. Normalize those that don't.
This commit is contained in:
Aymeric Augustin
2019-12-23 21:20:54 +01:00
parent 5565dcdd35
commit 4c09a96096
3 changed files with 16 additions and 16 deletions

View File

@@ -454,12 +454,12 @@ class PreTrainedModel(nn.Module):
from transformers import load_tf2_checkpoint_in_pytorch_model
model = load_tf2_checkpoint_in_pytorch_model(model, resolved_archive_file, allow_missing_keys=True)
except ImportError as e:
except ImportError:
logger.error(
"Loading a TensorFlow model in PyTorch, requires both PyTorch and TensorFlow to be installed. Please see "
"https://pytorch.org/ and https://www.tensorflow.org/install/ for installation instructions."
)
raise e
raise
else:
# Convert old format to new format if needed from a PyTorch state_dict
old_keys = []