keras

Version:

2.3.1

Category:

ai

Cluster:

Loki

Author / Distributor

https://github.com/keras-team/keras

Description

Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. It allows fast experimentation and supports both convolutional and recurrent networks, as well as combinations of the two.

Key features:

  • User-friendly and modular

  • Seamless integration with TensorFlow backend

  • GPU acceleration via CUDA

  • Supports multi-GPU and distributed training

  • Suited for both research and production environments

Documentation

$ python -m keras --help

usage: keras [-h] {train,test,predict} ...

Keras command-line interface is minimal by default.

Most workflows are run as Python scripts importing keras models:

    from keras.models import Sequential
    from keras.layers import Dense

    model = Sequential()
    model.add(Dense(64, activation='relu'))
    model.add(Dense(10, activation='softmax'))

    model.compile(optimizer='adam',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

    model.fit(x_train, y_train, epochs=5, batch_size=32)

Full documentation: https://keras.io/

Examples/Usage

  • Load the Keras module:

    $ module load ai/keras-py37-cuda10.2-gcc/2.3.1
    
  • Unload the module:

    $ module unload ai/keras-py37-cuda10.2-gcc/2.3.1
    
  • Use Keras in a Python script:

    import keras
    from keras.models import Sequential
    from keras.layers import Dense
    
    model = Sequential()
    model.add(Dense(128, activation='relu', input_shape=(784,)))
    model.add(Dense(10, activation='softmax'))
    
    model.compile(optimizer='adam',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])
    
    print(model.summary())
    

Installation

Source code is obtained from Keras GitHub