Instructions to use cyankiwi/gemma-4-31B-it-AWQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cyankiwi/gemma-4-31B-it-AWQ-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="cyankiwi/gemma-4-31B-it-AWQ-4bit") 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("cyankiwi/gemma-4-31B-it-AWQ-4bit") model = AutoModelForMultimodalLM.from_pretrained("cyankiwi/gemma-4-31B-it-AWQ-4bit", 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 cyankiwi/gemma-4-31B-it-AWQ-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cyankiwi/gemma-4-31B-it-AWQ-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cyankiwi/gemma-4-31B-it-AWQ-4bit", "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/cyankiwi/gemma-4-31B-it-AWQ-4bit
- SGLang
How to use cyankiwi/gemma-4-31B-it-AWQ-4bit 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 "cyankiwi/gemma-4-31B-it-AWQ-4bit" \ --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": "cyankiwi/gemma-4-31B-it-AWQ-4bit", "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 "cyankiwi/gemma-4-31B-it-AWQ-4bit" \ --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": "cyankiwi/gemma-4-31B-it-AWQ-4bit", "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 cyankiwi/gemma-4-31B-it-AWQ-4bit with Docker Model Runner:
docker model run hf.co/cyankiwi/gemma-4-31B-it-AWQ-4bit
High First Token Latency Issue with AWQ-4bit Model Deployment Using vLLM
Hello, I deployed your quantized cyankiwi/gemma-4-31B-it-AWQ-4bit model using vllm==0.19.0 and transformers==5.5.0. The startup command I used is:
/miniconda/vllm/bin/python -m vllm.entrypoints.openai.api_server
--model ./models--cyankiwi--gemma-4-31B-it-AWQ-4bit
--served-model-name Model
--max-num-seqs 3
--gpu-memory-utilization 0.85
--max-model-len 15k
--port 8001
--tensor_parallel_size 2
--enable-auto-tool-choice
--default-chat-template-kwargs '{"enable_thinking": false}'
--language-model-only
--tool-call-parser gemma4
--reasoning-parser gemma4 >> vllm.log 2>&1 &
However, I've noticed that the first token latency can sometimes be extremely long.
hello, I try to load this version in anaconda with rtx 3090 on ubuntu 22.04 which has 6.8.0.40 kernel.
My nvidia-driver version is 550.135.
I created a env. python=3.11 .
Then pip install vllm. But the default version is 0.13.0. I upgrade it to 0.19.0.
After that i try to install transformers=5.5.0.
It reports that: vllm 0.19.0 requires transformers<5,>=4.56.0, but you have transformers 5.5.0 which is incompatible.
why? Can i ignore that?
In my environment, I originally had pip install vllm==0.18.0, then in order to deploy gemma4, I ran pip install vllm==0.19.0, followed by pip install transformers==5.5.0, and then I found that it could be deployed successfully.
In my environment, I originally had pip install vllm==0.18.0, then in order to deploy gemma4, I ran pip install vllm==0.19.0, followed by pip install transformers==5.5.0, and then I found that it could be deployed successfully.
Thank you for your kind. I upgraded my nvidia driver to 580.59.08. A new env has been created in anaconda. I startup the vllm container successfully by the following command:
docker run --gpus all
--runtime nvidia
--ipc=host
-v "$MODEL_PATH:/model"
-p 8000:8000
vllm/vllm-openai:gemma4-cu130
--model /model
--served-model-name gemma-4-31b
--dtype bfloat16
--quantization compressed-tensors
--max-model-len 2048
--max-num-seqs 8
--gpu-memory-utilization 0.95
--trust-remote-code
I test it by curl. Well, it worked. The only limit is 'max-model-len' is 2048