Text Generation
Transformers
Safetensors
gemma4_unified
image-text-to-text
gemma4
coding
agentic
terminal
tool-use
reasoning
thinking
conversational
Instructions to use yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2") model = AutoModelForMultimodalLM.from_pretrained("yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2
- SGLang
How to use yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2 with Docker Model Runner:
docker model run hf.co/yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: google/gemma-4-12B-it
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags: [gemma4, coding, agentic, terminal, tool-use, reasoning, thinking, safetensors, transformers]
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# ๐ป๐ค Gemma4-12B **v2** โ **safetensors master (full precision)** โจ
|
| 10 |
+
### Coding + Agentic Edition ยท Composer 2.5 ร Fable 5 ยท v2
|
| 11 |
+
|
| 12 |
+
> **This is the full-precision `safetensors` master** for my Gemma 4 12B **coding + agentic** fine-tune โ the same
|
| 13 |
+
> model many of you have been running as GGUF, now in its original weights. ๐ง ๐ ๏ธ v2 is the big **agentic** upgrade:
|
| 14 |
+
> it reads, reasons, *uses tools*, and works through multi-step technical tasks before it acts. This repo is for
|
| 15 |
+
> *builders* โ roll your own quants, fine-tune further, or run it in `transformers`.
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## ๐ Surprise!
|
| 20 |
+
|
| 21 |
+
A huge thank-you for all the attention this project has gotten โ really, thank you. ๐ I only managed to get out
|
| 22 |
+
**tonight** to upload the **full-precision original (safetensors master)** of this model, so sorry for the wait โ I'd
|
| 23 |
+
planned to put it up last week. But the delay comes with **two big surprises** I've been dying to share:
|
| 24 |
+
|
| 25 |
+
**1. v3 is coming soon.** ๐ฎ The next version is on its way and will fix several of the known issues you've reported.
|
| 26 |
+
|
| 27 |
+
**2. I'm now working with a top-tier AI lab to give back to the open-source community.** ๐ค Many of you have already
|
| 28 |
+
noticed the side effects in v1 and v2 โ and honestly they come down to just two things: **(1) not enough compute, and
|
| 29 |
+
(2) one person with limited expertise** behind the whole thing. This collaboration **solves both of those completely.**
|
| 30 |
+
And the **benchmarks you care about will absolutely be addressed** โ the things I simply couldn't fully pull off before
|
| 31 |
+
because of time and compute limits. The people working on this with me are **PhDs from top universities, with seriously
|
| 32 |
+
strong papers and citation records.** Just think about that for a second: the people who *actually build large models*
|
| 33 |
+
are now contributing to the open-source community *together with me* โ that is genuinely **wild**. ๐คฏ We're in active
|
| 34 |
+
discussions right now, and the project is still in the **R&D phase**, so I can't share specifics yet โ but the **moment**
|
| 35 |
+
I have news, **you'll be the first to know.** ๐
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## ๐ฏ What this repo is for
|
| 40 |
+
|
| 41 |
+
This repo holds the **un-quantized master weights** (`model.safetensors`, bf16). Use it to:
|
| 42 |
+
|
| 43 |
+
- ๐ง **Roll your own quants** โ make custom GGUF / **MLX** / AWQ / GPTQ builds from full precision.
|
| 44 |
+
- ๐งช **Fine-tune further** โ it's a clean base for your own LoRA / continued training.
|
| 45 |
+
- ๐ค **Run it in `transformers`** (needs a recent build with `gemma4_unified` support).
|
| 46 |
+
|
| 47 |
+
> ๐ **Just want to run it?** You don't need this repo โ grab a ready-made quant from the
|
| 48 |
+
> **[GGUF repo โ](https://huggingface.co/yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2-GGUF)** (runs in
|
| 49 |
+
> ~4.5 GB of VRAM / unified memory in LM Studio, Ollama, llama.cpp, Janโฆ). This master is for *builders*. ๐
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## ๐ The headline โ it works as an agent (tau2-bench)
|
| 54 |
+
|
| 55 |
+
v2 is built for **coding + agentic** work โ writing code, running commands, using tools, debugging, multi-step
|
| 56 |
+
technical tasks. The clearest signal is **tau2-bench `telecom`**, an agentic tool-use benchmark whose
|
| 57 |
+
*diagnose โ fix โ verify* loop mirrors real terminal/debugging work:
|
| 58 |
+
|
| 59 |
+
| tau2-bench **telecom** ยท 20 tasks ยท local, same harness, **all Q8_0** | score |
|
| 60 |
+
|---|---|
|
| 61 |
+
| official `gemma-4-12B-it` (base) | **~15%** |
|
| 62 |
+
| ๐ข **Gemma4-12B v2 (this model)** | **~55%** |
|
| 63 |
+
|
| 64 |
+
โ Roughly **3.5ร higher** than the base model on technical-agentic tasks. ๐ฏ
|
| 65 |
+
|
| 66 |
+
> ๐ฌ *Honest methodology:* these are **local, same-harness, relative** numbers (**all models tested at Q8_0**, greedy
|
| 67 |
+
> decoding, self-simulated user, 20 tasks). They are **not** directly comparable to published tau2-bench leaderboard
|
| 68 |
+
> figures (different user-simulator, full task sets, full precision) โ local self-eval runs *systematically lower* than
|
| 69 |
+
> published scores. Read them as **"v2 vs the base model under identical conditions"**, which is the comparison that
|
| 70 |
+
> actually matters here.
|
| 71 |
+
|
| 72 |
+
**Grounded, not made-up.** A coding/terminal *fabrication probe* (tasks that deliberately tempt the model to invent
|
| 73 |
+
file paths / function signatures / values) found v2 **grounds before it acts** just like the base โ it `grep`/`read`/`ls`
|
| 74 |
+
first, and **doesn't make things up** (0% fabrication, on par with the base).
|
| 75 |
+
|
| 76 |
+
**The trade-off โ no free lunch.** On a general-knowledge benchmark (**MMLU-Pro**), v2 lands a little **below** the base โ
|
| 77 |
+
completely normal for a focused fine-tune: you trade a sliver of broad-knowledge breadth for coding + agentic strength.
|
| 78 |
+
Need a generalist? Try my general-purpose
|
| 79 |
+
**[Claude Opus 4.6/4.8 distillation](https://huggingface.co/yuxinlu1/gemma-4-12B-it-Claude-4.6-4.8-Opus-GGUF)** or the
|
| 80 |
+
base `google/gemma-4-12B-it`. Need a **local coding/agentic** worker? That's what v2 is tuned for. ๐
|
| 81 |
+
|
| 82 |
+
---
|
| 83 |
+
|
| 84 |
+
## ๐ค Run it in transformers
|
| 85 |
+
|
| 86 |
+
```python
|
| 87 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 88 |
+
import torch
|
| 89 |
+
|
| 90 |
+
repo = "yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2"
|
| 91 |
+
tok = AutoTokenizer.from_pretrained(repo)
|
| 92 |
+
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16, device_map="auto")
|
| 93 |
+
|
| 94 |
+
msgs = [{"role": "user", "content": "Write a Python function to check if a string is a valid IPv4 address."}]
|
| 95 |
+
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
| 96 |
+
out = model.generate(inputs, max_new_tokens=1024)
|
| 97 |
+
print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
> ๐ง **Thinking mode:** it thinks in Gemma's native thought channel before answering (keep `enable_thinking=true`, the
|
| 101 |
+
> default chat template handles it). Recommended sampling: `temp 1.0, top_p 0.95, top_k 64`; for coding you can also go
|
| 102 |
+
> greedy (`temp 0`). Needs a **recent `transformers`** that knows the `gemma4_unified` architecture.
|
| 103 |
+
>
|
| 104 |
+
> ๐ ๏ธ **Agentic / tool use:** v2 emits structured tool-calls in Gemma 4's **native** protocol. The smoothest agent
|
| 105 |
+
> setup is a GGUF quant served with llama.cpp `--jinja` (pass your tools via the OpenAI `tools` field) โ see the GGUF
|
| 106 |
+
> repo for the full command.
|
| 107 |
+
|
| 108 |
+
---
|
| 109 |
+
|
| 110 |
+
## ๐ฆ Ready-made GGUF quants
|
| 111 |
+
|
| 112 |
+
All from the **[GGUF repo](https://huggingface.co/yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2-GGUF)**:
|
| 113 |
+
|
| 114 |
+
| Quant | Size | Vibe |
|
| 115 |
+
|------|------|------|
|
| 116 |
+
| ๐ก [**Q3_K_M**](https://huggingface.co/yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2-GGUF/blob/main/gemma4-v2-Q3_K_M.gguf) | **5.7 GB** | great for 8 GB VRAM |
|
| 117 |
+
| ๐ต [**Q4_K_M**](https://huggingface.co/yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2-GGUF/blob/main/gemma4-v2-Q4_K_M.gguf) | **6.87 GB** | the sweet spot ๐ (recommended) |
|
| 118 |
+
| ๐ฃ [**Q6_K**](https://huggingface.co/yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2-GGUF/blob/main/gemma4-v2-Q6_K.gguf) | **9.11 GB** | near-lossless |
|
| 119 |
+
| โช [**Q8_0**](https://huggingface.co/yuxinlu1/gemma-4-12B-agentic-fable5-composer2.5-v2-3.5x-tau2-GGUF/blob/main/gemma4-v2-Q8_0.gguf) | **11.8 GB** | basically full quality |
|
| 120 |
+
|
| 121 |
+
> โ ๏ธ GGUF needs a **recent llama.cpp** โ this is the `gemma4_unified` architecture, older builds won't load it.
|
| 122 |
+
> โน๏ธ **No Q2_K this release** โ it didn't pass real stress-testing (2-bit is too lossy for 12B coding). Smallest
|
| 123 |
+
> reliable quant = **Q3_K_M**.
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
+
|
| 127 |
+
## ๐ What's new in v2 (training)
|
| 128 |
+
|
| 129 |
+
v2 continues from the v1 coder and adds a big **agentic** push โ the piece v1 was missing:
|
| 130 |
+
|
| 131 |
+
- **๐ ๏ธ Agentic / terminal** โ real **multi-step tool-use** trajectories (*read โ reason โ act โ verify*), in Gemma 4's
|
| 132 |
+
native tool protocol. This is what drove the tau2-bench telecom jump, and it fixes v1's "stops after the first step"
|
| 133 |
+
behavior.
|
| 134 |
+
- **๐ป Coding** โ verified chain-of-thought over Python tasks (**real CoT, gated on passing tests**) plus the
|
| 135 |
+
Fable-5-redo set for the hard cases.
|
| 136 |
+
- **๐ General** โ a curated slice of reasoning/instruction data to keep broad competence.
|
| 137 |
+
|
| 138 |
+
All reasoning is **distilled CoT**. A bittersweet note: none of us saw it coming that **Fable 5 would be retired**, and
|
| 139 |
+
only my own dataset holds Fable 5's genuine, self-authored traces โ so for the community-contributed data I **rebuilt the
|
| 140 |
+
missing reasoning from scratch with Opus 4.8 (xhigh)**. It may diverge from the original Fable 5 traces, but it was the
|
| 141 |
+
only workable path โ and the improvement turned out **really huge**. ๐
|
| 142 |
+
|
| 143 |
+
---
|
| 144 |
+
|
| 145 |
+
## โก Speculative decoding (MTP draft) โ verified build
|
| 146 |
+
|
| 147 |
+
The GGUF repo's `MTP/` folder ships the Gemma 4 multi-token-prediction draft (unsloth's GGUF conversion of Google's
|
| 148 |
+
official `gemma-4-12B-it-assistant`) for speculative decoding. Gemma 4 MTP is in **llama.cpp mainline** (PR #23398) โ no
|
| 149 |
+
fork needed โ but the `gemma4-assistant` loader is **build-sensitive right now**, so use the exact build below:
|
| 150 |
+
|
| 151 |
+
- โ
**Verified working: llama.cpp `b9553` (commit `9e3b928fd`).** Reproduced with `gemma4-v2-Q8_0` + the `MTP-Q8_0`
|
| 152 |
+
draft: loads cleanly and accelerates generation (~88 โ ~180 tok/s on a simple deterministic prompt; expect ~1.2โ1.3ร
|
| 153 |
+
on real coding/thinking). **Lossless** either way.
|
| 154 |
+
- โ ๏ธ **Newer builds (e.g. b9702 / b9717) currently crash** while loading the draft with `invalid vector subscript` โ an
|
| 155 |
+
**upstream regression** in the `gemma4-assistant` loader path, *not* a problem with the GGUFs. Stick with **b9553**
|
| 156 |
+
until it's fixed upstream.
|
| 157 |
+
|
| 158 |
+
```bat
|
| 159 |
+
llama-server -m gemma4-v2-Q8_0.gguf ^
|
| 160 |
+
--model-draft MTP\gemma-4-12B-it-MTP-Q8_0.gguf ^
|
| 161 |
+
--spec-type draft-mtp --spec-draft-n-max 4 ^
|
| 162 |
+
-ngl 99 -ngld 99 -fa on --jinja
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
> โน๏ธ The draft is the generic Gemma 4 assistant (not retrained for v2), so acceptance is a touch lower than a
|
| 166 |
+
> model-specific draft would give โ still 100% lossless.
|
| 167 |
+
|
| 168 |
+
---
|
| 169 |
+
|
| 170 |
+
## โ ๏ธ Good to know
|
| 171 |
+
- **Specialized for coding / terminal / agentic.** General-knowledge facts/numbers should still be double-checked.
|
| 172 |
+
- **Reduced refusals:** task-focused training, not safety-aligned โ add your own guardrails for production. Use
|
| 173 |
+
responsibly. ๐
|
| 174 |
+
- English-centric.
|
| 175 |
+
|
| 176 |
+
---
|
| 177 |
+
|
| 178 |
+
## ๐ Base & License
|
| 179 |
+
- **License: Apache 2.0.** Gemma 4 is released by Google under
|
| 180 |
+
**[Apache 2.0](https://ai.google.dev/gemma/apache_2)** (unlike the older Gemma 1/2/3 terms), so this fine-tune is
|
| 181 |
+
**Apache 2.0** too โ free to use, modify, and redistribute. ๐
|
| 182 |
+
- **Base model:** [`google/gemma-4-12B-it`](https://huggingface.co/google/gemma-4-12B-it).
|
| 183 |
+
- Personal/hobby project โ shared as-is, no warranty. Built with time, care, and a lot of coffee. Have fun, and happy
|
| 184 |
+
hacking! ๐พโจ
|