fix: correct gpt-oss Ollama generation prompt and add quantization wa… (#4087)
* Warn when save_pretrained_gguf overrides quantization to MXFP4 for GPT-OSS GPT-OSS only supports MXFP4 format. If the user passes a different quantization_method, log a warning via logger.warning_once before overriding. Pass quantization_method=None to suppress the warning. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Daniel Han <danielhanchen@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
78963ca19c
commit
30fac638ad
1 changed files with 14 additions and 0 deletions
|
|
@ -1925,6 +1925,20 @@ def unsloth_save_pretrained_gguf(
|
|||
arguments["push_to_hub"] = False # We handle upload ourselves
|
||||
# GPT-OSS needs mxfp4 save method
|
||||
if is_gpt_oss:
|
||||
if quantization_method is not None:
|
||||
_qm = (
|
||||
quantization_method
|
||||
if isinstance(quantization_method, (list, tuple))
|
||||
else [quantization_method]
|
||||
)
|
||||
_ignored = [q for q in _qm if str(q).lower() != "mxfp4"]
|
||||
if _ignored:
|
||||
logger.warning_once(
|
||||
f"Unsloth: GPT-OSS does not support GGUF quantization "
|
||||
f"(requested: {', '.join(str(q) for q in _ignored)}). "
|
||||
f"Overriding to MXFP4 format. "
|
||||
f"Pass quantization_method=None to suppress this warning."
|
||||
)
|
||||
arguments["save_method"] = "mxfp4"
|
||||
else:
|
||||
arguments["save_method"] = "merged_16bit"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue