Skip to content

Commit

Permalink
Debugged a torchvision version problem (#600)
Browse files Browse the repository at this point in the history
Co-authored-by: wangshen <[email protected]>
  • Loading branch information
Cathesilta and wangshen authored Dec 3, 2021
1 parent 9208930 commit fb1027d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fastreid/modeling/backbones/mobilenetv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
import torch
from torch import nn, Tensor
from torch.nn import functional as F
from torchvision.models.utils import load_state_dict_from_url

#The style of importing Considers compatibility for the diversity of torchvision versions
try:
from torchvision.models.utils import load_state_dict_from_url
except ImportError:
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url

from fastreid.layers import get_norm
from .build import BACKBONE_REGISTRY
Expand Down

0 comments on commit fb1027d

Please sign in to comment.