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

A few minor fixes #12

Merged
merged 3 commits into from
Feb 16, 2018
Merged

A few minor fixes #12

merged 3 commits into from
Feb 16, 2018

Conversation

r9y9
Copy link
Contributor

@r9y9 r9y9 commented Jan 28, 2018

Please see commit messages for details.

this avoids creating an unnecessary directory `warp_ctc` in the top of
the pytorch_binding

Quote from: http://pytorch.org/docs/master/ffi.html

package : set to True to build in package mode (for modules meant to be
installed as pip packages
@SeanNaren SeanNaren merged commit 745281f into SeanNaren:pytorch_bindings Feb 16, 2018
@SeanNaren
Copy link
Owner

Thanks man!

@r9y9 r9y9 deleted the py-fixes branch February 16, 2018 11:29
@SeanNaren
Copy link
Owner

SeanNaren commented Feb 16, 2018

@r9y9 I've made a PR to revert the changes, I'm seeing some errors in the building of the library, could you help debug this? How do you currently build this lib?

@r9y9
Copy link
Contributor Author

r9y9 commented Feb 16, 2018

I used python setup.py develop. What errors are you seeing?

@SeanNaren
Copy link
Owner

SeanNaren commented Feb 16, 2018

Doing a python setup.py install and then running the tests end with a strange error message about lib, do you not see that on your side? I'll open up a new PR that reverts the revert :D

@r9y9
Copy link
Contributor Author

r9y9 commented Feb 19, 2018

I'm currently in a business trip and cannot have access to my PC (with GTX 1080 Ti). I will try to investigate when I get back.

@r9y9
Copy link
Contributor Author

r9y9 commented Feb 24, 2018

Sorry for late; I'm back. I cannot reproduce. Could you tell me what exactly you are seeing?

CUDA_HOME=/usr/local/cuda python setup.py install                       
generating build/warpctc_pytorch/_warp_ctc/__warp_ctc.c
regenerated: 'build/warpctc_pytorch/_warp_ctc/__warp_ctc.c'
running install
running bdist_egg
running egg_info
writing warpctc_pytorch.egg-info/PKG-INFO
writing dependency_links to warpctc_pytorch.egg-info/dependency_links.txt
writing top-level names to warpctc_pytorch.egg-info/top_level.txt
reading manifest file 'warpctc_pytorch.egg-info/SOURCES.txt'
writing manifest file 'warpctc_pytorch.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/warpctc_pytorch
copying warpctc_pytorch/__init__.py -> build/lib.linux-x86_64-3.6/warpctc_pytorch
running build_ext
building 'warpctc_pytorch._warp_ctc.__warp_ctc' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/warpctc_pytorch
creating build/temp.linux-x86_64-3.6/build/warpctc_pytorch/_warp_ctc
creating build/temp.linux-x86_64-3.6/home
creating build/temp.linux-x86_64-3.6/home/ryuichi
creating build/temp.linux-x86_64-3.6/home/ryuichi/Dropbox
creating build/temp.linux-x86_64-3.6/home/ryuichi/Dropbox/numeric
creating build/temp.linux-x86_64-3.6/home/ryuichi/Dropbox/numeric/warp-ctc
creating build/temp.linux-x86_64-3.6/home/ryuichi/Dropbox/numeric/warp-ctc/pytorch_binding
creating build/temp.linux-x86_64-3.6/home/ryuichi/Dropbox/numeric/warp-ctc/pytorch_binding/src
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/ryuichi/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/ryuichi/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ryuichi/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ryuichi/Dropbox/numeric/warp-ctc/include -I/home/ryuichi/anaconda3/include/python3.6m -c build/warpctc_pytorch/_warp_ctc/__warp_ctc.c -o build/temp.linux-x86_64-3.6/build/warpctc_pytorch/_warp_ctc/__warp_ctc.o -std=c++11 -fPIC -DWARPCTC_ENABLE_GPU
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/ryuichi/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/ryuichi/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ryuichi/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ryuichi/Dropbox/numeric/warp-ctc/include -I/home/ryuichi/anaconda3/include/python3.6m -c /home/ryuichi/Dropbox/numeric/warp-ctc/pytorch_binding/src/binding.cpp -o build/temp.linux-x86_64-3.6/home/ryuichi/Dropbox/numeric/warp-ctc/pytorch_binding/src/binding.o -std=c++11 -fPIC -DWARPCTC_ENABLE_GPU
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
creating build/lib.linux-x86_64-3.6/warpctc_pytorch/_warp_ctc
g++ -pthread -shared -L/home/ryuichi/anaconda3/lib -Wl,-rpath=/home/ryuichi/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.6/build/warpctc_pytorch/_warp_ctc/__warp_ctc.o build/temp.linux-x86_64-3.6/home/ryuichi/Dropbox/numeric/warp-ctc/pytorch_binding/src/binding.o -L/home/ryuichi/Dropbox/numeric/warp-ctc/build -L/home/ryuichi/anaconda3/lib -lwarpctc -lpython3.6m -o build/lib.linux-x86_64-3.6/warpctc_pytorch/_warp_ctc/__warp_ctc.cpython-36m-x86_64-linux-gnu.so -Wl,-rpath,/home/ryuichi/Dropbox/numeric/warp-ctc/build
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/warpctc_pytorch
copying build/lib.linux-x86_64-3.6/warpctc_pytorch/__init__.py -> build/bdist.linux-x86_64/egg/warpctc_pytorch
creating build/bdist.linux-x86_64/egg/warpctc_pytorch/_warp_ctc
copying build/lib.linux-x86_64-3.6/warpctc_pytorch/_warp_ctc/__warp_ctc.cpython-36m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg/warpctc_pytorch/_warp_ctc
byte-compiling build/bdist.linux-x86_64/egg/warpctc_pytorch/__init__.py to __init__.cpython-36.pyc
creating stub loader for warpctc_pytorch/_warp_ctc/__warp_ctc.cpython-36m-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/warpctc_pytorch/_warp_ctc/__warp_ctc.py to __warp_ctc.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying warpctc_pytorch.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying warpctc_pytorch.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying warpctc_pytorch.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying warpctc_pytorch.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
warpctc_pytorch._warp_ctc.__pycache__.__warp_ctc.cpython-36: module references __file__
creating dist
creating 'dist/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing warpctc_pytorch-0.1-py3.6-linux-x86_64.egg
removing '/home/ryuichi/anaconda3/lib/python3.6/site-packages/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg' (and everything under it)
creating /home/ryuichi/anaconda3/lib/python3.6/site-packages/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg
Extracting warpctc_pytorch-0.1-py3.6-linux-x86_64.egg to /home/ryuichi/anaconda3/lib/python3.6/site-packages
warpctc-pytorch 0.1 is already the active version in easy-install.pth

Installed /home/ryuichi/anaconda3/lib/python3.6/site-packages/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg
Processing dependencies for warpctc-pytorch==0.1
Finished processing dependencies for warpctc-pytorch==0.1
python tests/test.py 
Variable containing:
 0.1770 -0.7081  0.1770  0.1770  0.1770
-0.8230  0.1770  0.2919  0.1770  0.1770
 0.2919  0.1770 -0.8230  0.1770  0.1770
-0.8213  0.1787  0.2665  0.1975  0.1787
[torch.cuda.FloatTensor of size 4x5 (GPU 0)]

.Variable containing:
 0.1770 -0.7081  0.1770  0.1770  0.1770
 0.1770 -0.8230  0.2919  0.1770  0.1770
 0.2919  0.1770 -0.8230  0.1770  0.1770
 0.1787  0.1787 -0.7335  0.1975  0.1787
[torch.cuda.FloatTensor of size 4x5 (GPU 0)]

.Variable containing:
 0.0000  0.0000  0.0000  0.0000  0.0000
 0.0000 -1.0000  1.0000  0.0000  0.0000
 1.0000  0.0000 -1.0000  0.0000  0.0000
 0.0000  0.0000  0.0000  0.0000  0.0000
[torch.cuda.FloatTensor of size 4x5 (GPU 0)]

.Variable containing:
 0.1770 -0.7081  0.1770  0.1770  0.1770
 0.1770  0.1770 -0.7081  0.1770  0.1770
[torch.cuda.FloatTensor of size 2x5 (GPU 0)]

.
----------------------------------------------------------------------
Ran 4 tests in 3.011s

OK
python -c "import torch; print(torch.__version__)" 
0.3.1b0+94ba828

@SeanNaren
Copy link
Owner

Hmm I wonder if it was just my install, I'll retry again! Sorry about this!

@r9y9
Copy link
Contributor Author

r9y9 commented Mar 2, 2018

Do you find any problem? or can we just merge #17?

@SeanNaren
Copy link
Owner

SeanNaren commented Mar 5, 2018

On a fresh install of anaconda, running the build commands:

cd warp-ctc
mkdir build
cd build
cmake ..
make

The installing the bindings:

cd pytorch_binding
CUDA_HOME=/usr/local/cuda python setup.py install

Run into this notorious issue when running the tests:

python test.py
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    from warpctc_pytorch import CTCLoss
  File "/home/sean.narenthiran/anaconda3/lib/python3.6/site-packages/warpctc_pytorch-0.1-py3.6-linux-x86_64.egg/warpctc_pytorch/__init__.py", line 7, in <module>
    from ._warp_ctc import lib as _lib, ffi as _ffi
ImportError: cannot import name 'lib'

You sure you don't run into this issue as well?

r9y9 added a commit to r9y9/warp-ctc that referenced this pull request Mar 8, 2018
@r9y9
Copy link
Contributor Author

r9y9 commented Mar 8, 2018

I can reproduce on pyhon2.7. Fix comming.

@r9y9
Copy link
Contributor Author

r9y9 commented Mar 8, 2018

@SeanNaren I think I fixed the problem. Could you try if it works?

@bstriner
Copy link
Contributor

I think this pull breaks things, at least for me on python 3. The correct code on my machine ends up as:

from ._warp_ctc.__warp_ctc import lib as _lib, ffi as _ffi

Not sure what is causing the extra level there.

@r9y9
Copy link
Contributor Author

r9y9 commented Mar 17, 2018

@bstriner I am wondering if you had old generated code as well? Could you try it again after rm -rf warpctc_pytorch && git checkout . and python setup.py install?

@SeanNaren
Copy link
Owner

what @r9y9 just suggested is what gave me weird install issues as well. Make sure to uninstall/remove the site package from the conda environment, and re-clone the repo.

@bstriner
Copy link
Contributor

Actually, this was a Dockerfile, so no previous anything. Fresh git clone, install, etc.

Current version is here (using a fork of the repo). If you switch the url back to the master repo it should reproduce the issue.

https://github.com/cmudeeplearning11785/machine_learning_gpu/blob/master/Dockerfile

On that note, @SeanNaren any thoughts on setting up Travis or something similar?

@bstriner
Copy link
Contributor

I tried a few different ways to install but all got the same result (you can see some in the comments in the Dockerfile).

@bstriner
Copy link
Contributor

If you enable travis I can start putting a config file together.

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

Successfully merging this pull request may close these issues.

3 participants