Model Persistence
Saving and loading neural networks — ModelSerializer, saving normalizers, and model format details
Saving Models
MultiLayerNetwork
import org.deeplearning4j.util.ModelSerializer;
File modelFile = new File("/tmp/my-model.zip");
// Save with updater state (recommended if you plan to continue training)
ModelSerializer.writeModel(model, modelFile, true);
// Save without updater state (smaller file, inference-only)
ModelSerializer.writeModel(model, modelFile, false);ComputationGraph
ComputationGraph graph = /* trained graph */;
ModelSerializer.writeModel(graph, new File("/tmp/my-graph.zip"), true);Saving to an OutputStream
Saving with a Normalizer
Loading Models
MultiLayerNetwork
ComputationGraph
Restoring a Normalizer
The .zip File Format
Entry name
Contents
Saving for Inference Only
RNG Seed After Restore
Appending a Normalizer to an Existing File
API Reference
Method
Description
Last updated
Was this helpful?