mlverse / torch

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

Unable to load pre-trained alexnet weights #1171

Closed mika-long closed 1 month ago

mika-long commented 1 month 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 1 month 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 1 month ago

This worked! Thank you 🙏