Passer au contenu principal

Deep Learning

The training phase of your deep learning model may be very time consuming. To accelerate this process you may want to use GPUs and you will need to install the deep learning packages, such as Keras or PyTorch, properly. Here is a short documentation on how to install some well knowns deep learning packages.

Keras

To install the packages in your home directory:

cd $HOME

Log into a GPU node:

Sinteractive -p interactive -m 4G -G 1

Check that the GPU is visible:

nvidia-smi

Load parallel modules and python:

module purge
module load gcc cuda cudnn python/3.8.8

Create a virtual environment. Here we will call it "venv_keras", but you may choose another name:

virtualenv -p python venv_keras

Activate the virtual environment:

source venv_keras/bin/activate

Install TensorFlow and Keras:

pip install tensorflow
pip install keras

Check that Keras was properly installed:

python -c 'import keras; print(keras.__version__)'

There might be a warning message and the output should be something like "2.5.0".

You may install extra packages that you deep learning code will use. For example:

pip install sklearn
pip install pandas
pip install matplotlib

Deactivate your virtual environment and logout from the GPU node:

deactivate
exit

Comment

If you want to make your installation more reproducible, you may proceed as follows:

1. Create a file called "requirements.txt" and write the package names inside:

tensorflow==2.4.1
keras==2.4.0
sklearn==0.24.2
pandas==1.2.4
mathplotlib==3.4.2

2. Proceed as above, but instead of installing the packages individually, type 

pip install -r requirements.txt

 

 

TensorFlow

PyTorch