Repository navigation
fix(qqq): initialize cache after kernel rehome - #4490
Merged
Merged
Conversation
Collaborator
|
@mikemikimike merge conflict |
mikemikimike
force-pushed
the
fix/4451-qqq-cache
branch
from
November 16, 2026 19:06
57b8b65 to
88b5a8f
Compare
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
Fixes the QQQ in-session kernel rehome regression reported in Issue #4451.
Resolves #4451
When
QQQLinearis rehomed toQQQTorchLinear, the target constructor is intentionally skipped so packed buffers can be preserved. The target cache reset now lazily creates_torch_int_mm_failed_shapesbefore clearing it, allowing quantization to finish and the model to be saved.flowchart TD A["quantize(offload_to_disk=False)"] --> B["rehome_quantized_kernel(model)"] B --> C["switch QQQLinear -> QQQTorchLinear"] C --> D["clear_weight_cache()"] D --> E{"failed-shape cache exists?"} E -- "no" --> F["create empty set"] E -- "yes" --> G["reuse existing set"] F --> H["continue quantization and save"] G --> H style E fill:#ffe0b2,stroke:#e65100 style H fill:#c8e6c9,stroke:#2e7d32Before, the class switch raised
AttributeError: 'QQQTorchLinear' object has no attribute '_torch_int_mm_failed_shapes'at loop end, so the quantized model could not be saved. After, the cache is initialized only when needed, packed state is preserved, and normally constructed modules keep the existing clear behavior.Failure contract
If a target class is missing this constructor-only cache during rehome, initialize that cache and continue. Kernel selection, unsupported-device errors, and other validation failures retain their existing behavior.
Validation
pytest -q tests/test_quantize_in_session_4381.py(8 passed)python -m py_compile gptqmodel/nn_modules/qlinear/qqq.py tests/test_quantize_in_session_4381.pypassedgit diff --checkpassed