Skip to content
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

NameError: name 'gpu_ops' is not defined #76

Closed
Caramazula opened this issue Oct 19, 2018 · 2 comments
Closed

NameError: name 'gpu_ops' is not defined #76

Caramazula opened this issue Oct 19, 2018 · 2 comments
Labels
docs Documentation

Comments

@Caramazula
Copy link

Hi,
I am currently trying to set up an Ubuntu machine in order to train a spaCy model via GPU. Here is how I set everything up:

  • I started on a clean Ubuntu 18 machine with Python 3.7 and cuda 10.0
  • I created a venv
  • I installed spaCy via pip install spacy[cuda10] as described on https://spacy.io/usage/#gpu which should install cupy and thinc_gpu_ops, but it didn't install either. Furthermore I got this warning spacy 2.0.16 does not provide the extra 'cuda10'. I run into a similar warning when installing thinc with pip install thinc[cuda10]
  • I installed cupy

And then I just tried running the script and ran into this error:

  File "/home/cuda/venv/lib/python3.7/site-packages/thinc/neural/_classes/hash_embed.py", line 51, in begin_update
    keys = self.ops.hash(ids, self.seed) % self.nV
  File "ops.pyx", line 821, in thinc.neural.ops.CupyOps.hash
NameError: name 'gpu_ops' is not defined

Which has been discussed over here: explosion/spaCy#1745 . But none of the answers helped me with the problem. Which is probably because the newest thinc version (which I use) had its gpu ops moved into a sperate package.
Thats why I tried to install thinc-gpu-ops manually with pip install thinc-gpu-ops, but I run into an error while compiling:

thinc_gpu_ops/gpu_ops.cpp:7861:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
         tstate->exc_traceback = local_tb;
                 ^~~~~~~~~~~~~
                 curexc_traceback
    error: command 'gcc' failed with exit status 1

I tried downgrading my gcc to 6, but to no avail.

My Environment

  • spaCy version: 2.0.16
  • Platform: Linux-4.15.0-36-generic-x86_64-with-debian-buster-sid (Ubuntu 18.04.1 LTS)
  • Python version: 3.7.0
  • cupy 4.5.0
  • thinc 6.12.0
  • cuda 10.0
  • g++ 7
  • GPU GeForce GTX 1050

I am fairly certain that all of this is due to some version mismatch, but I don't want to try all combinations, can anyone tell me which setup of versions is working?

Many thanks!

@honnibal
Copy link
Member

Hmm, it seems cupy doesn't support cuda 10 yet. I wasn't aware of this. Unfortunately you'll have to reinstall with CUDA 9.2.

@honnibal honnibal added the docs Documentation label Oct 22, 2018
@Caramazula
Copy link
Author

Thank you for pointing that out. I tried it again using cuda 9.2. Furthermore I had to downgrade to Python 3.6.6 in order to install cupy-cuda92. And now it works!
The first few tests suggest a speedup of about 70%. That said, my GPU is only running at 12.2% right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation
Projects
None yet
Development

No branches or pull requests

2 participants