From ff8376bb903fe11a371df658f4bc87d3d6903125 Mon Sep 17 00:00:00 2001 From: Zhi Tian Date: Wed, 29 May 2019 18:21:22 +0930 Subject: [PATCH] fixed error cannot import _download_url_to_file with pytorch 1.1.0 --- maskrcnn_benchmark/utils/model_zoo.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/maskrcnn_benchmark/utils/model_zoo.py b/maskrcnn_benchmark/utils/model_zoo.py index 7a0ebb34..bd644d7c 100644 --- a/maskrcnn_benchmark/utils/model_zoo.py +++ b/maskrcnn_benchmark/utils/model_zoo.py @@ -2,9 +2,14 @@ import os import sys -from torch.utils.model_zoo import _download_url_to_file -from torch.utils.model_zoo import urlparse -from torch.utils.model_zoo import HASH_REGEX +try: + from torch.utils.model_zoo import _download_url_to_file + from torch.utils.model_zoo import urlparse + from torch.utils.model_zoo import HASH_REGEX +except: + from torch.hub import _download_url_to_file + from torch.hub import urlparse + from torch.hub import HASH_REGEX from maskrcnn_benchmark.utils.comm import is_main_process from maskrcnn_benchmark.utils.comm import synchronize