-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NER training with GPU #1530
Comments
Yes, it should be 2-3x faster on GPU. The easiest way is to use the Getting the GPU set up is a bit fiddly, however. Try to import This will all get smoother in future. |
@damianoporta I was able to enable my GPU for NER training by updating this line of the NER trainer script after getting
I found that option hiding in |
@johnfraney Yeah i have found that parameter too. (in the |
@damianoporta Hmm. I just tested mine and it seems to be working. I kept an eye on the GPU stats using |
@johnfraney The GPU usage should pick up a little as training progresses. The default recipe is to start with batch size 1 and increase to batch size 16. You might try setting a higher maximum batch size too. You can do that with the Btw if you're only training the NER, try disabling the parser explicitly with I still only see 30-40% GPU utilisation at the best of times, though. I've switched my training workflow to CPU, because cloud GPU is so expensive, and my priority is experiment bandwidth, rather than latency of a single result. |
@honnibal Thanks for the tip! I'll give that a try. I'm having a lot of fun with spaCy. Thanks a bunch for sharing it. |
@honnibal thank you! |
Hello @honnibal ! |
Facing the same issue as others - GPU usage stays low. Is there any workaround yet? |
After installing everything i got this error when running with gpu:
Any one got any tips for what went wrong? Did cupy not install correctly? I tried importing
So i'm suspecting that Cupy did not install correclty. My cuda path is So i ran: I have installed cuda |
Solved! I had forgotten to add cuda to path:
|
Lastly to get the |
I can see that Spacy only uses 523 mb of memory on my Graphic card. However i suspect that the dataset should take up more space. Is there any settings that limits the amount of memory i Spacy uses? |
@ohenrik We don't currently copy the whole dataset to GPU. Maybe we should? We can't tokenize on GPU obviously, but we could take the result of Part of the parsing algorithm is still on CPU: there's part where we step through the words and have to manipulate the parse state. I don't have the state object implemented in CUDA yet, so we have to do this on CPU at the moment. |
I used to do a lot of GPGPU work. The largest GPGPU dataset I ever worked on was a TB-sized image where I performed various image processing tasks using the GPU. The primary bottleneck was data transfer over the PCIe bus. Admittedly, this was several years ago and things have improved. But as far as I am aware, it is still a bottleneck. GPUs are computational monsters, but it can be difficult to feed the monster if the dataset is larger than GPU RAM. Assuming you can port the entire algorithm to the GPU, my 2 cents is load the entire dataset into GPU RAM if it will fit and load large chunks if it won't. I would expect to see a significant performance improvement. |
Traceback (most recent call last): While accessing gpu using nlp.begin_training(device=0) i got this error!! |
@gauravgola96 I recommend creating a new, separate issue for the error rather than commenting on an old issue. That way it can be tracked more easily. Additionally, providing a small but complete code sample in the new, separate issue would make the bug easier to fix. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hello!
Can the NER example (https:/explosion/spaCy/blob/v2.0.2/examples/training/train_ner.py) be adaptable for GPU device?
I would like to speed up the training.
Thanks
The text was updated successfully, but these errors were encountered: