KerasHub
KerasHub is a pretrained modeling library that aims to be simple, flexible, and fast. The library provides Keras 3 implementations of popular model architectures, paired with a collection of pretrained checkpoints available on Kaggle Models. Models can be used for both training and inference, on any of the TensorFlow, Jax, and Torch backends.
KerasHub is an extension of the core Keras API; KerasHub components are provided as keras.layers.Layer
and keras.Model
implementations. If you are familiar with Keras, congratulations! You already understand most of KerasHub.
Quick links
Installation
To install the latest KerasHub release with Keras 3, simply run:
To install the latest nightly changes for both KerasHub and Keras, you can use our nightly package.
Currently, installing KerasHub will always pull in TensorFlow for use of the tf.data
API for preprocessing. When pre-processing with tf.data
, training can still happen on any backend.
Visit the core Keras getting started page for more information on installing Keras 3, accelerator support, and compatibility with different frameworks.
Quickstart
Choose a backend:
Import KerasHub and other libraries:
Load a resnet model and use it to predict a label for an image:
Load a Bert model and fine-tune it on IMDb movie reviews:
Compatibility
We follow Semantic Versioning, and plan to provide backwards compatibility guarantees both for code and saved models built with our components. While we continue with pre-release 0.y.z
development, we may break compatibility at any time and APIs should not be consider stable.
Disclaimer
KerasHub provides access to pre-trained models via the keras_hub.models
API. These pre-trained models are provided on an "as is" basis, without warranties or conditions of any kind.
Citing KerasHub
If KerasHub helps your research, we appreciate your citations. Here is the BibTeX entry: