crested.utils.load_model#
- crested.utils.load_model(model_path, compile=False, custom_objects=None, **kwargs)#
Load in a .keras model.
Wrapper around
keras.saving.load_model()with compile=False by default, as it is generally unnecessary in CREsted. When running into possible layer serialization issues,load_modelalso tries again with all custom CREsted model layers and functions from {mod}`crested.tl.zoo.utils`.- Parameters:
model_path (
str|PathLike) – Path to a .keras saved model file.compile (
bool(default:False)) – Whether to compile the model after loading, including the loss, optimizer and metrics from training. Default is False, since this is not needed for prediction or evaluation, and can lead to problems with loading and/or unexpected behavior like ignoring newly supplied loss functions.custom_objects (
dict|None(default:None)) – Optional dictionary mapping names (strings) to custom classes or functions to be considered during deserialization.kwargs – Arguments passed to :func`keras.saving.load_model`.
- Returns:
A
keras.Model()object.
See also