Run this model with HF Jobs
Run jtchen0528/diffusiongemma-26B-A4B-it-FP8 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/jtchen0528/diffusiongemma-26B-A4B-it-FP8. Ask me which dataset to train on, then push the LoRA adapter to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs and Transformers to run batch inference with https://huggingface.co/jtchen0528/diffusiongemma-26B-A4B-it-FP8 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the predictions back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs and Lighteval to evaluate https://huggingface.co/jtchen0528/diffusiongemma-26B-A4B-it-FP8. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use jtchen0528/diffusiongemma-26B-A4B-it-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jtchen0528/diffusiongemma-26B-A4B-it-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="jtchen0528/diffusiongemma-26B-A4B-it-FP8") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("jtchen0528/diffusiongemma-26B-A4B-it-FP8") model = AutoModelForMultimodalLM.from_pretrained("jtchen0528/diffusiongemma-26B-A4B-it-FP8", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jtchen0528/diffusiongemma-26B-A4B-it-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jtchen0528/diffusiongemma-26B-A4B-it-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jtchen0528/diffusiongemma-26B-A4B-it-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/jtchen0528/diffusiongemma-26B-A4B-it-FP8
- SGLang
How to use jtchen0528/diffusiongemma-26B-A4B-it-FP8 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 "jtchen0528/diffusiongemma-26B-A4B-it-FP8" \ --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": "jtchen0528/diffusiongemma-26B-A4B-it-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "jtchen0528/diffusiongemma-26B-A4B-it-FP8" \ --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": "jtchen0528/diffusiongemma-26B-A4B-it-FP8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use jtchen0528/diffusiongemma-26B-A4B-it-FP8 with Docker Model Runner:
docker model run hf.co/jtchen0528/diffusiongemma-26B-A4B-it-FP8
diffusiongemma-26B-A4B-it-FP8
Per-tensor FP8 (E4M3, static W8A8) quantization of
google/diffusiongemma-26B-A4B-it produced with
NVIDIA Model Optimizer, with an FP8 KV cache.
| ModelOpt | 0.48.1.dev0+ge2f328a19 (source checkout at commit e2f328a19, plus the tied-weight export fix from upstream PR #2733, released in 0.49) |
| Recipe | model_type/diffusion_gemma/ptq/fp8-kv_fp8_cast.yaml (local; contents below) |
| FP8 | attention q/k/v/o_proj, dense MLP gate/up/down_proj, routed experts |
| BF16 | lm_head, embeddings, router, self_conditioning, vision tower / embedder |
| KV cache | FP8, cast mode (scale 1.0) |
| Calibration | nemotron-post-training-v3, 512 samples x 512 tokens |
Command
cd Model-Optimizer
python3 examples/hf_ptq/hf_ptq.py \
--pyt_ckpt_path google/diffusiongemma-26B-A4B-it \
--recipe modelopt_recipes/model_type/diffusion_gemma/ptq/fp8-kv_fp8_cast.yaml \
--dataset nemotron-post-training-v3 \
--calib_size 512 \
--calib_seq 512 \
--batch_size 4 \
--export_path diffusiongemma-26B-A4B-it-FP8 \
--skip_generate
After export, config.json and generation_config.json were restored from the source checkpoint,
keeping only ModelOpt's quantization_config. Newer transformers rewrites text_config on export
in a form that older transformers and vLLM cannot read.
Recipe
modelopt_recipes/model_type/diffusion_gemma/ptq/fp8-kv_fp8_cast.yaml:
# modelopt-schema: modelopt.recipe.config.ModelOptPTQRecipe
imports:
base_disable_all: configs/ptq/units/base_disable_all
w8a8_fp8_fp8: configs/ptq/units/w8a8_fp8_fp8
kv_fp8_cast: configs/ptq/units/kv_fp8_cast
disabled_quantizers: model_type/diffusion_gemma/ptq/disabled_quantizers
metadata:
description: >-
DiffusionGemma FP8 W8A8 per-tensor (max-calibrated) on all text Linear layers with FP8
KV-cache cast; router, self-conditioning, vision and lm_head stay bf16.
quantize:
algorithm: max
quant_cfg:
- $import: base_disable_all
- $import: w8a8_fp8_fp8
- $import: kv_fp8_cast
- $import: disabled_quantizers
- Downloads last month
- 24
Model tree for jtchen0528/diffusiongemma-26B-A4B-it-FP8
Base model
google/diffusiongemma-26B-A4B-it