Open Lelo123 opened 6 years ago
The versions that you need for your machine differ, depending on OS and GPU. I did the following, the last time I installed all dependencies for my repositories using Ubuntu 16.04:
Download CUDA:
Install CUDA:
sudo dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
Add to path:
export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Download cuDNN (you need to be registered):
http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html
Installing from a Tar File:
Navigate to your
$ tar -xzvf cudnn-9.0-linux-x64-v7.tgz
Copy the following files into the CUDA Toolkit directory.
$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
Prerequisites:
sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install numpy
sudo pip install scipy
sudo apt-get install libblas-dev liblapack-dev
sudo apt-get install cmake
sudo pip install cython
Install gpuarray:
http://deeplearning.net/software/libgpuarray/installation.html
git clone https://github.com/Theano/libgpuarray.git
cd libgpuarray
mkdir Build
cd Build
cmake .. -DCMAKE_BUILD_TYPE=Release # or Debug if you are investigating a crash
make
make install
cd ..
python setup.py build
sudo python setup.py install
python setup.py build_ext -L $MY_PREFIX/lib -I $MY_PREFIX/include
sudo ldconfig
Install Theano:
git clone git://github.com/Theano/Theano.git
cd Theano
sudo pip install -e .
Adjust .theanorc content:
[global]
device=cuda
floatX=float32
optimizer_excluding=low_memory
[mode]=FAST_RUN
[dnn.conv]
algo_bwd_filter=deterministic
algo_bwd_data=deterministic
[gpuarray]
preallocate=0
Last but not least, install Lasagne
sudo pip install -r https://raw.githubusercontent.com/Lasagne/Lasagne/master/requirements.txt
sudo pip install https://github.com/Lasagne/Lasagne/archive/master.zip
You should be able to install all other Python packages needed for the repository without any trouble.
I hope this helps.
Thank you very much! I'll give it a try.
Did you tested your Neural Network on Ubuntu 16.04 and did it worked @kahst?
Yes and no. I'm still using some of the code in my current projects which all run on Ubuntu 16.04. However, you might not be able to use the trained model provided via download - some changes in Theano and Lasagne might prevent that from working. Otherwise, it should run properly - give me a hint if you run into any trouble.
(AcousticEvent) bfe2brg@PT-IW002:~/AcousticEventDetection$ python2 AED_test.py --filenames 'dataset/schreien_scream.wav' --modelname 'AED_Example_Run_model.pkl' --overlap 4 --results 5 --confidence 0.01
HANDLING IMPORTS...
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
...DONE!
IMPORTING MODEL...
Traceback (most recent call last):
File "AED_test.py", line 156, in
Can you help pls?
It seems to me that you are trying to run the model in CPU mode. You need to get gpuarray running before you can load a pickled model. As I mentioned above, even if you have gpuarray installed, you might not be able run the script with the pre-trained model due to changes in Theano and Lasagne. Still, your error messages implies that you are missing gpuarray.
(NAME) bfe2brg@PT-IW002:~/AcousticEventDetection$ python2 AED_test.py --filenames 'dataset/schreien_scream.wav' --modelname 'AED_Example_Run_model.pkl' --overlap 4 --results 5 --confidence 0.01
HANDLING IMPORTS...
...DONE!
IMPORTING MODEL...
Traceback (most recent call last):
File "AED_test.py", line 156, in
I've been able to solve that problem before...The problem is more directed for here now
This looks like gpuarray can't access your GPU which might have something to do with drivers&CUDA.
@kahst Could you add the specific version requirements of the following libraries:
Currently git clone git://github.com/Theano/Theano.git
will install Theano 1.0.1, but later on sudo pip install -r https://raw.githubusercontent.com/Lasagne/Lasagne/master/requirements.txt
will install Theano 0.8.2.
Libgpuarray seems to work better with current versions of Theano (~1.0) while Lasagne seems to expect an older one (~0.8.2).
The installation hints you added above unfortunately do not result in a working environment, presumably due to these conflicting Theano requirements.
Currently Lasagne complains about Theano being too new ("missing downsample") and libgpuarray complains about Theano being too old ("major api mismatch between theano and pygpu").
@carstenschwede you are right, installing Theano from git results in version 1.0.1. Using pip show pygpu
tells me I'm using version 0.7.5 and pip show lasagne
says version 0.2.dev1.
The change of the requirements.txt in the Lasagne repo is 4 month old, older than the install I'm using. I guess this was already the case when I wrote the instructions and should work.
I'm sorry that I'm not of much help here, but maybe this is an issue for Lasagne, Jan usually responses very quickly.
@kahst Thanks for the fast reply. Which Theano version are you using? These are my results:
Theano@1.0.1
, Lasagne@0.2.dev1
and pygpu@0.7.5
results in the following error at lasagne/layers/conv.py
:
AttributeError: 'Conv2DLayer' object has no attribute 'num_groups'
Theano@0.8.2
, Lasagne@0.2.dev1
and pygpu@0.7.5
results in the following error at gpuarray/__init__.py
:
Runtimerror: ('Wrong major API version for gpuarray:', 2, 'Make sure Theano and libgpuarray/pygpu are in sync.')
Ah, now I know what's going on: The newest version of Lasagne supports grouped convolutions. In that version, all Conv2DLayers have an additional argument named "num_groups". Unfortunately, the snapshot model provided as download contains pickled Conv2DLayer that are outdated.
The test script won't run because of that, you need to train your own net and save that snapshot, before you can actually test on unseen audio files. I'm sorry - for now, that seems to be the only solution.
Good afternoon.
Can you specify the different dependencies that you used for this code? The CUDA version, CuDNN, python libraries, theano, etc?
I'm having a lot of problems using your code.
Thanks.