Closed perrigoh closed 1 year ago
further info on arch name and weights name: | arch name | weights name |
---|---|---|
alexnet | AlexNet_Weights | |
vgg13 | VGG13_Weights | |
vgg16 | VGG16_Weights |
note: all the 3 models only have one weight option IMAGENET1K_V1
, IMAGENET1K_V2 not available
decided to leave this userwarning as it is, tried to edit the script to:
weights = models.VGG13_Weights.DEFAULT
model = models.__dict__[arch](weights=weights)
train.py no more warning but a new error occurred for predict.py:
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "predict.py", line 98, in
predict(in_arg.save_dir, in_arg.topk, in_arg.category_names) File "predict.py", line 44, in predict checkpoint = torch.load(checkpoint) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 712, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1049, in _load result = unpickler.load() File "/usr/lib/python3.7/enum.py", line 315, in call return cls.new(cls, value) File "/usr/lib/python3.7/enum.py", line 569, in new raise exc File "/usr/lib/python3.7/enum.py", line 553, in new result = cls.missing(value) File "/usr/lib/python3.7/enum.py", line 582, in missing raise ValueError("%r is not a valid %s" % (value, cls.name)) ValueError: Weights(url='https://download.pytorch.org/models/vgg13-19584684.pth', transforms=functools.partial(<class 'torchvision.transforms._presets.ImageClassification'>, crop_size=224), meta={'min_size': (32, 32), 'categories': ['tench', 'goldfish', 'great white shark', 'tiger shark',
... 'toilet tissue'], 'recipe': 'https://github.com/pytorch/vision/tree/main/references/classification#alexnet-and-vgg', '_docs': 'These weights were trained from scratch by using a simplified training recipe.', 'num_params': 133047848, '_metrics': {'ImageNet-1K': {'acc@1': 69.928, 'acc@5': 89.246}}}) is not a valid VGG13_Weights
not sure how to fix it, furthermore, for the 3 models there is only one weight option.
difference in script in old and new:
from torchvision.prototype.models import get_weight
Development installation: Install PyTorch Nightly
if using colab, info from stackoverflow: You're using the wrong package name, as mentioned on the pytorch website use this:
!pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html -U
Here, -U option is for upgrade (as there is already pytorch stable version installed on colab).
Thank you, PyTorch and its contributors and stackoverflow and its contributors!!!