Support converting hybrid models to/from HF#699
Conversation
Implements tied LM head & word embeddings for Qwen3. The three sizes that Qwen ships tied (0.6B, 1.7B, 4B) now default to tying; 8B/14B/32B stay untied. The HF import path is tie-aware.
…on Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1b021a4 to
8085766
Compare
…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>
|
@codex review |
There was a problem hiding this comment.
💡 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".
| if config.model_type == "olmo_hybrid": | ||
| return convert_hybrid_state_to_hf(olmo_core_state, _hybrid_layer_types_from_config(config)) |
There was a problem hiding this comment.
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 👍 / 👎.
| hf_config = AutoConfig.from_pretrained(model_id) | ||
| hf_model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32) |
There was a problem hiding this comment.
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 👍 / 👎.
…id-dpo-conversion
No description provided.