TF-Keras Nightly
raw JSON → 2.21.0.dev2026032809 verified Tue May 12 auth: no python install: stale
TF-Keras is a deep learning API written in Python, running on top of the machine learning platform TensorFlow. It was developed with a focus on enabling fast experimentation and providing a delightful developer experience. As a nightly build, it offers the very latest features and bug fixes, with daily releases. The current version is 2.21.0.dev2026032809.
pip install tf-keras-nightly Warnings
breaking Keras optimizers were moved to `tf.keras.optimizers.legacy` starting with TensorFlow 2.12. Directly instantiating `keras.optimizers.Adam()` (or other optimizers) will use the new Keras 3 optimizers, which handle state differently and may break checkpoint loading from models trained with older optimizers. ↓
fix If encountering checkpoint loading issues or needing to use the old optimizer behavior, explicitly use the legacy optimizers: `tf.keras.optimizers.legacy.Adam()`.
breaking The default Keras model saving format for `model.save()` is now the `.keras` format (Keras V3 format), not the legacy H5 format, when using `model.save('my_model.keras')`. This change was introduced with TensorFlow 2.13 and Keras 2.13. ↓
fix To save in the legacy H5 format, explicitly specify `save_format="h5"`: `model.save('my_model.h5', save_format="h5")`.
gotcha `tf-keras-nightly` is a nightly build, meaning it's built from the latest development branch and is not guaranteed to be stable or backward compatible between daily releases. ↓
fix Use `tf-keras-nightly` for access to the newest features and bug fixes, but be prepared for potential instability or API changes without notice. For production environments, prefer stable releases of `tensorflow`.
gotcha Requires Python >=3.10. Installing with older Python versions will result in an installation error. ↓
fix Ensure your Python environment is version 3.10 or newer before installing `tf-keras-nightly`.
breaking `tensorflow` module not found. This typically means the the `tensorflow` package has not been installed in the current Python environment. ↓
fix Ensure `tensorflow` is installed by running `pip install tensorflow` in your environment.
Install compatibility stale last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) timeout - - - -
3.10 alpine (musl) - - - -
3.10 slim (glibc) timeout - - - -
3.10 slim (glibc) - - - -
3.11 alpine (musl) wheel - - 37.6M
3.11 alpine (musl) - - - -
3.11 slim (glibc) timeout - - - -
3.11 slim (glibc) - - - -
3.12 alpine (musl) wheel - - 29.0M
3.12 alpine (musl) - - - -
3.12 slim (glibc) timeout - - - -
3.12 slim (glibc) - - - -
3.13 alpine (musl) wheel - - 28.6M
3.13 alpine (musl) - - - -
3.13 slim (glibc) timeout - - - -
3.13 slim (glibc) - - 9.81s 2.2G
3.9 alpine (musl) timeout - - - -
3.9 alpine (musl) - - - -
3.9 slim (glibc) timeout - - - -
3.9 slim (glibc) - - 7.55s 2.1G
Imports
- keras
from tensorflow import keras - keras wrong
import kerascorrectimport tensorflow.keras as keras
Quickstart last tested: 2026-04-24
import tensorflow as tf
import os
# Ensure Keras backend is set to TensorFlow if running multi-backend Keras 3
# (though tf-keras-nightly implies TensorFlow backend by nature)
# os.environ["KERAS_BACKEND"] = "tensorflow"
# Import Keras from TensorFlow's namespace
from tensorflow import keras
from keras import layers
# Define a simple sequential model
model = keras.Sequential([
layers.Dense(64, activation='relu', input_shape=(784,)),
layers.Dense(64, activation='relu'),
layers.Dense(10, activation='softmax')
])
# Compile the model
model.compile(
optimizer=keras.optimizers.Adam(learning_rate=0.001),
loss=keras.losses.SparseCategoricalCrossentropy(),
metrics=[keras.metrics.SparseCategoricalAccuracy()]
)
# Generate dummy data
import numpy as np
x_train = np.random.rand(100, 784).astype('float32')
y_train = np.random.randint(0, 10, 100).astype('int32')
# Train the model
print("Starting model training...")
model.fit(x_train, y_train, epochs=1, batch_size=32)
print("Model training finished.")
# Save the model (using the recommended .keras format)
model.save('my_model.keras')
print("Model saved as my_model.keras")
# Load the model
loaded_model = keras.models.load_model('my_model.keras')
print("Model loaded successfully.")