Welcome to keras_gtar’s documentation!

keras_gtar is an in-development library for saving and restoring keras models inside libgetar files. By using a trajectory-based format, we can save multiple versions of a model’s weights.

Installation

Install keras_gtar from source on github:

pip install git+https://github.com/klarh/keras_gtar.git#egg=keras_gtar

API Documentation

class keras_gtar.Trajectory(filename, mode='r')[source]

Interface to save and load models from a GTAR trajectory

Parameters:
  • filename – File to save or load from
  • mode – File open mode: ‘r’ (read-only), ‘w’ (overwrite), or ‘a’ (append)
get_weights(frame=-1)[source]

Returns a list of weight arrays for a model stored at the given frame index

Parameters:frame – integer index of the step to load. Can be negative to count from the end.
load(frame=-1)[source]

Loads a model stored at the given frame index

Parameters:frame – integer index of the step to load. Can be negative to count from the end.
save(model, frame=None, only_weights=False)[source]

Save a model description and/or current state

Parameters:
  • frame – Frame index (string) to save as. If not given, do not save weights.
  • only_weights – If True, only save the current model weights, not the model architecture.
save_model(model)[source]

Save (only) the current model architecture.

Parameters:model – Keras Model object to save
save_weights(model, frame)[source]

Save (only) the current model weights.

Parameters:
  • model – Keras Model object containing weights to save
  • frame – Frame index (string) to save as
keras_gtar.GTARLogger

Indices and tables