From 296df2b18c86464c640267df877c97a85324ce92 Mon Sep 17 00:00:00 2001 From: Abhishek Rao Date: Wed, 21 Aug 2019 15:29:30 -0700 Subject: [PATCH] reraise exception --- pytorch_transformers/modeling_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch_transformers/modeling_utils.py b/pytorch_transformers/modeling_utils.py index f1501aa8d5..8ad0f672df 100644 --- a/pytorch_transformers/modeling_utils.py +++ b/pytorch_transformers/modeling_utils.py @@ -473,7 +473,7 @@ class PreTrainedModel(nn.Module): # redirect to the cache, if necessary try: resolved_archive_file = cached_path(archive_file, cache_dir=cache_dir, force_download=force_download, proxies=proxies) - except EnvironmentError: + except EnvironmentError as e: if pretrained_model_name_or_path in cls.pretrained_model_archive_map: logger.error( "Couldn't reach server at '{}' to download pretrained weights.".format( @@ -486,7 +486,7 @@ class PreTrainedModel(nn.Module): pretrained_model_name_or_path, ', '.join(cls.pretrained_model_archive_map.keys()), archive_file)) - return None + raise e if resolved_archive_file == archive_file: logger.info("loading weights file {}".format(archive_file)) else: