From d3007307cc442c49ca1de0981a64d7d85b41d881 Mon Sep 17 00:00:00 2001 From: Baijiong Lin Date: Wed, 22 Nov 2023 16:08:44 +0800 Subject: [PATCH] support new version of torchvision (#62) --- LibMTL/model/resnet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LibMTL/model/resnet.py b/LibMTL/model/resnet.py index e11d35f..59cf18c 100644 --- a/LibMTL/model/resnet.py +++ b/LibMTL/model/resnet.py @@ -1,6 +1,9 @@ import torch import torch.nn as nn -from torchvision.models.utils import load_state_dict_from_url +try: + from torchvision.models.utils import load_state_dict_from_url +except: + from torch.hub import load_state_dict_from_url # __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',