Repository navigation
fix(fused-train-state): rebuild a meta snapshot without running the inverse - #5533
Merged
Merged
Conversation
…nverse Moving a quantized module to `meta` discards the runtime words, so `_rebuild_checkpoint_qweight()` cannot reproduce them: its `aten::equal` identity check has no meta implementation and raises `NotImplementedError: aten::equal: attempted to run this operator with Meta tensors`. A meta tensor carries only shape and dtype, and the snapshot descriptor already knows both, so materialize an empty tensor on that device instead of running the inverse against meta operands. Red: test_kernel_audit_regressions.py::test_device_move_restores_checkpoint_layout [gptqmodel.nn_modules.qlinear.torch_aten_kernel-TorchAtenLinear] and [gptqmodel.nn_modules.qlinear.torch_fused-TorchFusedLinear] fail with the NotImplementedError. Green: test_kernel_audit_regressions.py 82 passed.
Qubitium
marked this pull request as ready for review
November 19, 2026 10:40
Qubitium
added a commit
that referenced
this pull request
Nov 29, 2026
…5325) (#6273) A5 was a product defect, not a stale test: a meta move ran the int4pack inverse (and its aten::equal identity check) against meta operands until #5533 materialized the snapshot from its shape/dtype descriptor. A14 was realigned by #5564, and the compiled entry now stages its operands outside the traced graph (#5955), so the caches are published again. Both items are green at main 2d3261d. Extend the device-move test to assert every checkpoint operand's shape and dtype is restored, not just qweight. Restore the cache expectations the A14 tests are named for: the compiled dequant publishes the g_idx cache on the compute device, load_state_dict clears both metadata caches, and a full forward still matches F.linear after the g_idx offload. Co-authored-by: OpenAI Agent <[email protected]>
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
Moving a quantized module to
metadiscards the runtime words, so_rebuild_checkpoint_qweight()cannot reproduce them. Its checkpoint-layoutidentity check calls
aten::equal, which has no meta implementation:test_device_move_restores_checkpoint_layouthits this forTorchAtenLinearand
TorchFusedLinear.What Changed
_materialize_snapshot_entryreturns an empty tensor on the snapshot'sdevice when the live module's
qweightis already onmeta, instead ofrunning the inverse against meta operands.
RebuiltCheckpointTensordescriptor already knows both, so nothing is lost by not rebuilding.
Tests
The existing
test_device_move_restores_checkpoint_layoutis the regression;it is red without this change and green with it.
Note: the GPU devices were detached from this container before the final
re-run. The 82-passed figure is from the run that had the devices; the fix
itself is device-agnostic (it branches on
device.type == "meta").Not applicable: the existing device-move test already fails for exactly this
defect, so it is the regression.