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

AttributeError: module 'warpctc_pytorch' has no attribute 'gpu_ctc' #112

Closed
ArtemiyFirsov opened this issue Jul 17, 2017 · 8 comments
Closed

Comments

@ArtemiyFirsov
Copy link

Hello!

Did everything as in instruction, and when running train.py with --cuda param, get this error.

Can you please help?

@ArtemiyFirsov
Copy link
Author

Here is Torch binding log:

luarocks make torch_binding/rocks/warp-ctc-scm-1.rockspec
Warning: unmatched variable LUALIB
cmake -E make_directory build && cd build && cmake .. -DLUALIB= -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/usr/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/usr/torch/install/lib/luarocks/rocks/warp-ctc/scm-1" && make -j$(getconf _NPROCESSORS_ONLN) && make install

-- cuda found TRUE
-- Found Torch7 in /home/usr/torch/install
-- Torch found /home/usr/torch/install/share/cmake/torch
-- Building shared library with GPU support
-- Building Torch Bindings with GPU support
-- Configuring done
-- Generating done
-- Build files have been written to: /home/usr/warp-ctc/build
[ 30%] Built target warpctc
[ 50%] Built target test_cpu
[ 80%] Built target warp_ctc
[100%] Built target test_gpu
[ 30%] Built target warpctc
[ 50%] Built target test_cpu
[ 70%] Built target test_gpu
[100%] Built target warp_ctc
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /home/usr/torch/install/lib/libwarpctc.so
-- Up-to-date: /home/usr/torch/install/include/ctc.h
-- Up-to-date: /home/usr/torch/install/lib/libwarpctc.so
-- Installing: /home/usr/torch/install/lib/luarocks/rocks/warp-ctc/scm-1/lib/libwarp_ctc.so
-- Installing: /home/usr/torch/install/lib/luarocks/rocks/warp-ctc/scm-1/lua/warp_ctc/init.lua
cd build
Updating manifest for /home/usr/torch/install/lib/luarocks/rocks
warp-ctc scm-1 is now built and installed in /home/usr/torch/install/ (license: Apache)

@SeanNaren
Copy link
Owner

Make sure to do export CUDA_HOME="/usr/local/cuda" before installing the warp_ctc library. See here.

@ArtemiyFirsov
Copy link
Author

@SeanNaren thank you. I again tried to do this, but no result.
I deleted warp-ctc folder, cloned it (from your fork - https://github.com/SeanNaren/warp-ctc), exported CUDA_HOME, did every step like in your installation guide. Still get this error when running train.py:

Traceback (most recent call last):
File "train.py", line 388, in
main()
File "train.py", line 236, in main
loss = criterion(out, targets, sizes, target_sizes)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 206, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/warpctc_pytorch/init.py", line 59, in forward
return _CTC()(acts, labels, act_lens, label_lens)
File "/usr/local/lib/python3.5/dist-packages/warpctc_pytorch/init.py", line 26, in forward
loss_func = warp_ctc.gpu_ctc if is_cuda else warp_ctc.cpu_ctc
AttributeError: module 'warpctc_pytorch' has no attribute 'gpu_ctc'

Have cuda 8.0 version installed, torch and pytorch installed.

@ArtemiyFirsov
Copy link
Author

OK, I see, sorry for that for some reason env var CUDA_HOME isn't found after setting it. I will let you know if fix

@ArtemiyFirsov
Copy link
Author

OK, I seems like the problem was caused by context issues. I modified script to set env variable and everything worked. Thank you. Closing issue

@rohun-tripathi
Copy link

I am adding this note, for others who face the issue.

The setup file uses os.environ for looking up the environment variables.
and I used sudo python setup.py install.

But the environment variables inside the sudo environment are DIFFERENT to the environment variables in the normal user environment.

This can be checked by using 'sudo python' to enter the python console and then checking the output for :

import os
os.environ

the output for 'os.environ' when using "python" different.

@t-vi
Copy link

t-vi commented Jan 4, 2018

You can use sudo -E ... to keep the environment.
CUDA_HOME=/usr/local/cuda sudo -E python3 setup.py install
except python if you want python2. :)

@bornfree
Copy link

Pull request SeanNaren/warp-ctc#21 on warp-ctc seems to be causing this issue again. If I use a commit before that and re-build warp-ctc, I'm able to run the DeepSpeech training.

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

No branches or pull requests

5 participants