vkypn
vkypn

Reputation: 61

is there any way to train spacy on google colab gpu?

I want to train spacy model on custom dataset but its take too much time for training, is there any way to speed up the training. I passed device=0 in ner.begin_training() but it takes same amount of time as before.

Upvotes: 5

Views: 3115

Answers (1)

seb
seb

Reputation: 4319

Yes, it is possible.

  1. Go to [EDIT] -> [Notebook settings] -> Select GPU under Hardware Acceleration (It restarts the runtime, so all your cell states get lost)
  2. Use !pip install -U spacy[cuda100] to install spacy with Cuda Support
  3. Run the following

Script:

import spacy
gpu = spacy.prefer_gpu()
print('GPU:', gpu)

It returns:

GPU: True

Upvotes: 4

Related Questions