Repository navigation
Description
When calling model.save_pretrained_gguf(), the function appears to run to completion but does not generate the expected modelfile in the output directory.
if True: # Change to True to save to GGUF
save_path = "/content/drive/MyDrive/model/gemma3/gemma-3-finetune"
model.save_pretrained_gguf(
save_path,
quantization_type = "f16", # For now only Q8_0, BF16, F16 supported
)
Unsloth: Updating system package directories
Unsloth: Install GGUF and other packages
Unsloth GGUF:hf-to-gguf:Loading model: gemma-3-finetune
Unsloth GGUF:gguf.gguf_writer:gguf: This GGUF file is for Little Endian only
Unsloth GGUF:hf-to-gguf:Exporting model...
Unsloth GGUF:hf-to-gguf:gguf: loading model weight map from 'model.safetensors.index.json'
Unsloth GGUF:hf-to-gguf:gguf: loading model part 'model-00001-of-00002.safetensors'
Unsloth GGUF:hf-to-gguf:token_embd.weight, torch.bfloat16 --> F16, shape = {2560, 262208}
Unsloth GGUF:hf-to-gguf:gguf: loading model part 'model-00002-of-00002.safetensors'
Unsloth GGUF:hf-to-gguf:output_norm.weight, torch.bfloat16 --> F32, shape = {2560}
Unsloth GGUF:hf-to-gguf:Set meta model
Unsloth GGUF:hf-to-gguf:Set model parameters
Unsloth GGUF:hf-to-gguf:Set model tokenizer
Unsloth GGUF:gguf.vocab:Setting special token type bos to 2
Unsloth GGUF:gguf.vocab:Setting special token type eos to 106
Unsloth GGUF:gguf.vocab:Setting special token type unk to 3
Unsloth GGUF:gguf.vocab:Setting special token type pad to 0
Unsloth GGUF:gguf.vocab:Setting add_bos_token to True
Unsloth GGUF:gguf.vocab:Setting add_eos_token to False
Unsloth GGUF:gguf.vocab:Setting chat_template to {{ bos_token }}
{%- if messages[0]['role'] == 'system' -%}
{%- if messages[0]['content'] is string -%}
{%- set first_user_prefix = messages[0]['content'] + '
' -%}
{%- else -%}
{%- set first_user_prefix = messages[0]['content'][0]['text'] + '
..... Chat template truncated .....
Unsloth GGUF:hf-to-gguf:Set model quantization version
Unsloth GGUF:gguf.gguf_writer:Writing the following files:
Unsloth GGUF:gguf.gguf_writer:/content/drive/MyDrive/model/gemma3/gemma-3-finetune.F16.gguf: n_tensors = 444, total_size = 7.8G
Unsloth: GGUF conversion: 100%
100/100 [00:42<00:00, 2.83it/s, 7.76G/7.76G]
Unsloth GGUF:hf-to-gguf:Model successfully exported to /content/drive/MyDrive/model/gemma3/
Unsloth: Converted to /content/drive/MyDrive/model/gemma3/gemma-3-finetune.F16.gguf with size = 7.8G
Unsloth: Successfully saved GGUF to:
/content/drive/MyDrive/model/gemma3/gemma-3-finetune.F16.gguf
Activity
hcstubbe commentedon Mar 30, 2025
you can get the Modelfile like this within the python script (note: you need to add the location of the .gguf file):
tokenizer._ollama_modelfileif this does not work, you should be able to use the template from ollama like so (with ollama installed and using bash):
ollama show --modelfile gemma3 >> Modelfilerolandtannous commentedon Oct 15, 2025
@asdfwqfu @hcstubbe
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)
This should now work.
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
thewh1teagle commentedon Dec 26, 2025
The issue still persist
rolandtannous commentedon Dec 26, 2025
@thewh1teagle would appreciate if you can open a new github issue and provide your unsloth/unsloth-zoo versions, which environment are you running this in? which model ? and what is the exact stack trace you are getting?
thanks
MXFP4 torch decode fallback: run ldexp on the operands' GPU (#16062)