How can i run a model trained on GPU in spacy

Viewed 3242

Title.I use spacy2.2.3 to train a new model,so i code that in cmd in windows7:

python -m spacy train -g -1 zh models train_path dev_path

Also,i install cupy-cuda101,version 7.2.0. When coding in python3.7.6:

import spacy
spacy.prefer_gpu()
spacy.require_gpu()

They both print "True".

I use '-g -1' because i want to train it on gpu,and i learnt this by help option. And then,i opened taskmgr as well as GPU-Z,the result told me it still run on cpu instead of gpu.

What cause it?I am pretty new in this. Who can help me?

System:Windows 7

GPU :GT740

1 Answers

Two things:

  • -g -1 disables the GPU, the option to enable the GPU is -g 0 or -g 1 or whichever GPU ID you want it to use

  • there's a major bug in the GPU support for windows in spacy v2.2.3, so you want to train on CPU only in windows (leave out -g or use -g -1 like above) until v2.2.4 is released

Related