Skip to content

aurora: Model Storing

Clouke edited this page May 5, 2023 · 3 revisions

Support

The ModelStoring supports saving all models with the Model implementation such as NeuralNetworkModel, LinearRegressionModel, etc.

In this example, we'll be storing a Neural Network model

The model we're using in this example:

NeuralNetworkTrainer nn = new NeuralNetworkBuilder()
  // required parameters, such as learning rate, epochs, layers, etc.
  .build();

Convert trainable to model

If the model is unnamed or already has been named, you can do the following:

Model model = nn.toModel();

Convert with a name:

Model model = nn.toModel("my_model");

Store your model

Store and apply the specified directory

model.saveDirectoryPath("my_directory") // applies the save directory path to the model
  .save();

Or specify the directory directly:

model.save("my_directory");

If the model already has a directory path, you can do the following:

model.save();