Keras¶
The Snowflake ML Model Registry supports Keras 3 models (keras.Model with Keras version >= 3.0.0).
Keras 3 is a multi-backend framework that supports TensorFlow, PyTorch, and JAX as backends.
Note
For Keras version < 3.0.0, use the TensorFlow handler.
The following additional options can be used in the options dictionary when you call log_model:
Option |
Description |
|---|---|
|
A list of the names of the methods available on the model object. Keras models have |
|
The version of the CUDA runtime to be used when deploying to a platform with GPU; defaults to 11.8. If manually set
to |
You must specify either the sample_input_data or signatures parameter when logging a Keras model so
that the registry knows the signatures of the target methods.
Note
Keras models can only have one target method.
Examples¶
These examples assume reg is an instance of snowflake.ml.registry.Registry.
Sequential Model¶
The following example demonstrates training a Keras 3 sequential model, logging it to the Snowflake ML Model Registry, and running inference.
Functional API Model¶
The following example demonstrates creating a model using the Keras Functional API.
Custom Subclass Model¶
The following example demonstrates creating a custom model by subclassing keras.Model.