Downloads · 30 days
374
21% of all-time downloads
amd/gemma-4-31B-it-MXFP4
gemma-4-31B-it-MXFP4 is a image-text-to-text model from amd. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
- Base model: google/gemma-4-31B-it - Model architecture: Gemma4ForConditionalGeneration (text-only eval uses Gemma4ForCausalLM override) - Quantizer: AMD Quark - Quantization scheme: mxfp4 - Weight quantization: FP4,…
Downloads · 30 days
374
21% of all-time downloads
All-time downloads
1.8K
Public
Parameters
16.6B
19.6 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors19.5 GB · 100%
How the weights are stored.
U814.6B · 88%
From the Hugging Face model README
google/gemma-4-31B-itGemma4ForConditionalGeneration (text-only eval uses Gemma4ForCausalLM override)mxfp4quant_method=quark)lm_headThis workflow is intended to run on AMD Instinct MI355.
docker run -it -d \
--name vllm-gemma4-openai \
--ipc=host \
--shm-size=64g \
--network=host \
--privileged \
--cap-add=CAP_SYS_ADMIN \
--device=/dev/kfd \
--device=/dev/dri \
--device=/dev/mem \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--entrypoint /bin/bash \
-v /shareddata:/shareddata -v /mnt:/mnt -v /data:/data -v /home/:/home -v /raid:/raid -v /docker:/docker -v /datasets:/datasets -v /scratch:/scratch -v /group:/group \
vllm/vllm-openai-rocm:gemma4
Run quantization inside Docker image vllm/vllm-openai-rocm:gemma4.
from quark.common.profiler import GlobalProfiler
from quark.torch import LLMTemplate, ModelQuantizer
ckpt_path = "google/gemma-4-31B-it"
output_dir = "/path/to/amd/gemma-4-31B-it-mxfp4"
exclude_layers = ["*vision_tower*", "*multi_modal_projector*", "*lm_head"]
if "gemma4" not in LLMTemplate.list_available():
gemma4_template = LLMTemplate(
model_type="gemma4",
kv_layers_name=["*language_model.*k_proj", "*language_model.*v_proj"],
q_layer_name="*language_model.*q_proj",
exclude_layers_name=exclude_layers,
)
LLMTemplate.register_template(gemma4_template)
template = LLMTemplate.get("gemma4")
quant_config = template.get_config(
scheme="mxfp4",
exclude_layers=exclude_layers,
)
profiler = GlobalProfiler(output_path=f"{output_dir}/quark_profile.yaml")
quantizer = ModelQuantizer(quant_config)
quantizer.direct_quantize_checkpoint(
pretrained_model_path=ckpt_path,
save_path=output_dir,
)
CUDA_VISIBLE_DEVICES=6,7 lm_eval run \
--model vllm \
--tasks gsm8k \
--model_args '{"pretrained":"amd/gemma-4-31B-it-mxfp4","tensor_parallel_size":2,"max_model_len":16384,"gpu_memory_utilization":0.90,"max_gen_toks":2048,"trust_remote_code":true,"chat_template":"/scratch/kewang/workspace/vllm/examples/tool_chat_template_gemma4.jinja","reasoning_parser":"gemma4","hf_overrides":{"architectures":["Gemma4ForCausalLM"]}}' \
--num_fewshot 5 \
--batch_size auto \
--apply_chat_template
The following GSM8K results are from local runs in this workspace.
| Benchmark | Metric | google/gemma-4-31B-it | amd/gemma-4-31B-it-mxfp4 |
|---|---|---|---|
| gsm8k | exact_match (flexible-extract) | 92.65 | 91.74 |
| gsm8k | exact_match (strict-match) | 92.27 | 91.36 |
This checkpoint is derived from google/gemma-4-31B-it. Please follow the upstream model license and usage terms.