Skip to content

Support converting hybrid models to/from HF#699

Draft
finbarrtimbers wants to merge 11 commits into
mainfrom
finbarr/hybrid-dpo-conversion
Draft

Support converting hybrid models to/from HF#699
finbarrtimbers wants to merge 11 commits into
mainfrom
finbarr/hybrid-dpo-conversion

Conversation

@finbarrtimbers

Copy link
Copy Markdown
Collaborator

No description provided.

@finbarrtimbers
finbarrtimbers changed the base branch from main to finbarr/fix-conversion June 2, 2026 14:36
@finbarrtimbers
finbarrtimbers force-pushed the finbarr/hybrid-dpo-conversion branch from 1b021a4 to 8085766 Compare June 5, 2026 15:54
…lt 'default'); set 'none' to skip torch's recompute metadata check for opaque linear-attention kernels under torch.compile Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Base automatically changed from finbarr/fix-conversion to main June 12, 2026 00:53
@farhatkevin

Copy link
Copy Markdown
Contributor

@codex review

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

Copy link
Copy Markdown

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: 76c239cab3

ℹ️ 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 on lines +548 to +549
if config.model_type == "olmo_hybrid":
return convert_hybrid_state_to_hf(olmo_core_state, _hybrid_layer_types_from_config(config))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Support the plain hybrid config dict

When callers use the hybrid config shape that this package itself writes (get_hybrid_hf_config() returns a plain dict for config.json), the new generic hybrid dispatch fails here with AttributeError: 'dict' object has no attribute 'model_type' before it can call convert_hybrid_state_to_hf. That makes the advertised convert_state_to_hf hybrid path unusable for configs loaded back from saved hybrid checkpoints unless users first wrap the dict in an object.

Useful? React with 👍 / 👎.

Comment on lines +305 to +306
hf_config = AutoConfig.from_pretrained(model_id)
hf_model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep HF roundtrip test offline

This test is included in the normal Test job (.github/workflows/main.yml runs src/test/ and does not exclude src/test/nn/hf), so every PR now tries to download and instantiate the Qwen and Gemma checkpoint weights from Hugging Face. In CI contexts without network/secrets or under the 15-minute job timeout, this can fail the whole unit-test matrix for reasons unrelated to the conversion code; use tiny local configs/states or mark this as an explicit integration/slow test.

Useful? React with 👍 / 👎.

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.

4 participants