Repository navigation
Closed
Description
-
Bug Description
When using the colab notebook for Gemma3_(4B), notice that the model in the .gguf file, when used in ollama, does not have the 'vision' capability. -
Reproduction Steps:
- Get model and tokenizer from unsloth:
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name = "unsloth/gemma-3-4b-it",
max_seq_length = 2048, # Choose any for long context!
load_in_4bit = True, # 4 bit quantization to reduce memory
load_in_8bit = False, # [NEW!] A bit more accurate, uses 2x memory
full_finetuning = False, # [NEW!] We have full finetuning now!
# token = "hf_...", # use one if using gated models
)- Save LoRA adapters (Pay attention to the directory, as you need to use the same directory to save the gguf file)
model.save_pretrained("mano-wii/gemma-3-finetune") # Local saving
tokenizer.save_pretrained("mano-wii/gemma-3-finetune")- Save to GGUF
model.save_pretrained_gguf(
"mano-wii/gemma-3-finetune",
quantization_type = "Q8_0", # For now only Q8_0, BF16, F16 supported
)- Optionally send to huggingface:
from unsloth_zoo.saving_utils import prepare_saving
repo_id = "mano-wii/gemma-3-finetune-gguf"
prepare_saving(
model,
repo_id,
push_to_hub = True,
max_shard_size = "50GB",
private = False,
token = hf_token,
)
from huggingface_hub import HfApi
api = HfApi(token = hf_token)
api.upload_folder(
folder_path = "mano-wii",
repo_id = repo_id,
repo_type = "model",
allow_patterns = ["*.gguf"],
)- Expected Behavior:
When using theollama show hf.co/mano-wii/gemma-3-finetune-ggufcommand,visionshould be inCapabilities(asgemma3):
PS D:\> ollama show gemma3
Model
architecture gemma3
parameters 4.3B
context length 8192
embedding length 2560
quantization Q4_K_M
Capabilities
completion
vision
Parameters
stop "<end_of_turn>"
temperature 0.1
- Actual Behavior:
Note novisioninCapabilitieswhen usingollama show hf.co/mano-wii/gemma-3-finetune-gguf:
PS D:\> ollama show hf.co/mano-wii/gemma-3-finetune-gguf
Model
architecture gemma3
parameters 3.9B
context length 131072
embedding length 2560
quantization unknown
Capabilities
completion
Parameters
stop "<end_of_turn>"
temperature 0.1
Activity
shimmyshimmer commentedon Apr 6, 2025
Can you try running them in llama.cpp and see if the vision component works there? Or try LM STudio
Mano-Wii commentedon Apr 6, 2025
Hi @shimmyshimmer,
I couldn't test running

llama.cpporLM STudiodirectly, but I was able to further understand the problem.I started noticing that in the process of saving to GGUF, there is this message:
Searching the source of this message I found these other logs in
llama.cpp/convert_hf_to_gguf.py:So, (also following the assistance of @rolandtannous from the unsloth's help forum) I ran this command:
This generated another .gguf file of 851MB called
mmproj.gguf.This
mmproj.gguffile is the model's vision projector file, and it has to be in the same directory as the model.That looked promising, however, the model continued to lack vision capability.
The only difference is that there is an error message when trying to "view" an image:
I don't know exactly where the problem is. Multiple .gguf files? Some misconfiguration?
Quantizing directly via
ollama create --quantize q5_K_M $MODEL_NAME -f "$REPO_DIR/Modelfile"works.xyehya commentedon Apr 14, 2025
Same issue, also if you try to load the saved 16bit MERGED fine-tuned model using FastModel, you will get a warning: Some weights of the model checkpoint at ./gemma-3-finetune were not used when initializing Gemma3ForCausalLM: ['multi_modal_projector.mm_input_projection_weight', 'multi_modal_projector.mm_soft_emb_norm.weight', 'vision_tower.vision_model.embeddings.patch_embedding.bias', 'vision_tower.vision_model.embeddings.patch_embedding.weight', 'vision_tower.vision_model.embeddings.position_embedding.weight', 'vision_tower.vision_model.encoder.layers.0.layer_norm1.bias', 'vision_tower.vision_model.encoder.layers.0.layer_norm1.weight', 'vision_tower.vision_model.encoder.layers.0.layer_norm2.bias' etc.....
I think the problem is not in the GGUF conversion only but also in the model.save_pretrained_merged("gemma-3-finetune-full", tokenizer)
histpay2 commentedon May 8, 2025
I'm seeing exactly this same issue.
eagle705 commentedon May 8, 2025
I also encountered the same issue... what's going on..
shivanis1406 commentedon Jul 3, 2025
I am also encountering this issue with unsloth/gemma-3-12b-it-qat-GGUF:Q4_K_M used via Ollama
rolandtannous commentedon Jul 3, 2025
@xyehya the save_pretrained_merged has been fixed and the model retains its vision capabilities. That's no longer the issue.
@histpay2 @eagle705 note that for llama.cpp, for now convert using the llama.cpp conversion script and beware taht you need to generate the mmproj file and the model files separately as documented here: https://github.com/ggml-org/llama.cpp/blob/master/docs/multimodal/gemma3.md
@shivanis1406 nsloth/gemma-3-12b-it-qat-GGUF:Q4_K_M will not work with ollama because ollama requires the mmproj and model file to be fused into 1 single file, while in the repo the mmproj file is separate. This repo is intended for use with llama.cpp
rolandtannous commentedon Oct 15, 2025
@Mano-Wii @eagle705 @histpay2 @shivanis1406 @xyehya @younik
We just pushed a major fix for llamacpp integration.
1- Please make sure to update your local install of unsloth
If you're using a notebook on kaggle or colab, it should pull the latest version automatically.
2- You can now use
save_pretrained_ggufto quantize and save to GGUF format:For vision/multimodal models, use
tokenizer=processor3- You can pass it one or several quant methods (as a list):
or
We support all the quants mentioned in this page except the iq variants.
4- If the model is supported by Ollama, it will now also automatically create a
Modelfilefor you that you can use to create your model in ollama using:5- Use
push_to_hub_ggufif you want to convert to gguf and push to Huggingface Hub instead.6- Should work for all models supported by unsloth and ollama.
7- It now fully supports linux debian and RPM variants. We are still testing windows (if someone has a windows machine and is on our discord channel ping me to help debug)
Let me know how it goes for you.
Thanks!
rolandtannous commentedon Oct 23, 2025
Will be closing this for now as the issue has been resolved. Please make sure to follow the instructions given in my last response.
Meanwhile , please feel free to respond if you're still having any issues.
Thank you
youngs099 commentedon Oct 24, 2025
Thanks for the update!
I’m currently using llama.cpp to load the text model and the mmproj model separately for VQA.
As mentioned in the July 3 comment,
unsloth/gemma-3-12b-it-qat-GGUF:Q4_K_M cannot run on Ollama because it includes two separate GGUF files (mmproj and model), while Ollama requires them to be fused into a single GGUF file.
I tried the updated conversion method to generate a Q4_K_M quantized version, but it still outputs two GGUF files.
Even after quantization, Ollama still cannot perform VQA.
Could I please ask if there is currently a way (or a planned option) to fuse the mmproj and model into a single GGUF file, so that the model can be used for VQA in Ollama?
Thanks again for your great work!
georgy7 commentedon Apr 11, 2026
I have the same issue with https://huggingface.co/unsloth/Qwen3.5-27B-GGUF
My Modelfile (modified
ollama show qwen3.5:27b --modelfile):Output of
ollama show qwen-27b-iq4xs:ollama version is 0.19.0
xyehya commentedon Apr 12, 2026
@georgy7 try this:
https://github.com/xyehya/ollama-gguf
georgy7 commentedon Apr 12, 2026
@xyehya It worked perfectly! The iq4_XS model is slightly larger after the fix, but it is still smaller than the official q4_K_M.
ollama show qwen27-iq4:xyehya commentedon Apr 12, 2026
@georgy7 glad to hear it worked!
yes it is larger because the vision layers have been reinjected into the model. If you want to reduce VRAM usage, try setting kv cache to q8_0 in ollama configurations if not already or reduce the ctx size. having it fit 100% on GPU will make life much better!