Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support load_state_dict_from_url in later pytorch versions #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion segmentation/model/backbone/hrnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
import logging
import torch.nn as nn
import torch.nn.functional as F
from torchvision.models.utils import load_state_dict_from_url

try:
from torch.hub import load_state_dict_from_url
except:
from torchvision.models.utils import load_state_dict_from_url

logger = logging.getLogger('hrnet_backbone')

Expand Down
6 changes: 5 additions & 1 deletion segmentation/model/backbone/mnasnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

import torch
import torch.nn as nn
from torchvision.models.utils import load_state_dict_from_url

try:
from torch.hub import load_state_dict_from_url
except:
from torchvision.models.utils import load_state_dict_from_url

__all__ = ['MNASNet', 'mnasnet0_5', 'mnasnet0_75', 'mnasnet1_0', 'mnasnet1_3']

Expand Down
5 changes: 4 additions & 1 deletion segmentation/model/backbone/mobilenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
# ------------------------------------------------------------------------------

from torch import nn
from torchvision.models.utils import load_state_dict_from_url

try:
from torch.hub import load_state_dict_from_url
except:
from torchvision.models.utils import load_state_dict_from_url

__all__ = ['MobileNetV2', 'mobilenet_v2']

Expand Down
5 changes: 4 additions & 1 deletion segmentation/model/backbone/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
# ------------------------------------------------------------------------------

import torch.nn as nn
from torchvision.models.utils import load_state_dict_from_url

try:
from torch.hub import load_state_dict_from_url
except:
from torchvision.models.utils import load_state_dict_from_url

__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d', 'resnext101_32x8d',
Expand Down
6 changes: 5 additions & 1 deletion segmentation/model/backbone/xception.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
from collections import OrderedDict

import torch.nn as nn
from torchvision.models.utils import load_state_dict_from_url

try:
from torch.hub import load_state_dict_from_url
except:
from torchvision.models.utils import load_state_dict_from_url

__all__ = ['Xception65', 'xception65']

Expand Down