Skip to content

fix(exllamav2 awq): repack replaced checkpoint words before rebind - #3787

Merged
Qubitium merged 1 commit into
mainfrom
fix/exllamav2-awq-raw-replacement
Nov 12, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/exllamav2-awq-raw-replacement

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Fixes the stale AWQ packing flag found while reviewing #3717. After a native handle was built, replacing the registered buffers with raw checkpoint words and clearing the handle left _awq_repacked=True; the next bind received raw layout.

flowchart TD
  A["_ensure_q_handle"] --> B{"qweight shape is native?"}
  B -- no --> C["release old handle; reset packing/shuffle flags"]
  C --> D["unpack_reorder_pack raw checkpoint words"]
  B -- yes --> E["reuse finalized packed words"]
  D --> F["bind native descriptor"]
  E --> F
  G["load_state_dict with only raw qzeros"] --> X["RuntimeError: paired raw qweight required"]
Loading
Mechanism Before After
Rebind after direct raw replacement exllamav2_awq.py:201-205 trusted the one-way flag exllamav2_awq.py:196-209 recognizes raw qweight shape and repacks
post_init Repacked separately exllamav2_awq.py:138 uses the same rebind path

Validation: 5 handle lifecycle tests pass, including replacement with and without an explicit clear; they compare the bound packed words against a fresh packing result. Four native AWQ fusion cases pass on CUDA. Ruff passes. Direct replacement of a native-shaped buffer has no layout metadata; checkpoint reloads should use load_state_dict.

@Qubitium
Qubitium merged commit ee9fb7c into main Nov 12, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/exllamav2-awq-raw-replacement branch November 12, 2026 02:33
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