Skip to content

tests: restore transformers' Fp8Dequantize after the fp8 save policy tests - #14741

Merged
danielhanchen merged 1 commit into
mainfrom
fp8-save-policy-test-isolation
Oct 22, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fp8-save-policy-test-isolation

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

tests/test_fp8_dequant_save_policy.py (#14678) runs real fp8 loads after import unsloth, which patch transformers' Fp8Dequantize (and replace_with_fp8_linear) for the whole process. Any test file that runs later in the same pytest session and expects the unpatched class then fails. On current main:

pytest -o addopts= tests/test_fp8_dequant_save_policy.py tests/test_fp8_ragged_block_dequant.py
FAILED tests/test_fp8_ragged_block_dequant.py::test_ragged_rows_match_block_reference[glm5_3]
FAILED tests/test_fp8_ragged_block_dequant.py::test_ragged_rows_match_block_reference[ling3]

test_fp8_ragged_block_dequant.py alone passes, so this is test isolation only, not a product change.

Change

An autouse fixture in test_fp8_dequant_save_policy.py snapshots the Fp8Dequantize attributes and replace_with_fp8_linear through monkeypatch, so they are restored after every test in the file.

Validation (CPU, CUDA hidden)

pytest -o addopts= -m "not server and not native_mxc" tests/test_fp8_dequant_save_policy.py tests/test_fp8_*.py:

torch main this PR
2.14 2 failed, 176 passed, 219 skipped 178 passed, 219 skipped
2.10 not run 178 passed, 219 skipped

…tests

A real fp8 load patches Fp8Dequantize process-wide, so the ragged block
dequant tests failed (glm5_3, ling3) whenever they ran after this file.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T15:36:33.010448Z e44e4a4 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. Another round soon, please!

Reviewed commit: e44e4a484d

ℹ️ 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 0811e55 into main Oct 22, 2026
@danielhanchen
danielhanchen deleted the fp8-save-policy-test-isolation branch October 22, 2026 15:40
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