小编Tri*_*ran的帖子

Fastai - how to prediction after use load_learner in cpu

I'm doing a Text Classification (NLP) model using fastai train on googlecolab (gpu) after I load the model using load_learner without any error but when I change the cpu usage, I get an error "RuntimeError: _th_index_select not supported on CPUType for Half" Is there any way for me to predict cpu usage results?

from fastai import *
from fastai.text import *
from sklearn.metrics import f1_score
defaults.device = torch.device('cpu')
@np_func
def f1(inp,targ): return f1_score(targ, np.argmax(inp, axis=-1))
path = Path('/content/drive/My Drive/Test_fast_ai')
learn …
Run Code Online (Sandbox Code Playgroud)

python nlp deep-learning fast-ai

6
推荐指数
1
解决办法
276
查看次数

标签 统计

deep-learning ×1

fast-ai ×1

nlp ×1

python ×1