Image-Text-to-Text
Transformers
Safetensors
English
gemma4
gemma
multimodal
vision-language
quantized
int8
w8a8
quark
vllm
conversational
text-generation-inference
8-bit precision
Instructions to use nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8") 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("nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8") model = AutoModelForMultimodalLM.from_pretrained("nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8", 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 nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8", "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/nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8
- SGLang
How to use nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 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 "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8" \ --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": "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8", "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 "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8" \ --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": "nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8", "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 nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8 with Docker Model Runner:
docker model run hf.co/nameistoken/Gemma-4-31B-it-Quark-W8A8-INT8
File size: 1,120 Bytes
8e017e8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Gemma 4 31B Instruct
Copyright (c) Google DeepMind
Original model weights: https://huggingface.co/google/gemma-4-31B-it
Distributed by Google DeepMind under the Apache License 2.0
(https://ai.google.dev/gemma/apache_2).
This repository contains a derivative work: an INT8 W8A8 post-training quantized
version of the above model, produced with AMD Quark
(https://github.com/amd/quark). The original BF16 weights have been transformed
into INT8 per-channel weights with per-token dynamic INT8 activations; the
embedding, lm_head and the entire vision tower remain in BF16.
Modifications made:
- Linear weights of the language tower converted from BF16 to INT8 with
per-output-channel symmetric scales.
- quantization_config block appended to config.json (custom_mode='quark',
pack_method='order', weight_format='real_quantized').
- All other tokenizer / processor / chat_template files are unchanged from
the upstream google/gemma-4-31B-it release.
The license, attribution and disclaimer of warranty terms of the Apache License
2.0 (see LICENSE) apply to both the original work and this derivative.
|