Keras 3 is a multi-backend deep learning framework that supports JAX, TensorFlow, PyTorch, and OpenVINO (for inference-only). The `keras-nightly` package provides daily development builds of Keras, offering access to the latest features and bug fixes. It focuses on accelerated model development and state-of-the-art performance by leveraging backend-specific optimizations.
pip install keras-nightlyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set a Keras backend, load data, build a sequential convolutional neural network, compile it, and train it using Keras 3. Ensure a backend (e.g., TensorFlow) is installed and the `KERAS_BACKEND` environment variable is set before importing `keras`.
Upgrade your Python environment to 3.11 or newer.
Update all `from tensorflow.keras import ...` statements to `from keras import ...` and `tf.keras.` prefixes to `keras.`.
For saving, use the native Keras format (`.keras` extension) with `model.save()`. For SavedModel export, use `model.export(filepath)`. For loading existing TensorFlow SavedModels for inference in Keras 3, use `keras.layers.TFSMLayer(saved_model_path, call_endpoint='serving_default')`.
For stable production applications, use the `keras` package (stable release) instead of `keras-nightly`.
Set the `KERAS_BACKEND` environment variable (e.g., `os.environ["KERAS_BACKEND"] = "tensorflow"`) or edit the `~/.keras/keras.json` config file before importing `keras`.
If you encounter XLA errors with custom components, set `jit_compile=False` in your `Model` constructor: `model = keras.Model(..., jit_compile=False)`.