Skip to content

GGUF export: keep remote_code_approved out of the save_pretrained kwargs - #17404

Merged
danielhanchen merged 1 commit into
mainfrom
fix-gguf-remote-code-kwarg
Nov 10, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-gguf-remote-code-kwarg

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

#17397 added a remote_code_approved local to unsloth_save_pretrained_gguf (read before the processor is unwrapped, so the converter follows the load's trust_remote_code decision). That function snapshots its locals with arguments = dict(locals()) and forwards them to unsloth_generic_save(**arguments), deleting every local that is not a save kwarg. The new local was never deleted, so every merged GGUF export on main now fails before the merge:

RuntimeError: Failed to save/merge model: TypeError: unsloth_generic_save() got an unexpected keyword argument 'remote_code_approved'

This adds the one missing del arguments["remote_code_approved"], next to the other local-only names. The value is still read later by _gguf_converter_remote_code(remote_code_approved), so #17397's behaviour is unchanged.

Why CI did not stop it

The existing guard tests/test_gguf_model_basename.py::test_helper_is_module_level_and_adds_no_locals_to_the_gguf_entrypoint catches exactly this and fails on main. #17397's own CI runs were cancelled rather than failed, so the guard never reported on it. Every PR based on main since then fails:

  • Repo tests (CPU, rest): the guard above
  • Repo tests (CPU, fsdp2): test_gguf_runs_on_rank0_only_from_the_same_merge, test_push_to_hub_gguf_uploads_from_rank0_only, test_a_rank0_failure_raises_on_every_rank in tests/test_fsdp2_exports_gloo.py, which run a real export end to end

Testing

  • tests/test_gguf_model_basename.py: 1 failed on main, all 61 pass with the fix
  • tests/test_fsdp2_exports_gloo.py GGUF cases plus the guard: 64 passed with the fix

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T14:07:16.607865Z a8079a6 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: a8079a6b84

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 8049c61 into main Nov 10, 2026
@danielhanchen
danielhanchen deleted the fix-gguf-remote-code-kwarg branch November 10, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant