Skip to content

Verify HF export at startup; rewrite save_state_dict_as_hf#1671

Merged
finbarrtimbers merged 15 commits into
mainfrom
finbarr/hf-export-verify
May 15, 2026
Merged

Verify HF export at startup; rewrite save_state_dict_as_hf#1671
finbarrtimbers merged 15 commits into
mainfrom
finbarr/hf-export-verify

Conversation

@finbarrtimbers
Copy link
Copy Markdown
Collaborator

@finbarrtimbers finbarrtimbers commented May 8, 2026

Replace olmo-core's save_hf_model path with a direct convert_state_to_hfAutoModelForCausalLM.save_pretrained flow, so HF export reuses the same converter the verifier checks against.

Add verify_can_save_as_hf which builds the olmo-core model and the target HF model on meta, runs the converter, and asserts the produced state-dict keys exactly match the HF model.

finbarrtimbers added a commit that referenced this pull request May 8, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the olmo-core HF saving path with a direct conversion flow, adds startup verification for HF exports, and introduces a pruning mechanism for permanent checkpoints. Feedback identifies a critical AttributeError due to incorrect StateType usage, notes that the checkpoint pruning parameter is not yet propagated through the call stack, and highlights redundant configuration saving logic and an unused parameter.

Comment thread open_instruct/olmo_core_utils.py Outdated
Comment thread open_instruct/olmo_core_utils.py Outdated
Comment thread open_instruct/olmo_core_utils.py Outdated
Comment thread open_instruct/olmo_core_utils.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 905a12faf8

ℹ️ 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".

Comment thread open_instruct/olmo_core_utils.py Outdated
Comment thread open_instruct/olmo_core_utils.py Outdated
…t_state_to_hf; prune permanent checkpoints Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@finbarrtimbers finbarrtimbers force-pushed the finbarr/hf-export-verify branch from 6bfecf1 to 370c2f1 Compare May 11, 2026 18:31
…verrides shim now that upstream handles llama/qwen3/gemma3 norm mappings Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… config save (PR #1671 review) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…o f-string Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@farhatkevin farhatkevin self-requested a review May 14, 2026 18:25
Copy link
Copy Markdown
Contributor

@farhatkevin farhatkevin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me once the merge conflicts are resolved and the stale PruningCheckpointerCallback mention is removed from the changelog.

@finbarrtimbers finbarrtimbers enabled auto-merge May 14, 2026 23:14
@finbarrtimbers finbarrtimbers disabled auto-merge May 14, 2026 23:15
@finbarrtimbers finbarrtimbers enabled auto-merge May 14, 2026 23:21
@finbarrtimbers finbarrtimbers disabled auto-merge May 14, 2026 23:21
@finbarrtimbers finbarrtimbers enabled auto-merge May 14, 2026 23:21
@finbarrtimbers finbarrtimbers added this pull request to the merge queue May 14, 2026
@finbarrtimbers finbarrtimbers removed this pull request from the merge queue due to a manual request May 14, 2026
@finbarrtimbers finbarrtimbers added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit 1bc3178 May 15, 2026
7 checks passed
@finbarrtimbers finbarrtimbers deleted the finbarr/hf-export-verify branch May 15, 2026 13:14
pull Bot pushed a commit to nagyist/allenai.open-instruct that referenced this pull request May 15, 2026
…i#1672)

* Move maybe_evaluate to grpo_utils; dedupe calculate_token_counts Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Verify HF export at startup; rewrite save_state_dict_as_hf via convert_state_to_hf; prune permanent checkpoints Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Update CHANGELOG with PR allenai#1671 link Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* GRPO OLMo-core feature parity: EvalCallback, setup_eval, checkpointer, scheduler types Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Update CHANGELOG with PR allenai#1672 link Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Drop pre-norm Qwen3/Llama OLMo-core->HF override shim; upstream olmo-core now provides these mappings Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Minimize diff: drop PruningCheckpointerCallback, ty:ignore, and unrelated script tweaks Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Unify checkpoint_state_freq disable sentinel: <=0 disables on both grpo_fast and olmo_core paths Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Apply suggestion from @gemini-code-assist[bot]

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update grpo_callbacks.py

* Use keyword args in EvalCallback.post_step's maybe_evaluate call Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Move save_freq/checkpoint_state_freq divergence warning into GRPOExperimentConfig.__post_init__ Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

2 participants