Skip to content

FP8 ragged block test: unwrap unsloth-zoo partial-block patch for the stock baseline - #17808

Merged
danielhanchen merged 1 commit into
mainfrom
fix-fp8-ragged-test-zoo-patch
Nov 15, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-fp8-ragged-test-zoo-patch

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

tests/test_fp8_ragged_block_dequant.py::test_ragged_rows_match_block_reference[glm5_3] and [ling3] fail in Repo tests (CPU, rest) on every PR whose CI installs unsloth-zoo at or after 898a6b0d (unslothai/unsloth-zoo#2515). Seen on #17725 and #17801:

tests/test_fp8_ragged_block_dequant.py:74: in test_ragged_rows_match_block_reference
    with pytest.raises(ValueError):
E   Failed: DID NOT RAISE ValueError

unsloth-zoo#2515 now patches Fp8Dequantize._dequantize_one on import to dequantize partial edge blocks correctly. Its wrapper is marked _unsloth_partial_block_patched and keeps the stock function in _unsloth_original. This test's "unpatched" baseline only unwrapped unsloth's own ragged-block wrapper (_unsloth_ragged_blocks / __wrapped__). So the baseline was actually the zoo-fixed op, and the expected stock ValueError never came. The zoo patch is correct; the test's notion of "unpatched" was too narrow.

Changes (test only)

  • _op_cls(patched=False) unwraps both markers, so the baseline is transformers' own op again.
  • test_unpatched_op_carries_no_unsloth_wrapper pins that the baseline has no unsloth or unsloth-zoo wrapper left. The ValueError assertion only means something against the stock op.
  • test_ragged_padding_composes_over_the_zoo_partial_block_patch covers the real-world case, where both patches are live in one process. It stacks unsloth's ragged padding on top of the zoo partial-block patch and checks the block reference for 576x384, 576x2560 and stacked 2x256x200 experts. It skips when the zoo module is absent.

Verification

unsloth-zoo before after
0c225609 (before #2515) 6 passed 7 passed, 1 skipped (no zoo patch module)
c8655b99 (main) 2 failed, 4 passed 8 passed
c8655b99, zoo patch applied explicitly first 2 failed, 4 passed 8 passed
main, with the new unwrap branch removed 3 failed (the two reference cases and the new baseline guard)

…he stock baseline

unsloth_zoo #2515 patches Fp8Dequantize._dequantize_one on import (_unsloth_partial_block_patched /
_unsloth_original). The test's unpatched baseline only unwrapped unsloth's own ragged-block wrapper, so it
ran the zoo-fixed op and pytest.raises(ValueError) failed. Unwrap both markers, pin that the baseline is
transformers' own op, and check the two patches stacked still match the block reference.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T09:57:32.577412Z d38fe47 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: d38fe47615

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

@danielhanchen
danielhanchen merged commit c34a1d3 into main Nov 15, 2026
@danielhanchen
danielhanchen deleted the fix-fp8-ragged-test-zoo-patch branch November 15, 2026 10:00
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 16, 2026
Final comment pass for recently merged PRs.

Trims comments added by unslothai#17660, unslothai#17806, unslothai#17807, unslothai#17808, unslothai#17812, unslothai#17830,
unslothai#17854, unslothai#17857 and unslothai#17870 that are still on main.
Multi-line explanations are collapsed to one line, and comments that
restate the code are removed.
Comments that explain a version quirk or a correctness trap are kept,
along with license headers and pragmas.
Changed comment lines: unslothai#17660 5 -> 2, unslothai#17806 4 -> 2, unslothai#17808 1 -> 0,
unslothai#17830 3 -> 1, unslothai#17857 1 -> 0. unslothai#17807, unslothai#17812, unslothai#17854 and unslothai#17870 are
unchanged.
Overall: 6 files, 14 lines removed, 5 added. Only comments change: the
AST check (comment_tools.py check) and the pre-push gate both pass.
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.

1 participant