IBM/pytorchpipe

View on GitHub
configs/default/components/models/general_usage/recurrent_neural_network.yml

Summary

Maintainability
Test Coverage
# This file defines the default values for the RNN model.

####################################################################
# 1. CONFIGURATION PARAMETERS that will be LOADED by the component.
####################################################################

# Size of the hidden state (LOADED)
hidden_size: 100

# Flag informing the model to learn the intial state (h0/c0) (LOADED)
# When false, (c0/c0) will be initialized as zeros.

# Input mode (LOADED)
# Options:
#   * Dense (every iteration expects an input)
#   * Autoregression_First (Autoregression, expects an input for the first iteration)
#   * Autoregression_None (Autoregression, first input will be a null vector)
input_mode: Dense

# Prediction mode (LOADED)
# Options:
#   * Dense (passes every activation through output layer) |
#   * Last (passes only the last activation through output layer) |
#   * None (all outputs are discarded)
prediction_mode: Dense

# Maximal length of generated output sequence when working in auto-regression mode (LOADED)
# User must set it per task, as it is task specific.
# max_autoregression_length: x

# Initial state type (LOADED)
#   * Zero (Vector of zeros, not trainable)
#   * Trainable (xavier initialization, trainable)
#   * Input (the initial hidden state comes from an input stream)
initial_state: Trainable

# Type of recurrent cell (LOADED)
# Options: LSTM | GRU | RNN_TANH | RNN_RELU
cell_type: LSTM

# Number of "stacked" layers (LOADED)
num_layers: 1

# Dropout rate (LOADED)
# Default: 0 (means that it is turned off)
dropout_rate: 0

# Enable FFN layer at the output of the RNN (LOADED)
# Useful if the raw outputs of the RNN are needed, for attention encoder-decoder for example.
use_output_layer: True

# Wether to include the last hidden state in the outputs
output_last_state: False

# If true, output of the last layer will be additionally processed with Log Softmax (LOADED)
use_logsoftmax: True

streams:
  ####################################################################
  # 2. Keymappings associated with INPUT and OUTPUT streams.
  ####################################################################

  # Stream containing batch of images (INPUT)
  inputs: inputs

  # Stream containing the inital state of the RNN (INPUT)
  # The stream will be actually created only if `inital_state: Input`
  input_state: input_state

  # Stream containing predictions (OUTPUT)
  predictions: predictions

  # Stream containing the final output state of the RNN (output)
  # The stream will be actually created only if `output_last_state: True`
  output_state: output_state

globals:
  ####################################################################
  # 3. Keymappings of variables that will be RETRIEVED from GLOBALS.
  ####################################################################

  # Size of the input (RETRIEVED)
  input_size: input_size

  # Size of the prediction (RETRIEVED)
  prediction_size: prediction_size

  ####################################################################
  # 4. Keymappings associated with GLOBAL variables that will be SET.
  ####################################################################

  ####################################################################
  # 5. Keymappings associated with statistics that will be ADDED.
  ####################################################################