Repository navigation
Native quant tests: make peft see torchao as absent when the test blocks it - #16704
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
Summary
studio/backend/tests/test_diffusion_native_quant.py::test_peft_wrapped_base_layer_runs_nativedepends on test order. It failed twice in a row in(Python 3.13, a-f)on the staging runs for #16687, which only touchesdiffusion_multigpu.pyand its own test:The test calls
_block_torchao, which setssys.modules["torchao"]andsys.modules["torchao.quantization"]toNoneto prove the native path never touches torchao. Then it injects a LoRA with peft. peft's LoRA dispatcher only importstorchao.quantizationifpeft.import_utils.is_torchao_available()says yes, and that function islru_cached for the whole process. When an earlier test in the same xdist worker has already asked it with torchao installed, the cachedTruesends the dispatcher straight into the import the test blocked. Run alone, or in a worker where nothing asked first, the test passes. That is why it shows up only for some shard layouts, and #16687's added test file happens to produce one.The product code is fine. With torchao really missing,
is_torchao_available()isFalsefrom the start. Only the test's simulation was incomplete: it hid torchao from imports but not from peft's cached probe.Change
studio/backend/tests/test_diffusion_native_quant.py,_block_torchaoonly. While torchao is blocked, it also pointsis_torchao_availableinpeft.import_utilsandpeft.tuners.lora.torchaoatlambda: False, throughmonkeypatch, so peft treats torchao as absent and the patch is undone after the test. A module peft has not loaded yet is left alone.test_diffusion_native_quant_mps.pyhas its own_block_torchaobut never calls peft, so it is unchanged.Testing
A one-line test that calls
peft.import_utils.is_torchao_available()first stands in for the earlier test in the worker:tests/test_diffusion_native_quant.pyplustests/test_diffusion_native_quant_mps.py: 188 passed, 14 skipped.