Guides
Saving and loading
Persist trained weights with export and load.
python
model.export("model.mlk")
fresh = Network(2)
fresh.add_dense(8, Activations.ReLU)
fresh.add_dense(1, Activations.Sigmoid)
ok = fresh.load("model.mlk") # TrueFile format
A .mlk file is a raw stream of 32-bit floats: for every neuron, its bias, then its weights, layer by layer. There is no header.
Because there is no header,
load cannot check that the architecture matches. Build the network with the same layers, in the same order, before loading.Train once, reuse
A common pattern is to train only when no saved model exists:
python
if not model.load("model.mlk"):
model.fit(x, y, lr=0.1, epochs=100, batch=16)
model.export("model.mlk")