Instructions to use mlabonne/gemma-3-27b-it-abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlabonne/gemma-3-27b-it-abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="mlabonne/gemma-3-27b-it-abliterated") 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("mlabonne/gemma-3-27b-it-abliterated") model = AutoModelForMultimodalLM.from_pretrained("mlabonne/gemma-3-27b-it-abliterated") 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]:])) - Inference
- Local Apps Settings
- vLLM
How to use mlabonne/gemma-3-27b-it-abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlabonne/gemma-3-27b-it-abliterated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/gemma-3-27b-it-abliterated", "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/mlabonne/gemma-3-27b-it-abliterated
- SGLang
How to use mlabonne/gemma-3-27b-it-abliterated 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 "mlabonne/gemma-3-27b-it-abliterated" \ --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": "mlabonne/gemma-3-27b-it-abliterated", "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 "mlabonne/gemma-3-27b-it-abliterated" \ --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": "mlabonne/gemma-3-27b-it-abliterated", "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 mlabonne/gemma-3-27b-it-abliterated with Docker Model Runner:
docker model run hf.co/mlabonne/gemma-3-27b-it-abliterated
No Vision Layers?
Thanks for this.
Is this only for text? Is vision omitted?
Hi! You can use the mmproj-model-f16.gguf model from here: https://huggingface.co/lmstudio-community/gemma-3-27b-it-GGUF/tree/main. Simply place it together with the gemma-3-27b-it-abliterated.q4_k_m.gguf model. I was able to run it normally in LM Studio, and it can recognize image content.
Thanks! But what if I use Ollama?
Thanks! But what if I use Ollama?
ditto
"""Hi! You can use the mmproj-model-f16.gguf model from here: https://huggingface.co/lmstudio-community/gemma-3-27b-it-GGUF/tree/main. Simply place it together with the gemma-3-27b-it-abliterated.q4_k_m.gguf model. I was able to run it normally in LM Studio, and it can recognize image content.
"""
worked flawlessly in LM studio, thanks. Bit tricky in OLLAMA though.
"""Hi! You can use the mmproj-model-f16.gguf model from here: https://huggingface.co/lmstudio-community/gemma-3-27b-it-GGUF/tree/main. Simply place it together with the gemma-3-27b-it-abliterated.q4_k_m.gguf model. I was able to run it normally in LM Studio, and it can recognize image content.
"""
worked flawlessly in LM studio, thanks. Bit tricky in OLLAMA though.
What did you do??
Did anyone figure out ollama out?
Nope. The most helpful thread between ollama repo discussions I've found is this one: https://github.com/ollama/ollama/issues/9967
But I'm still unable to load the mmproj file along with gemma-3-27b-it-abliterated.q4_k_m.gguf, and I'm getting the error "Failed to create new sequence: failed to process inputs: this model is missing data required for image input".
At least one user seems to have managed it. The model includes Vision and works very well in Ollama! However, it's not documented how he implemented it – an information that would be very useful for all of us.
https://ollama.com/pidrilkin/gemma3_27b_abliterated
This should be the solution for the model creators to support vision models in Ollama ?!
https://github.com/ollama/ollama/pull/11163/files
After ollama 0.9, models in the safetensor format can be directly quantized by ollama while retaining visual capabilities. The visual processing of gemma3 is quite special; it needs to be converted to a unified gguf format that includes visual condition branches using a specific format conversion, and ollama executes it with its own engine. The external projections supported by ollama are currently only clip and mllama architectures. In summary:
- Models and projection files in the gguf format cannot be created as gemma3 models with retained visual capabilities through the modelfile method;
- Models in the safetensor format on hf can be converted by ollama into models with retained visual capabilities. The specific conversion method can be referred to by reverse coding: https://github.com/ollama/ollama/blob/main/convert/convert_gemma3.go
- mlabonne/gemma-3-27b-it-abliterated has a complete visual branch and can be converted directly.
This should be the solution for the model creators to support vision models in Ollama ?!
https://github.com/ollama/ollama/pull/11163/files
I know this was posted months ago, but I followed that Ollama pull request and actually put both the image file and the oblit into the same directory (created one and linked it in the modelFile) and low and behold, on the model create, it combined both the vision file and the oblit file. Thank you so much for posting that!
I know this was posted months ago, but I followed that Ollama pull request and actually put both the image file and the oblit into the same directory (created one and linked it in the modelFile) and low and behold, on the model create, it combined both the vision file and the oblit file. Thank you so much for posting that!
I tried this approach about six months ago, while we were discussing the model, it didn’t work for me at the time (same directory, using FROM for the directory).
Maybe the ollama framework has become more intelligent since then, which is why it now works well for you.