KerasNLP Nightly
raw JSON → 0.30.0.dev202605080526 verified Sat May 09 auth: no python
Nightly build of KerasNLP, providing pretrained NLP models and tokenizers for Keras 3. Current version 0.30.0.dev202605080526. Released daily with latest changes from keras-team/keras/keras_hub.
pip install keras-nlp-nightly Common errors
error ModuleNotFoundError: No module named 'keras_nlp' ↓
cause Missing installation or wrong package name.
fix
pip install keras-nlp-nightly
error AttributeError: module 'keras_nlp' has no attribute 'BertClassifier' ↓
cause Importing from top-level package instead of subpackage.
fix
from keras_nlp.models import BertClassifier
error ValueError: Unknown preset: 'bert_base_uncased' ↓
cause Preset may have been removed or renamed in nightly.
fix
List presets: keras_nlp.presets.list() or check docs.
Warnings
breaking KerasNLP has been merged into Keras 3 (keras-core) since Keras 3.0. Nightly builds may break without notice. ↓
fix Use from keras_nlp import ... as shown in quickstart. For production, use stable KerasNLP (pip install keras-nlp).
deprecated Some presets and symbols may be removed or renamed in nightly builds before stable release. ↓
fix Check changelog at https://github.com/keras-team/keras/keras_hub
gotcha Mixing keras-nlp-nightly with stable keras may cause version conflicts due to incompatible keras dependencies. ↓
fix Use consistent versions: either both stable or both nightly. Prefer using within a virtualenv.
Imports
- BertClassifier wrong
from keras_nlp import BertClassifiercorrectfrom keras_nlp.models import BertClassifier - Tokenizer wrong
import Tokenizer from keras_nlpcorrectfrom keras_nlp.tokenizers import Tokenizer
Quickstart
import os
os.environ['KERAS_BACKEND'] = 'jax'
import keras_nlp
from keras_nlp.models import BertClassifier
# Load a pretrained classifier
classifier = BertClassifier.from_preset("bert_tiny_en_uncased")
print(classifier.summary())