Repository navigation
Conversation
Merge Protections🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI
🔴 PR merge requirementsWaiting for
This rule is failing.
|
|
Tick the box to add this pull request to the merge queue (same as
|
|
@fv-superagent review |
[Medium impact] The documentation follow-up appears safe to merge, with no new blocking issues found.
|
There was a problem hiding this comment.
fv-superagent score: 3/5
The core fix is right: tracing the adapter state machine, the reported 34 → 30 → 30 sequence becomes 34 → 34 → 34, and the accumulated history survives unmerge. Two state-machine bugs and two small follow-ups remain.
Must fix
fastvideo/layers/lora/linear.py:294— a layer that an accumulated adapter skips keeps its earlier adapter but getsdisable_lora=True(fastvideo/pipelines/lora_pipeline.py:737). The next accumulated adapter on that layer hits the newnot self.disable_loraguard and calls_reset_to_base_weight(), dropping the earlier adapter. Sequence: load A over layers 1+2 → accumulate B over layer 1 only → accumulate C over layer 2 only → layer 2 ends at C alone instead of A+C.maingets A+C here, so this is a regression. Decide "already has contributions" from the layer state (self.merged/self._active_loras), notdisable_lora: a layer unmerged by a replacement must still reset, an actively merged-then-skipped layer must not. Add the three-adapter sequence tofastvideo/tests/pipelines/test_lora_adapter_switch.py(the existing two-adapter test stops before the reset).fastvideo/layers/lora/linear.py:346—merge_lora_weights()calls_reset_to_base_weight()(which clears_active_loras) before replaying. If one contribution fails — a CUDA OOM in the matmul is enough — the method exits with history gone and the weight partially merged. A retry then replays only the current adapter; a snapshot-free (unified-memory) layer additionally raisesno unmerge snapshoton the next reset._restore_merged_weightalready guards this with atry/except; make the replay path keep the previous weight and_active_lorasuntil the whole replay succeeds, and test a failure part-way through the loop (the analogousset_lora_weightspath already has such a test).
Should fix
fastvideo/tests/inference/lora/test_merge_lora_math.pyis collected by no lane:unit_test.shliststests/inference/test_basic_*but notinference/lora/, and.buildkite/scripts/lanes/inference_lora.sh:6collects onlytest_lora_inference_similarity.py. The issue's scalar34 → 30 → 30regression test therefore does not guard the fix (the lifecycle coverage intest_lora_side_branch.pyandtest_nvfp4_lora_accumulation.pydoes run). Add the file tounit_test.shor the lane script — one line.docs/inference/h3_community_lora.md:99still says "Unmerging multiple accumulated adapters currently drops earlier contributions from inference (#2096)". That is the bug this PR fixes, so the doc now contradicts the code.
Nits
fastvideo/tests/inference/lora/test_merge_lora_math.py:78— Greptile's P2 asks for this arithmetic comment to go. I would keep it:34is otherwise a magic number and the line documents the invariant. Not a blocker either way.fastvideo/layers/lora/linear.py:458—_clear_lora_history()resets_active_lorasand the staged buffers but not_merged_loras. Both call sites happen to have_merged_loras == []already becauseunmerge_lora_weights()ran first, so this is latent; resetting them together would be safer.- PR body: the staged historical factors are described as "registered, frozen parameters"; the code uses non-persistent buffers (
OffloadableBufferList), which the tests assert stay out ofstate_dict/named_parameters.
CI is green at 91a3f21 (fastcheck build 2451), and the CUDA-gated offload and Inductor tests did run in microscope-unit-tests and pass, so those paths are covered.
— fv-superagent · The first adapter would like it on the record that it was here. · run by aryan5v
fv-superagent
left a comment
There was a problem hiding this comment.
fv-superagent score: 4/5 (was 3/5)
Both round-1 P1s are fixed; the code reads correctly now.
set_lora_weightsdecides fromself._active_loras(fastvideo/layers/lora/linear.py:293), and the pipeline keepsdisable_lora=Falsewhile a skipped layer still holds contributions (fastvideo/pipelines/lora_pipeline.py:739), so an earlier adapter survives a skipping accumulation. The new three-adapter tests intest_lora_adapter_switch.pycover skipped-then-covered, skipped-then-replaced, and replace-after-skip.merge_lora_weightsnow replays through_replay_lora_contributions(linear.py:353), which restores the base layer, weight tensor and history on any failure;test_failed_merge_part_way_keeps_previous_weight_and_historycovers snapshot and snapshot-free, merged and unmerged.- Also addressed:
test_merge_lora_math.pyis wired intounit_test.sh, the flagged test comments are gone, and_clear_lora_historyre-points_merged_loras.
One item left, docs-only:
docs/inference/h3_community_lora.md:100still says "Unmerging multiple accumulated adapters currently drops earlier contributions from inference (#2096)". That is exactly the behavior this PR fixes, so the sentence is now false. Please update or remove it — that sentence is the only reason this is still changes-requested.
Nit: the PR body still calls the staged factors "registered, frozen parameters" (they are non-persistent buffers) and still quotes the round-1 307 passed numbers.
CI: build, pre-commit and buildkite/pr-fastcheck were still running at 5e28593 when this was written; I will confirm the result separately. Greptile's re-review had not finished either.
— fv-superagent · The adapters are back together. The docs haven't heard the news. · run by aryan5v
|
@aryan5v hey i would like to request a review! |
fv-superagent
left a comment
There was a problem hiding this comment.
fv-superagent score: 5/5 (was 4/5)
79c490d removes the stale #2096 note from docs/inference/h3_community_lora.md, so every item from my earlier reviews is addressed. I have dismissed those two change requests.
- Both state-machine P1s are fixed and covered by tests (
test_lora_adapter_switch.py,test_lora_side_branch.py). test_merge_lora_math.pyis wired intounit_test.sh.- Greptile's round-2 review marked both P1s fixed; its one remaining P2 points at a comment that no longer exists — the only comment left in that file is the
# Issue #2096link, which is on its keep-list.
CI on 79c490d: build and pre-commit are green. buildkite/pr-fastcheck has been stuck scheduled since 2026-11-20 (build 2467), and recent fastcheck builds on other PRs (2457, 2460, 2465, 2468) are stalled the same way — the lane is down repo-wide, not on this change. The code is reviewed and the author's local suite passed, but the lane still has to run before this merges.
— fv-superagent · Buildkite has been "scheduled" for two days. I'm starting to think it's a lifestyle. · run by aryan5v
Purpose
Fixes #2096.
Accumulating multiple LoRA adapters previously preserved their combined contribution only while merged. Unmerging and remerging silently dropped every adapter except the latest.
For the issue’s BF16 example, this changes the outputs from
34 → 30 → 30to34 → 34 → 34.Changes
The change retains the existing training framework, quantization kernels, and public accumulation behavior.
Test Plan
Earlier revisions were validated locally on macOS arm64. The latest CPU rerun attempt used Python 3.12.1 and PyTorch 2.4.0; see the result below.
Targeted LoRA suite command, including CPU training and offload ownership checks:
/tmp/fastvideo-2096-venv/bin/python -m pytest \ fastvideo/tests/inference/lora/test_merge_lora_math.py \ fastvideo/tests/layers/test_lora_merge_precision.py \ fastvideo/tests/layers/test_lora_side_branch.py \ fastvideo/tests/ops/quantization/test_nvfp4_lora_accumulation.py \ fastvideo/tests/ops/quantization/test_nvfp4_minimax_h3_wiring.py \ fastvideo/tests/loader/test_h3_community_lora.py \ fastvideo/tests/loader/test_lora_patch.py \ fastvideo/tests/pipelines/test_lora_adapter_switch.py \ fastvideo/tests/pipelines/test_lora_lazy_reload.py \ fastvideo/tests/pipelines/test_lora_sequential_load.py \ fastvideo/tests/pipelines/test_lora_late_transformer.py \ fastvideo/tests/entrypoints/test_openai_lora.py \ fastvideo/tests/train/models/test_minimax_h3_lora.py \ fastvideo/tests/train/utils/test_lora.py \ fastvideo/tests/train/utils/test_lora_fsdp.py \ fastvideo/tests/train/utils/test_dcp_to_diffusers_lora_names.py \ fastvideo/tests/train/utils/test_dcp_to_diffusers_h3.py \ fastvideo/tests/train/utils/test_inference_checkpoint.py \ fastvideo/tests/contract/test_env_policy.py \ fastvideo/tests/hooks/test_layerwise_offload.py \ fastvideo/tests/hooks/test_pinned_memory.py \ -m 'not gpu' -q -ra \ --junitxml=/tmp/fastvideo-2096/cpu-offload-results.xmlTest Results
Local validation results
Latest follow-up (2026-11-20):
pre-commit run --files docs/inference/h3_community_lora.mdpassed all applicable hooks.git diff --checkpassed.conftest.py:ModuleNotFoundError: No module named 'cloudpickle'. No tests ran in this attempt; the earlier revision's totals have been removed.The earlier full pre-commit run passed:
Earlier CPU validation covered:
CUDA-dependent coverage, including the GPU offload and Inductor tests, requires GPU hardware.
The full repository CPU suite, end-to-end GPU training, SSIM, real NVFP4 GPU execution, and GPU memory/latency benchmarks remain outstanding. CPU graph-capture tests do not establish CUDA Inductor or CUDA Graph correctness.
Checklist
pre-commit run --all-filesand fixed all issues.Support-matrix changes, serving YAML, and cookbook deployment updates are not applicable: this fixes the existing adapter lifecycle and introduces no new model or serving runtime.