Spaces:
Sleeping
Sleeping
Fix torchvision import for compatibility with newer PyTorch versions
Browse files- models/resnet.py +4 -1
models/resnet.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
import torch.nn as nn
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
|
|
|
|
| 1 |
import torch
|
| 2 |
import torch.nn as nn
|
| 3 |
+
try:
|
| 4 |
+
from torch.hub import load_state_dict_from_url
|
| 5 |
+
except ImportError:
|
| 6 |
+
from torchvision.models.utils import load_state_dict_from_url
|
| 7 |
|
| 8 |
|
| 9 |
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
|