Keras¶
Keras is a minimalist, highly modular neural networks library, written in Python and capable of running on top of either TensorFlow or Theano.
Policy¶
Keras is available to all users at HPC2N.
Citations
Please cite Keras in your publications if it helps your research. Here is an example BibTeX entry:
@misc{chollet2015keras, title={Keras}, author={Chollet, Fran\c{c}ois and others}, year={2015}, howpublished={\url{https://keras.io}}, }
Overview¶
Keras was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research.
Use Keras if you need a deep learning library that:
- Allows for easy and fast prototyping (through user friendliness, modularity, and extensibility).
- Supports both convolutional networks and recurrent networks, as well as combinations of the two.
- Runs seamlessly on CPU and GPU.
Usage at HPC2N¶
On HPC2N we have Keras available as a module.
Important!
From Python 3.11.3, Keras at HPC2N is part of the TensorFlow module!
Loading¶
To use the Keras module, add it to your environment. You can find versions with
and you can then find how to load a specific version (including prerequisites), with
Keras with GPUs
Keras is built both with and without GPU enabling. When you load the module, load the prerequisite line that includes CUDA to get the GPU enabled version.
Example, doing ml spider Keras/2.4.3
gives this output:
----------------------------------------------------------------------------
Keras: Keras/2.4.3
----------------------------------------------------------------------------
Description:
Keras is a deep learning API written in Python, running on top of the
machine learning platform TensorFlow.
You will need to load all module(s) on any one of the lines below before the "Keras/2.4.3" module is available to load.
GCC/10.2.0 CUDA/11.1.1 OpenMPI/4.0.5
GCC/10.2.0 OpenMPI/4.0.5
This extension is provided by the following modules. To access the extension you must load one of the following modules. Note that any module names in parentheses show the module location in the software hierarchy.
Keras/2.4.3 (GCC/10.2.0 OpenMPI/4.0.5)
Keras/2.4.3 (GCC/10.2.0 CUDA/11.1.1 OpenMPI/4.0.5)
To load the GPU enabled one, do
Running¶
Note
If you are running as a batch job, you need to do
since the Keras module is built with MPI.
The newer versions of Keras should be built with Tensorflow as backend. To check, load the Keras module and prerequisites, then start python
and run these commands:
To otherwise change the backend from theano to tensorflow, do
Additional info¶
More information can be found on