See our collection for all Gemma 3 sizes and variants.

Run Gemma 3 with Keras 3: JAX, PyTorch, or TensorFlow

GitHub Docs HuggingFace

kerasformers/gemma-3-27b-it

Pure-Keras 3 conversion of google/gemma-3-27b-it for kerasformers. One implementation runs unmodified on TensorFlow / Torch / JAX. This is the instruction-tuned checkpoint, served here as image + text -> text via Gemma3ConditionalGenerate; weights are stored in bfloat16.

For model details, license, and usage terms, see Google's model card.

✨ Quick start

Text-only

import os
os.environ["KERAS_BACKEND"] = "torch"  # or "jax" / "tensorflow"

from kerasformers.models.gemma3 import Gemma3TextGenerate, Gemma3Tokenizer

model = Gemma3TextGenerate.from_weights("kerasformers/gemma-3-27b-it")
tokenizer = Gemma3Tokenizer.from_weights("kerasformers/gemma-3-27b-it")

inputs = tokenizer([{"role": "user", "content": "Hello, who are you?"}])
outputs = model.generate(**inputs, max_new_tokens=64)
print(tokenizer.decode(outputs[0]))

Image + text

from kerasformers.models.gemma3 import Gemma3ConditionalGenerate, Gemma3Processor

model = Gemma3ConditionalGenerate.from_weights("kerasformers/gemma-3-27b-it")
processor = Gemma3Processor.from_weights("kerasformers/gemma-3-27b-it")

conversation = [
    {"role": "user", "content": [
        {"type": "image", "url": "https://.../image.jpg"},
        {"type": "text", "text": "Describe this image."},
    ]},
]
inputs = processor(conversation)
outputs = model.generate(**inputs, max_new_tokens=64)
print(processor.decode(outputs[0]))

Load any Gemma 3 variant the same way with from_weights("kerasformers/<variant>"):

Tips

  • Set KERAS_BACKEND before importing Keras / kerasformers.
  • Loads in bfloat16 by default. Pass load_dtype="float32" for full precision, or quantization="int8" to shrink further.
  • See the Gemma 3 docs.
  • Community / upstream weights still work via the hf: prefix: Gemma3ConditionalGenerate.from_weights("hf:google/gemma-3-27b-it").

Special Thanks

A huge thank you to the Google Gemma authors for creating and releasing these models.

License: Gemma (gated). Accept the license on the upstream Hub card before downloading.

Downloads last month
49
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for kerasformers/gemma-3-27b-it

Finetuned
(446)
this model

Collection including kerasformers/gemma-3-27b-it