Skip to main content

Course software for introductory deep learning

The practicals can be done in three ways:

  • Laptop: 
  • JupyterLab:
  • Curnagl:

Laptop

Python installation

Here are some instructions for installing Keras with TensorFlow at the backend (for Python3), and other libaries, on your laptop. All the required libraries are listed here:

https://c4science.ch/source/DL_INTRO/browse/master/requirements.txt

You may copy/paste this list of libraries in a text editor and name the file "requirements.txt" or use Git:

$ git clone https://c4science.ch/source/DL_INTRO.git

Then you may use a Python IDE (e.g. Jupyter Notebook or PyCharm) or a terminal to install the libraries (see below).

Use a Python IDE (e.g. Jupyter Notebook or PyCharm)

Launch a Python IDE.

HOW DO WE CREATE A VIRTUAL ENVIRONMENT WITHOUT A TERMINAL ?

$ python -m venv mlcourse

$ source mlcourse/bin/activate

$ pip install -r DL_INTRO/requirements.txt

To check that Tensorflow was installed:

$ python -c 'import tensorflow; print(tensorflow.version.VERSION)'

There might be a warning message (see above) and the output should be something like "2.8.0".

You can terminate the current session:

$ deactivate

$ exit

Use your terminal

Open  your terminal.

$ python -m venv mlcourse

$ source mlcourse/bin/activate

$ pip install -r DL_INTRO/requirements.txt

To check that Tensorflow was installed:

$ python -c 'import tensorflow; print(tensorflow.version.VERSION)'

There might be a warning message (see above) and the output should be something like "2.8.0".

You can terminate the current session:

$ deactivate

$ exit

R installation

Here are some instructions for installing Keras with TensorFlow at the backend, and other libaries, on your laptop. The R keras is actually an interface to the Python Keras. In simple terms, this means that the keras R package allows you to enjoy the benefit of R programming while having access to the capabilities of the Python Keras package.

IMPORTANT: Since Keras is using Python in the background, you need some development tools in your computer. For example, if you have a Mac you need to install Xcode. For Windows users, you need to install Rtools (and possibly also Anaconda).

Run R in your terminal or launch RStudio.

REMARK: The R libraries will be installed in your home directory. To allow it, you must answer yes to the questions:

Would you like to use a personal library instead? (yes/No/cancel) yes

Would you like to create a personal library to install packages into? (yes/No/cancel) yes

And select Switzerland for the CRAN mirror.

> install.packages("keras")

> library(keras)

> library(tensorflow)

> install_tensorflow(method="virtualenv", envname="r-tensorflow", version="2.5.0")

> install.packages("ggplot2")

> install.packages("ggfortify")

To check that Keras was properly installed:

> is_keras_available(version = NULL)

There might be a warning message (see above) and the output should be something like "TRUE".

You can terminate the current R session:

> q()

Save workspace image? [y/n/c]: n

JupyterLab

Python installation

Here are some instructions for installing Keras with TensorFlow at the backend (for Python3), and other libaries, on the JupyterLab of the EPFL. All the required libraries are listed here:

https://c4science.ch/source/DL_INTRO/browse/master/requirements.txt

You may copy/paste this list of libraries in a text editor and name the file "requirements.txt" or use Git:

$ git clone https://c4science.ch/source/DL_INTRO.git

Go to the webpage: https://noto.epfl.ch/

Use your Switch AAI login: University of Lausanne

Enter you login and password associated to your Switch edu-ID (and NOT your UNIL credentials).

Click on Python in the Notebook panel.




Open a terminalClick on yourthe laptop"Upload Files" (the upward arrow) and type (if you are located outsideselect the UNILfile you"requirements.txt" willfrom needyour to activate the UNIL VPN):laptop.

$ ssh -Y < my unil username >@curnagl.dcsr.unil.ch

Here and in what follows we added the brackets < > to emphasize the username, but you should not write them in the command. Enter your UNIL password.

For Windows users with the MobaXterm terminal: Launch MobaXterm, click on Start local terminal and type the command ssh -Y < my unil username >@curnagl.dcsr.unil.ch. Enter your UNIL password. Then you should be on Curnagl. Alternatively, launch MobaXterm, click on the session icon and then click on the SSH icon. Fill in: remote host = curnagl.dcsr.unil.ch, specify username = < my unil username >. Finally, click ok, enter your password. If you have the question "do you want to save password ?" Say No if your are not sure. Then you should be on Curnagl.

See also the documentation: https://wiki.unil.ch/ci/books/high-performance-computing-hpc/page/ssh-connection-to-dcsr-cluster

$ cd /work/TRAINING/UNIL/CTR/rfabbret/cours_hpc/

$ mkdir < my unil username >

$ cd < my unil username >

For convenience, you will install the libraries from the frontal node to do the practicals. Note however that it is normally recommended to install libraries from the interactive partition by using (Sinteractive -m 4G -c 1).

$ git clone https://c4science.ch/source/DL_INTRO.git

$ module load gcc python/3.8.8

$ python -m venv mlcourse

$ source mlcourse/bin/activate

$ !pip install -r DL_INTRO/requirements.txt

Click on "Run the selected cells and advance" (the right arrow).

To check that Tensorflow was installed:

$ python -c 'import tensorflow; print(tensorflow.version.VERSION)'

There might be a warning message (see above) and the output should be something like "2.8.0".

You can terminate the current session:

$ deactivate

$ exit

R installation

Here are some instructions for installing Keras with TensorFlow at the backend, and other libaries, on the UNIL cluster called Curnagl. The R keras is actually an interface to the Python Keras. In simple terms, this means that the keras R package allows you to enjoy the benefit of R programming while having access to the capabilities of the Python Keras package. Open a terminal on your laptop and type (if you are located outside the UNIL you will need to activate the UNIL VPN):

$ ssh -Y < my unil username >@curnagl.dcsr.unil.ch

Here and in what follows we added the brackets < > to emphasize the username, but you should not write them in the command. Enter your UNIL password.

For Windows users with the MobaXterm terminal: Launch MobaXterm, click on Start local terminal and type the command ssh -Y < my unil username >@curnagl.dcsr.unil.ch. Enter your UNIL password. Then you should be on Curnagl. Alternatively, launch MobaXterm, click on the session icon and then click on the SSH icon. Fill in: remote host = curnagl.dcsr.unil.ch, specify username = < my unil username >. Finally, click ok, enter your password. If you have the question “do you want to save password ?” Say No if your are not sure. Then you should be on Curnagl.

See also the documentation: https://wiki.unil.ch/ci/books/high-performance-computing-hpc/page/ssh-connection-to-dcsr-cluster

$ cd /work/TRAINING/UNIL/CTR/rfabbret/cours_hpc/

$ mkdir < my unil username >

$ cd < my unil username >

For convenience, you will install the libraries from the frontal node to do the practicals. Note however that it is normally recommended to install libraries from the interactive partition by using (Sinteractive -m 4G -c 1).

$ module load gcc python/3.8.8 r/4.0.5

$ R

REMARK: The R libraries will be installed in your home directory. To allow it, you must answer yes to the questions:

Would you like to use a personal library instead? (yes/No/cancel) yes

Would you like to create a personal library to install packages into? (yes/No/cancel) yes

And select Switzerland for the CRAN mirror.

> install.packages("keras")

> library(keras)

> library(tensorflow)

> install_tensorflow(method="virtualenv", envname="r-tensorflow", version="2.5.0")

> install.packages("ggplot2")

> install.packages("ggfortify")

To check that Keras was properly installed:

> is_keras_available(version = NULL)

There might be a warning message (see above) and the output should be something like "TRUE".

You can terminate the current R session:

> q()

Save workspace image? [y/n/c]: n

Curnagl

For the practicals, it will be convenient to be able to copy/paste text from a web page to the terminal on Curnagl. So please make sure you can do it before the course. You also need to make sure that your terminal has a X server.

For Mac users, download and install XQuartz (X server): https://www.xquartz.org/

For Windows users, download and install MobaXterm terminal (which includes a X server). Click on the "Installer edition" button on the following webpage: https://mobaxterm.mobatek.net/download-home-edition.html 

For Linux users, you do not need to install anything.

Python installation

Here are some instructions for installing Keras with TensorFlow at the backend (for Python3), and other libaries, on the UNIL cluster called Curnagl. Open a terminal on your laptop and type (if you are located outside the UNIL you will need to activate the UNIL VPN):

$ ssh -Y < my unil username >@curnagl.dcsr.unil.ch

Here and in what follows we added the brackets < > to emphasize the username, but you should not write them in the command. Enter your UNIL password.

For Windows users with the MobaXterm terminal: Launch MobaXterm, click on Start local terminal and type the command ssh -Y < my unil username >@curnagl.dcsr.unil.ch. Enter your UNIL password. Then you should be on Curnagl. Alternatively, launch MobaXterm, click on the session icon and then click on the SSH icon. Fill in: remote host = curnagl.dcsr.unil.ch, specify username = < my unil username >. Finally, click ok, enter your password. If you have the question "do you want to save password ?" Say No if your are not sure. Then you should be on Curnagl.

See also the documentation: https://wiki.unil.ch/ci/books/high-performance-computing-hpc/page/ssh-connection-to-dcsr-cluster

$ cd /work/TRAINING/UNIL/CTR/rfabbret/cours_hpc/

$ mkdir < my unil username >

$ cd < my unil username >

For convenience, you will install the libraries from the frontal node to do the practicals. Note however that it is normally recommended to install libraries from the interactive partition by using (Sinteractive -m 4G -c 1).

$ git clone https://c4science.ch/source/DL_INTRO.git

$ module load gcc python/3.8.8

$ python -m venv mlcourse

$ source mlcourse/bin/activate

$ pip install -r DL_INTRO/requirements.txt

To check that Tensorflow was installed:

$ python -c 'import tensorflow; print(tensorflow.version.VERSION)'

There might be a warning message (see above) and the output should be something like "2.8.0".

You can terminate the current session:

$ deactivate

$ exit

R installation

Here are some instructions for installing Keras with TensorFlow at the backend, and other libaries, on the UNIL cluster called Curnagl. The R keras is actually an interface to the Python Keras. In simple terms, this means that the keras R package allows you to enjoy the benefit of R programming while having access to the capabilities of the Python Keras package. Open a terminal on your laptop and type (if you are located outside the UNIL you will need to activate the UNIL VPN):

$ ssh -Y < my unil username >@curnagl.dcsr.unil.ch

Here and in what follows we added the brackets < > to emphasize the username, but you should not write them in the command. Enter your UNIL password.

For Windows users with the MobaXterm terminal: Launch MobaXterm, click on Start local terminal and type the command ssh -Y < my unil username >@curnagl.dcsr.unil.ch. Enter your UNIL password. Then you should be on Curnagl. Alternatively, launch MobaXterm, click on the session icon and then click on the SSH icon. Fill in: remote host = curnagl.dcsr.unil.ch, specify username = < my unil username >. Finally, click ok, enter your password. If you have the question “do you want to save password ?” Say No if your are not sure. Then you should be on Curnagl.

See also the documentation: https://wiki.unil.ch/ci/books/high-performance-computing-hpc/page/ssh-connection-to-dcsr-cluster

$ cd /work/TRAINING/UNIL/CTR/rfabbret/cours_hpc/

$ mkdir < my unil username >

$ cd < my unil username >

For convenience, you will install the libraries from the frontal node to do the practicals. Note however that it is normally recommended to install libraries from the interactive partition by using (Sinteractive -m 4G -c 1).

$ module load gcc python/3.8.8 r/4.0.5

$ R

REMARK: The R libraries will be installed in your home directory. To allow it, you must answer yes to the questions:

Would you like to use a personal library instead? (yes/No/cancel) yes

Would you like to create a personal library to install packages into? (yes/No/cancel) yes

And select Switzerland for the CRAN mirror.

> install.packages("keras")

> library(keras)

> library(tensorflow)

> install_tensorflow(method="virtualenv", envname="r-tensorflow", version="2.5.0")

> install.packages("ggplot2")

> install.packages("ggfortify")

To check that Keras was properly installed:

> is_keras_available(version = NULL)

There might be a warning message (see above) and the output should be something like "TRUE".

You can terminate the current R session:

> q()

Save workspace image? [y/n/c]: n