GO

google/gemma-2-9b-it

text-generationtransformersgemma9.2B params · updated Aug 2024

Usage

usage.pytemplate from repo id
from osai import AutoModelForCausalLM, AutoTokenizer

repo = "google/gemma-2-9b-it"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(
    repo, dtype="bfloat16", device_map="auto",
)

msgs = [{"role": "user", "content": "Explain speculative decoding."}]
ids = tok.apply_chat_template(msgs, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(ids, max_new_tokens=256)[0]))

Hardware

Computed from 9.24B parameters × bytes per parameter, plus 20% for activations and KV cache. Not measured.

PrecisionWeightsEstimated VRAMFits on
bf1617.2 GB21 GBL4 24 GB
int88.6 GB11 GBCPU or T4 16 GB
nf44.3 GB5.2 GBCPU or T4 16 GB