Views
No views yet
Check out v2! Get it here.
pip install 'transformers==5.16.1'1vllm serve xdavxd/gemma-4-12B-it-heretic-NVFP4 \
2 --max-model-len 32768 \
3 --gpu-memory-utilization 0.901vllm serve xdavxd/gemma-4-12B-it-heretic-NVFP4 \
2 --max-model-len 32768 \
3 --gpu-memory-utilization 0.90 \
4 --enable-auto-tool-choice \
5 --reasoning-parser gemma4 \
6 --tool-call-parser gemma4 \
7 --chat-template examples/tool_chat_template_gemma4.jinja \
8 --limit-mm-per-prompt '{"image": 4, "audio": 1}' \
9 --async-schedulingTip: For text-only workloads, pass--limit-mm-per-prompt '{"image": 0, "audio": 0}'to skip multimodal memory allocation and free up GPU memory for a longer context window.
1from openai import OpenAI
2
3openai_api_key = "EMPTY"
4openai_api_base = "http://<your-server-host>:8001/v1"
5
6client = OpenAI(
7 api_key=openai_api_key,
8 base_url=openai_api_base,
9)
10
11model = "xdavxd/gemma-4-12B-it-heretic-NVFP4"
12
13messages = [
14 {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
15]
16
17outputs = client.chat.completions.create(
18 model=model,
19 messages=messages,
20)
21
22generated_text = outputs.choices[0].message.content
23print(generated_text)1from transformers import AutoModelForCausalLM, AutoTokenizer
2from llmcompressor import oneshot
3from llmcompressor.modifiers.quantization import QuantizationModifier
4
5MODEL_ID = "./gemma-4-12B-it-heretic"
6SAVE_DIR = "gemma-4-12B-it-heretic-NVFP4"
7
8model = AutoModelForCausalLM.from_pretrained(MODEL_ID, dtype="auto")
9tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
10
11recipe = QuantizationModifier(
12 targets="Linear",
13 scheme="NVFP4",
14 ignore=["re:.*vision.*", "re:.*audio.*", "lm_head", "re:.*embed.*"],
15)
16
17oneshot(
18 model=model,
19 tokenizer=tokenizer,
20 recipe=recipe,
21 dataset="ultrachat_200k",
22 splits="train_sft",
23 num_calibration_samples=512,
24 max_seq_length=2048,
25)
26
27model.save_pretrained(SAVE_DIR, save_compressed=True)
28tokenizer.save_pretrained(SAVE_DIR)| Metric | This model | Original model (google/gemma-4-12B-it) |
|---|---|---|
| KL divergence | 0.1576 | 0 (by definition) |
| Refusals | 7/100 | 99/100 |
| Category | Benchmark | google/gemma-4-12B-it | RedHatAI/gemma-4-12B-it-NVFP4 | xdavxd/gemma-4-12B-it-heretic-NVFP4 | Recovery |
|---|---|---|---|---|---|
| Instruction Following | IFEval (0-shot, prompt-level strict) | - | - | - | - |
| IFEval (0-shot, inst-level strict) | - | - | - | - | |
| Reasoning | GSM8K Platinum (flexible-extract) | 90.82 | 90.16 | - | - |
| GSM8K Platinum (strict-match) | 89.58 | 88.67 | - | - | |
| MATH-500 (0-shot, pass@1) | - | - | - | - |
Image input is verified working. Served under vLLM, the model correctly described a synthetic test image (a red circle and brown rectangle on a light blue background).Audio input is degraded. On a Harvard-sentences clip this checkpoint mistranscribes most content words, where the unquantized base transcribes correctly. Text and image are unaffected.
1sudo docker run --rm -it \
2 --gpus all \
3 --ipc=host \
4 --network host \
5 -v ~/models/gemma-4-12B-it-heretic-NVFP4:/models/heretic:ro \
6 -v ~/.cache/huggingface:/root/.cache/huggingface \
7 -e VLLM_USE_V2_MODEL_RUNNER=1 \
8 ghcr.io/timothystewart6/vllm-gb10:v0.28.0-gb10.2 \
9 vllm serve /models/heretic \
10 --host 0.0.0.0 --port 8001 \
11 --served-model-name heretic-12b \
12 --max-model-len 69632 \
13 --gpu-memory-utilization 0.50 \
14 --enable-auto-tool-choice \
15 --reasoning-parser gemma4 \
16 --tool-call-parser gemma4 \
17 --limit-mm-per-prompt '{"image":0,"audio":0}' \
18 --kv-cache-dtype fp8 \
19 --max-num-seqs 32 \
20 --async-schedulingfor SEED in 1234 2345 3456; do
lm_eval --model local-chat-completions \
--tasks gsm8k_platinum_cot_llama \
--model_args "model=heretic,max_length=36096,base_url=http://0.0.0.0:8001/v1/chat/completions,num_concurrent=32,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=2400" \
--num_fewshot 0 \
--apply_chat_template \
--output_path "results_gsm8k_seed${SEED}.json" \
--seed $SEED \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=64,max_gen_toks=32000,seed=${SEED}"
echo "Seed $SEED complete"
donefor SEED in 1234 2345 3456; do
lm_eval --model local-chat-completions \
--tasks ifeval \
--model_args "model=heretic,max_length=36096,base_url=http://0.0.0.0:8001/v1/chat/completions,num_concurrent=32,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=2400" \
--num_fewshot 0 \
--apply_chat_template \
--output_path "results_ifeval_seed${SEED}.json" \
--seed $SEED \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=64,max_gen_toks=32000,seed=${SEED}"
echo "IFEval seed $SEED complete"
done1model_parameters:
2 provider: hosted_vllm
3 model_name: hosted_vllm/heretic
4 base_url: http://0.0.0.0:8001/v1
5 api_key: ''
6 timeout: 3600
7 concurrent_requests: 32
8 generation_parameters:
9 temperature: 1.0
10 max_new_tokens: 65536
11 top_p: 0.95
12 top_k: 64
13 seed: 1234# MATH-500 (3 seeds)
for SEED in 1234 2345 3456; do
sed -i "s/seed: .*/seed: $SEED/" litellm_config.yaml
lighteval endpoint litellm litellm_config.yaml 'math_500|0' \
--output-dir "results_math500_seed${SEED}/" --save-details
echo "MATH-500 seed $SEED complete"
done