Downloads · 30 days
15
7% of all-time downloads
zeromodels/gemma-2-2b
gemma-2-2b is a text generation model from zeromodels. Use it when you need the model to write or continue text. It is set up for zeromodels. The card lists the license as gemma.
See our collection for all Gemma 2 sizes and variants.
Downloads · 30 days
15
7% of all-time downloads
All-time downloads
203
Public
Repo size
5.2 GB
Likes
0
Public
Click a slice to open those files.
.h55.2 GB · 100%
From the Hugging Face model README
See our collection for all Gemma 2 sizes and variants.
Pure-Keras 3 conversion of google/gemma-2-2b for
zeromodels. One implementation runs unmodified on
TensorFlow / Torch / JAX. This is a base (pretrained) checkpoint, served here as text -> text via Gemma2TextGenerate; weights are
stored in bfloat16.
For model details, license, and usage terms, see Google's model card.
import os
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
from zeromodels.models.gemma2 import Gemma2TextGenerate, Gemma2Tokenizer
model = Gemma2TextGenerate.from_weights("zeromodels/gemma-2-2b")
tokenizer = Gemma2Tokenizer.from_weights("zeromodels/gemma-2-2b")
inputs = tokenizer([{"role": "user", "content": "Hello, who are you?"}])
outputs = model.generate(**inputs, max_new_tokens=64)
print(tokenizer.decode(outputs[0]))
Load any Gemma 2 variant the same way with from_weights("zeromodels/<variant>"):
| Variant | Hub |
|---|---|
gemma-2-27b | zeromodels/gemma-2-27b |
gemma-2-27b-it | zeromodels/gemma-2-27b-it |
gemma-2-2b | zeromodels/gemma-2-2b |
gemma-2-2b-it | zeromodels/gemma-2-2b-it |
gemma-2-9b | zeromodels/gemma-2-9b |
gemma-2-9b-it | zeromodels/gemma-2-9b-it |
KERAS_BACKEND before importing Keras / zeromodels.load_dtype="float32" for full precision,
or quantization="int8" to shrink further.hf: prefix:
Gemma2TextGenerate.from_weights("hf:google/gemma-2-2b").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.