Instructions to use unsloth/gemma-3-27b-it-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/gemma-3-27b-it-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="unsloth/gemma-3-27b-it-GGUF") 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("unsloth/gemma-3-27b-it-GGUF") model = AutoModelForMultimodalLM.from_pretrained("unsloth/gemma-3-27b-it-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use unsloth/gemma-3-27b-it-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- vLLM
How to use unsloth/gemma-3-27b-it-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/gemma-3-27b-it-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/gemma-3-27b-it-GGUF", "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/unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
- SGLang
How to use unsloth/gemma-3-27b-it-GGUF 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 "unsloth/gemma-3-27b-it-GGUF" \ --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": "unsloth/gemma-3-27b-it-GGUF", "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 "unsloth/gemma-3-27b-it-GGUF" \ --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": "unsloth/gemma-3-27b-it-GGUF", "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" } } ] } ] }' - Ollama
How to use unsloth/gemma-3-27b-it-GGUF with Ollama:
ollama run hf.co/unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
- Unsloth Studio
How to use unsloth/gemma-3-27b-it-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/gemma-3-27b-it-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/gemma-3-27b-it-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/gemma-3-27b-it-GGUF to start chatting
- Docker Model Runner
How to use unsloth/gemma-3-27b-it-GGUF with Docker Model Runner:
docker model run hf.co/unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
- Lemonade
How to use unsloth/gemma-3-27b-it-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull unsloth/gemma-3-27b-it-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.gemma-3-27b-it-GGUF-UD-Q4_K_XL
List all available models
lemonade list
- Atomic Chat
Cannot input image in ollama for gemma-3-27b-it-GGUF:Q4_K_M
Model variant: gemma-3-27b-it-GGUF:Q4_K_M
I am hosting the model in ollama and use python API to send request to the model
from ollama import Client
client = Client(host=host)
response = client.chat(
model=model,
messages=[
{
"role": "user",
"content": "Write the text in the image",
"images": [image_path]
}
]
)
return response['message']['content']
It raise the error
ollama._types.ResponseError: Failed to create new sequence: failed to process inputs: this model is missing data required for image input
(status code: 500)
I think the error is raised when the model is not support image input.
+1
I'm having the same issue with the 4b version, I think it's something to do with the vision element not being properly linked to the model, but it is a little beyond my skillset to resolve that. The standard quantized versions hosted on ollama work, so it must be something to do with how it's configured here.
Do you guys know if it works on llama.cpp? :)
the same issue here
Yes, it works with llama.cpp(text only)
I tried 4B version
+1
curl http://localhost:11434/api/chat -d '{
"model": "gemma-3-27b-it-GGUF:Q4_K_M",
"messages": [{
"role": "user",
"content": "what is in this image?",
"images": ["'"$(base64 -w 0 {(The_image_work_on_standard_version)} )"'"]
}]
}'
{"error":"Failed to create new sequence: failed to process inputs: this model is missing data required for image input\n"}
Didn't look deeper yet but I believe all the "unslothed" versions of any model are only capable of text.
+1
Didn't look deeper yet but I believe all the "unslothed" versions of any model are only capable of text.
According their blog, a visual capability was fixed. But it wasn't. Checked 27b Q4_K_M model with tensor parallelization in llama.cpp and ollama (native ollama quantized model works well). Vllm doesn't work at all. Perhaps, there was missed something on my side.
@eddited:
Apologies, that was my mistake. I was testing with this model on llama.cpp-server, but it doesn't currently support multimodality. Unfortunately, vllm also doesn't function with Gemma 3 in GGUF format, meaning this model is currently limited to local, multimodal testing.
I would appreciate it if anyone has experience running this in multimodal mode on a server and could share their insights.
We're also looking forward to the new release of Unsloth's inference engine, which is expected to support multi-GPU configurations.
For Ollama I'm unsure exactly what the issue is but I asked the Ollama folks, they have a unique way of doing GGUFs as they integrate the mmproj intoi the actual file so unfortunately there's nothing we can do about it if it still doesn't work. Hopefully they will support separate mmproj files in the future :(
It works on other places like llama.cpp etc
CC: @AndyNeSH @Jabarton @kitc @milankowww @nchatu @otacilio-psf @zcfrank1st
For Ollama I'm unsure exactly what the issue is but I asked the Ollama folks, they have a unique way of doing GGUFs as they integrate the mmproj intoi the actual file so unfortunately there's nothing we can do about it if it still doesn't work. Hopefully they will support separate mmproj files in the future :(
It works on other places like llama.cpp etc
CC: @AndyNeSH @Jabarton @kitc @milankowww @nchatu @otacilio-psf @zcfrank1st
is it working as GGUF in vLLM please?