

Pretrained transformer models in pure Keras 3, runnable on JAX, PyTorch and TensorFlow.
Loading comments…
Maker
sleepyfox
Visit Website
imvision12.github.io/KerasFormers/
Project Info
Product Keywords
KerasFormers is a library of pretrained transformer models built entirely in pure Keras 3, with weights converted from original checkpoints. It covers 118 model families—from object detection and segmentation to speech recognition and large language models—and runs the same code on JAX, PyTorch, or TensorFlow backends. No transformers or torch dependencies are needed at runtime, making it a lightweight, framework-agnostic alternative for working with modern architectures.
Every model is built with from_weights, then fed whatever its processor produces. Whether you're running a detector, a depth estimator, or an LLM, the workflow is identical—so switching between tasks costs you nothing in learning curve or code changes.
from_weights dispatches automatically: it accepts a preconverted Keras repo on the Hub, a bare variant name that converts an upstream checkpoint on the fly, or any compatible Hugging Face repo behind the hf: prefix. Architecture details like class counts are read from the repo config, so fine-tuned models work without extra setup.
Weight-only int8, int4, fp8, and mxfp4 are arguments to the same from_weights call, on any model. Large checkpoints like GPT-OSS 120B load at bfloat16 with MoE experts packed in MXFP4 and dequantized on the fly, keeping memory near 66 GB instead of ~130 GB in fp32.
Every figure and printed result on a model page comes from actually running the snippet beside it on the real image or audio clip shown. Nothing is hand-written to look plausible—what you read is exactly what you get when you run it yourself.
Other tools you might consider
"Run any model, on any backend."
That's not marketing fluff. KerasFormers delivers on it by porting 118 model families to pure Keras 3 with converted weights, then letting you switch between JAX, PyTorch, and TensorFlow with a single environment variable. The combination of breadth, backend flexibility, and honest, reproducible documentation makes it a rare find in the ML library space.
You're building with Keras and want access to modern transformers without leaving the ecosystem, or if you need one codebase that runs across multiple backends for portability. It's also a strong fit if you work with large models and want straightforward quantization options, or if you value documentation that reflects real, runnable results rather than hand-crafted examples.