You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error when saving finetuned Gemma3: save_to_gguf_generic() got an unexpected keyword argument 'quantization_method' #2209
This issue appears to be a duplicate of [(https://github.com//issues/1504)]. But thanks for reporting, that also Gemma3 is affected.
For vision models, the actual function which is called with save_pretrained_gguf is the following:
def save_to_gguf_generic(
model,
save_directory,
quantization_type = "Q8_0",
repo_id = None,
token = None,
)
quantization_method becomes quantization_type, the tokenizer is not an argument.
@mischaelschill you got it working? I've tried to use save_to_gguf_generic but it complains RuntimeError: Unsloth: config.jsondoes not exist insidelora_model_v2. I assume I have to merge model first?
Yes. I just called model.save_pretrained_gguf(dir_path, quantization_type="f16")
However, it only supports b/f16, f32, and q8_0, not q4_k_m, so the output is big. Also, it is split, so it needs to be merged before it can be used with ollama, and there is no Modelfile.
I had the issue with mistral-smalll-3.1, I do not know whether it works with gemma-3
Yes. I just called model.save_pretrained_gguf(dir_path, quantization_type="f16")
However, it only supports b/f16, f32, and q8_0, not q4_k_m, so the output is big. Also, it is split, so it needs to be merged before it can be used with ollama, and there is no Modelfile.
I had the issue with mistral-smalll-3.1, I do not know whether it works with gemma-3
@mischaelschill you got it working? I've tried to use save_to_gguf_generic but it complains RuntimeError: Unsloth: config.jsondoes not exist insidelora_model_v2. I assume I have to merge model first?
Are you able to resolve this? I am facing the similar issue with qwen2
@mischaelschill you got it working? I've tried to use save_to_gguf_generic but it complains RuntimeError: Unsloth: config.jsondoes not exist insidelora_model_v2. I assume I have to merge model first?
Are you able to resolve this? I am facing the similar issue with qwen2
TypeError: save_to_gguf_generic() got an unexpected keyword argument 'quantization_method'
Traceback (most recent call last):
File "/home/user/project/train/train.py", line 184, in <module>
main()
File "/home/user/project/train/train.py", line 168, in main
model.push_to_hub_gguf(
File "/home/user/.local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
TypeError: save_to_gguf_generic() got an unexpected keyword argument 'quantization_method'
For vision/multimodal models, use tokenizer=processor
3- You can pass it one or several quant methods (as a list):
quantization_method = "q8_0"
or
quantization_method = ["q8_0", "q4_k_m"]
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 Modelfile for you that you can use to create your model in ollama using:
ollama create model_name -f ./Modelfile
5- Use push_to_hub_gguf if 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 solve your problems while saving to GGUF.
Let me know how it goes for you.
Activity
quissuiven commentedon Mar 28, 2025
I'm encountering the same error! I'm trying to convert my fine-tuned QwenVL 2.5 7B to gguf
weoieoeo commentedon Mar 28, 2025
This issue appears to be a duplicate of [(https://github.com//issues/1504)]. But thanks for reporting, that also Gemma3 is affected.
ggeo commentedon Apr 4, 2025
I got the exact same error using:
model.save_pretrained_gguf("./data/model_final_4", tokenizer, quantization_method = "q4_k_m")I used gemma model for training:
"unsloth/gemma-3-4b-it-unsloth-bnb-4bit"phiwi commentedon Apr 7, 2025
Any fix/workaround for this?
mischaelschill commentedon Apr 9, 2025
For vision models, the actual function which is called with save_pretrained_gguf is the following:
def save_to_gguf_generic(
model,
save_directory,
quantization_type = "Q8_0",
repo_id = None,
token = None,
)
quantization_method becomes quantization_type, the tokenizer is not an argument.
pySilver commentedon Apr 9, 2025
@mischaelschill you got it working? I've tried to use save_to_gguf_generic but it complains
RuntimeError: Unsloth:config.jsondoes not exist insidelora_model_v2.I assume I have to merge model first?mischaelschill commentedon Apr 9, 2025
Yes. I just called model.save_pretrained_gguf(dir_path, quantization_type="f16")
However, it only supports b/f16, f32, and q8_0, not q4_k_m, so the output is big. Also, it is split, so it needs to be merged before it can be used with ollama, and there is no Modelfile.
I had the issue with mistral-smalll-3.1, I do not know whether it works with gemma-3
fish4terrisa-MSDSM commentedon Apr 10, 2025
Also got the the same error with olmo2.
AbhayaHanuma commentedon Apr 19, 2025
Are you able to resolve this? I am facing the similar issue with qwen2
fish4terrisa-MSDSM commentedon Apr 19, 2025
A quick fix:
change these lines:
unsloth/unsloth/save.py
Lines 2503 to 2504 in 73d6fb2
to
(At least it worked for me :))
kholiavko-roman commentedon Jun 27, 2025
Still having the same issue on
unsloth/gemma-3-1b-it-unsloth-bnb-4bitbehroozazarkhalili commentedon Jul 19, 2025
The issue persists. Could you please reopen it and work towards a resolution?
ColaborKaggleor local / cloud: Remote Servernvidia-smi: 1rolandtannous commentedon Oct 15, 2025
@FierceHero @chrisjohnson00 @ejektaflex @fish4terrisa-MSDSM @ggeo @kholiavko-roman @mischaelschill @phiwi @pySilver @quissuiven @weoieoeo @yaneivan
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 solve your problems while saving to GGUF.
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