Views
No views yet
language_model transformers blocks are quantized. Vision model and multimodal projection are kept in original precision. Weights are quantized using a symmetric per-group scheme, with group size 128. The GPTQ algorithm is applied for quantization.vLLM engine.| Model | ArcC | GSM8k | Hellaswag | MMLU | TruthfulQA-mc2 | Winogrande | Average | Recovery |
|---|---|---|---|---|---|---|---|---|
| gemma-3-27b-it | 0.7491 | 0.9181 | 0.8582 | 0.7742 | 0.6222 | 0.7908 | 0.7854 | 1.0000 |
| gemma-3-27b-it-INT4 (this) | 0.7415 | 0.9174 | 0.8496 | 0.7662 | 0.6160 | 0.7956 | 0.7810 | 0.9944 |
1MODEL=ISTA-DASLab/gemma-3-27b-it-GPTQ-4b-128g
2MODEL_ARGS="pretrained=$MODEL,max_model_len=4096,tensor_parallel_size=1,dtype=auto,gpu_memory_utilization=0.80"
3
4lm_eval \
5 --model vllm \
6 --model_args $MODEL_ARGS \
7 --tasks openllm \
8 --batch_size autotransformers update the package to stable release of Gemma3:pip install git+https://github.com/huggingface/transformers@v4.49.0-Gemma-3vLLM update the package to version after this PR.1# pip install accelerate
2
3from transformers import AutoProcessor, Gemma3ForConditionalGeneration
4from PIL import Image
5import requests
6import torch
7
8model_id = "ISTA-DASLab/gemma-3-27b-it-GPTQ-4b-128g"
9
10model = Gemma3ForConditionalGeneration.from_pretrained(
11 model_id, device_map="auto"
12).eval()
13
14processor = AutoProcessor.from_pretrained(model_id)
15
16messages = [
17 {
18 "role": "system",
19 "content": [{"type": "text", "text": "You are a helpful assistant."}]
20 },
21 {
22 "role": "user",
23 "content": [
24 {"type": "image", "image": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"},
25 {"type": "text", "text": "Describe this image in detail."}
26 ]
27 }
28]
29
30inputs = processor.apply_chat_template(
31 messages, add_generation_prompt=True, tokenize=True,
32 return_dict=True, return_tensors="pt"
33).to(model.device, dtype=torch.bfloat16)
34
35input_len = inputs["input_ids"].shape[-1]
36
37with torch.inference_mode():
38 generation = model.generate(**inputs, max_new_tokens=100, do_sample=False)
39 generation = generation[0][input_len:]
40
41decoded = processor.decode(generation, skip_special_tokens=True)
42print(decoded)
43
44# **Overall Impression:** The image is a close-up shot of a vibrant garden scene,
45# focusing on a cluster of pink cosmos flowers and a busy bumblebee.
46# It has a slightly soft, natural feel, likely captured in daylight.