Repository navigation
Conversation
A CPU loader regression test on the synced #152 tree reproduced a division-by-zero panic for num_attention_heads=0 without head_dim. Return a field-specific error before division; cover the 1024 family and Vela 0.3B HF layouts with derived and explicit head dimensions. Preserve all positive-profile geometry and numerical assertions.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Required human contributor answers
The contributor confirmed this stage on 2026-11-20: synchronize the existing Vela ModernBERT PR with main and validate its CPU structure/loader contracts, preserving the original author's work. The shared contributor intent was confirmed on 2026-11-19 and remains applicable; detailed confirmation is retained in the contributor's task record. Public parent context: #137 and #152.
Is a PR needed? Yes. The contributor authorized necessary small supplements and stage draft PRs while preserving others' commits. A real CPU loader failure was reproduced here.
Bug-fix evidence: On base
90a1beff, the new integration test fails withadapter.rs:90:13: attempt to divide by zero. The same command passes after this guard. Reproduction and verbatim excerpts are below.Purpose
Reject
num_attention_heads: 0as a field-specific configuration error before derivinghidden_size / num_attention_heads. Without an explicithead_dim, the adapter currently panics before structure validation can reject the input.This is a 2-file, +21-line stacked supplement, based on
codex/vela152-main-sync-20261120at90a1beff35e4a8228593ae166073d8c7af9ce46d. That base preserves MrDongsls's #152 head022c62afand mainf1e674f2as its two parents. Its sole manual merge resolution unions the workspace members in root Cargo.toml; Cargo.lock is auto-merged. Qwen ABI stays 9.The base carries the original 74-file implementation so this draft's review diff stays limited to the guard and regression. Integration into main requires #152 to land, followed by retargeting and fresh checks. No changes were pushed to the author's branch.
Summary
derive_head_dim(hidden, heads, config) + reject heads == 0 with num_attention_heads error derive or parse head_dim validate the complete structureThe root integration test covers the 1024-wide family fixture and Vela 0.3B fixture, each with derived and explicit head_dim. Existing golden fixtures, geometry, checkpoint census, precision classes and numerical tolerances are unchanged.
Evidence
Run from the repository root on Linux, with Rust 1.100.0 and no weights or GPU:
cargo test --locked -p omni-modernbert --test structure \ zero_attention_heads_is_rejected_without_panicking -- --exact --nocaptureBefore, base plus only the regression test:
After, head
a11335aeed99d30ebdef123d673b569eb8a1c299:Test Plan
CPU-only on the L20 host, Rust 1.100.0, private cargo-home/target/Python environments; CUDA_VISIBLE_DEVICES empty. Dependencies came from verified local caches; Cargo checks used --locked --offline. No checkpoint download, forward pass or GPU execution.
cargo fmt --all --checkcargo clippy --workspace --locked --all-targets --features omni-laya/serve -- -D warningscargo test --workspace --locked --features omni-laya/servecargo build --workspace --release --locked --features omni-laya/serveTest Result
The first full workspace run failed the unchanged JEV-VL test
stats_and_prefix_publication_finish_concurrentlyat its 10-second timeout. It subsequently passed in isolation on exact main (0.69 s) and this candidate (0.62 s); one serialized full-workspace retry passed. The original failure is retained; its cause remains unclassified and the timeout was not changed.The initial docs attempt used a Python environment without MkDocs; that failure is retained. The final strict build used the existing independent docs environment, without installing or modifying shared packages.
Demo / evidence
The before/after CPU regression above is the evidence for this patch. Original Laya golden plans and the 20-configuration mock launch-trace comparison pass; these checks do not establish device numerical parity. The pinned Vela census (134 encoder + 18 head tensors) and YaRN assertions pass without fixture regeneration.
The Vela cuda-feature command reports 13 ok, but its one device test explicitly early-returns without VELA_NATIVE_CHECKPOINT/VELA_NATIVE_LIBRARY: 12 CPU checks, device execution unrun. L20 is sm_89 while the inherited bundle requires sm_90a; no L20 native Vela result is claimed. Historical H100 evidence belongs to its recorded source.
Raw logs, failures, source bundles, hashes and the component review map remain in the contributor-local/L20 evidence archive; there is no public raw-archive URL. The repository test and excerpts above are independently reproducible. Performance A/B and video are N/A for this invalid-config guard. The complete original #152 implementation still requires its own large-change and hardware review.
Merge Danger
Door: two-way; ordinary revert, no stored-data migration.
Blast Radius: loader.
Only malformed zero-head ModernBERT configurations change from panic to error. Valid structures retain their existing parsing, geometry and execution plans.
Self-review
Agent precheck reviewed the complete 21-line supplement, the caller through Vela read_structure, root test discovery, artifact placement and the unchanged positive-profile gates. No blocking finding was identified for this small guard. The full parent PR, future decoder path/crate integration and target-hardware qualification remain separate. Keep draft for contributor/maintainer review.