Repository navigation
[BUGFIX] Respect main-process gating during PEFT exports - #18686
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
… full-model saves honour the FSDP2 gather [skip ci]
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
pre-commit.ci run |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Problem: Under plain DDP, PEFT merged saves (
unsloth_generic_save) and GGUF saves (unsloth_save_pretrained_gguf) ignoredis_main_process=False, and merged/GGUF Hub pushes (push_to_hub_gguf,push_to_hub_merged,save_pretrained_merged(push_to_hub=True)) ran merging, conversion, and Hub uploads on every rank.Fix: Added
is_main_processgating (with anfsdp2_gather_active()escape so FSDP2 sub-mesh writers are never vetoed) tounsloth_save_pretrained_gguf,unsloth_push_to_hub_gguf,_push_merged_to_hub_revision, and the PEFT merged branch ofunsloth_generic_save. Added_ddp_push_on_rank0using_plain_data_parallel_push+tp_world_pushonunsloth_push_to_hub_gguf,unsloth_generic_push_to_hub_merged, andunsloth_generic_save_pretrained_mergedso plain DDP uploads run on rank 0 without intercepting FSDP1/FSDP2 collectives or local saves.Tests: Added
tests/test_peft_export_main_process.py(11 CPU tests with mockedtorch.distributed) and rantest_hub_push_rank0_ddp_gloo.py,test_local_save_tokenizer_ddp_gloo.py,test_fsdp2_save_coverage.py,test_save_method_lora_routing.py,test_merged_hub_destination.py,test_public_api_surface.py,test_st_save_merged_signature.py,test_fsdp2_save_args.py,test_export_api_surface.py, andtest_ci_repo_cpu_shards.py(245 passed, 1 skipped). Multi-GPU NCCL DDP/FSDP2 runs were not executed locally.Follow-ups on this branch:
_defer_to_main_process, gates every export, so the GGUF path no longer forwards a stray local tounsloth_generic_save(TypeError inside an FSDP2 gather).revision/create_pr) runs as the elected writer, so a sub-mesh writer uploads the model files, not only the README.merged_4bit/merged_4bit_forcedstill run on every DDP replica, since they merge into the live model; every other method exports from rank 0 alone.