Save/Load model weights using HDF5 files
save_model_weights_hdf5(object, filepath, overwrite = TRUE) load_model_weights_hdf5(object, filepath, by_name = FALSE)
Model object to save/load
Path to the file
Whether to silently overwrite any existing file at the target location
Whether to load weights by name or by topological order.
The weight file has:
layer_names (attribute), a list of strings (ordered names of model layers).
For every layer, a
For every such layer group, a group attribute
weight_names, a list of strings
(ordered names of weights tensor of the layer).
For every weight in the layer, a dataset storing the weight value, named after the weight tensor.
FALSE (default) weights are
loaded based on the network's topology, meaning the architecture should be
the same as when the weights were saved. Note that layers that don't have
weights are not taken into account in the topological ordering, so adding
or removing layers is fine as long as they don't have weights.
TRUE, weights are loaded into layers only if they share
the same name. This is useful for fine-tuning or transfer-learning models
where some of the layers have changed.