mlverse / torch

R Interface to Torch
https://torch.mlverse.org
Other
500 stars 68 forks source link

Unable to load pre-trained alexnet weights #1171

Closed mika-long closed 6 months ago

mika-long commented 6 months ago

I have installed packages torch, luz, and torchvision. I had the following code:

library(torch)
library(luz)
library(torchvision)

weights <- model_alexnet(pretrained=TRUE)

The above produces an error as follows: Error in !self$..refer_to_state_dict.. : invalid argument type

Not sure what is wrong here.

dfalbel commented 6 months ago

You probably need to reinstall torch vision, using something like install.packages("torchvision, type="source"). Probably related to https://github.com/mlverse/torchvision/issues/100#issuecomment-1973282566

mika-long commented 6 months ago

This worked! Thank you 🙏