Skip to contents

This functions download the keras model from the TengMCing/autovi_data Github repo using download.file() and load the model.

Usage

get_keras_model(model_name, format = "npz")

Arguments

model_name

String. The model name. See also list_keras_model().

format

String. The model format to download. Either "npz", "SavedModel" or "keras".

Value

A keras model.

Details

Note that the "SavedModel" and "keras" formats are not supported in tensorflow versions above 2.15, as reticulate::import("tensorflow")$keras$models$load_model encounters issues when loading models saved with the Keras 2 API. Instead, using the "npz" format allows for rebuilding the model from scratch and loading the weights from a ".npz" file, offering a more reliable alternative.

Examples

keras_model <- try(get_keras_model("vss_phn_32"))
if (!inherits(keras_model, "try-error")) keras_model$summary()