I am new to fastai and deep learning, I have 2 models that were trained and saved on GPU based system. I am now attempting to load the pkl files that were saved on the GPU system and make predictions from a CPU based computer and I keep getting this error “Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=‘cpu’ to map your storages to the CPU.”
FastAI version = 1.0.49
Torch version = 1.0.1
See code below.
from fastai import *
from fastai.text import *
def predict(text, category):
if(category=='xyz' or category=='xyz2'):
learn = load_learner(path=".", fname='model1.pkl')
learn = load_learner(path=".", fname='model2.pkl')
text = 'my text goes here'
res = predict(text,'xyz')