Instructions to use bahadirakdemir/gemma-4-12B-it-text-fp8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bahadirakdemir/gemma-4-12B-it-text-fp8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bahadirakdemir/gemma-4-12B-it-text-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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("bahadirakdemir/gemma-4-12B-it-text-fp8") model = AutoModelForMultimodalLM.from_pretrained("bahadirakdemir/gemma-4-12B-it-text-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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bahadirakdemir/gemma-4-12B-it-text-fp8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bahadirakdemir/gemma-4-12B-it-text-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": "bahadirakdemir/gemma-4-12B-it-text-fp8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bahadirakdemir/gemma-4-12B-it-text-fp8
- SGLang
How to use bahadirakdemir/gemma-4-12B-it-text-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 "bahadirakdemir/gemma-4-12B-it-text-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": "bahadirakdemir/gemma-4-12B-it-text-fp8", "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 "bahadirakdemir/gemma-4-12B-it-text-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": "bahadirakdemir/gemma-4-12B-it-text-fp8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use bahadirakdemir/gemma-4-12B-it-text-fp8 with Docker Model Runner:
docker model run hf.co/bahadirakdemir/gemma-4-12B-it-text-fp8
Gemma 4 12B-it — Text FP8 (ModelOpt)
FP8-quantized text tower of google/gemma-4-12B-it,
the unified (encoder-free multimodal) Gemma 4 12B model. The linear layers of
the language model are quantized to FP8 (E4M3) with per-tensor static scales
calibrated offline via NVIDIA ModelOpt;
lm_head and the (tied) embeddings stay in BF16.
This checkpoint is text-only: the vision/audio encoder weights are not
included. The config still advertises Gemma4UnifiedForConditionalGeneration
and the weights live under model.language_model.*, which keeps the layer
namespace compatible with the paired MTP drafter for speculative decoding (see
below). Serve it with --limit-mm-per-prompt '{"image": 0, "audio": 0}' so the
absent multimodal encoder is never invoked.
Produced by the same pipeline as
bahadirakdemir/gemma-4-31B-it-text-fp8.
Requirements
This is the unified Gemma 4 architecture (model_type: gemma4_unified), which is
newer than the classic gemma4 (e.g. 31B). You need:
- transformers ≥ 5.10.0 (when
gemma4_unifiedwas added) - vLLM with
gemma4_unifiedsupport — at the time of writing this is on themainbranch / nightly (uv pip install -U vllm --pre), not yet in a tagged stable release (≤ 0.22.0). It will be in the next stable release.
Usage with vLLM
vllm serve bahadirakdemir/gemma-4-12B-it-text-fp8 \
--quantization modelopt \
--max-model-len 8192 \
--max-num-batched-tokens 8192 \
--gpu-memory-utilization 0.5 \
--limit-mm-per-prompt '{"image": 0, "audio": 0}'
For speculative decoding, pair it with the matching FP8 MTP drafter
bahadirakdemir/gemma-4-12B-it-assistant-fp8:
vllm serve bahadirakdemir/gemma-4-12B-it-text-fp8 \
--quantization modelopt \
--max-model-len 8192 \
--max-num-batched-tokens 8192 \
--gpu-memory-utilization 0.5 \
--limit-mm-per-prompt '{"image": 0, "audio": 0}' \
--speculative-config '{"model": "bahadirakdemir/gemma-4-12B-it-assistant-fp8", "num_speculative_tokens": 4}'
Tested with vllm/vllm-openai:gemma4-0505-arm64-cu130 on NVIDIA GB10.
Quantization details
| Method | ModelOpt FP8 PTQ (E4M3, per-tensor static scales) |
| Quantized | language-model linears (attention + MLP projections) |
| Kept in BF16 | lm_head, tied embeddings, all norms |
| Calibration | 32 instruct-style prompts, max length 1024 |
License: Apache 2.0, inherited from upstream Gemma 4 — see the Gemma 4 license.
- Downloads last month
- 767