Skip to content

[BUG] Regression from #4611: resuming any QQQ quantization from a checkpoint always crashes at restore ('workspace is on the meta device'): non-persistent QQQLinear.workspace not materialized before attach_disk_offload_hook (10 checkpoint-recovery tests red) #4777

Closed

Description

@Qubitium

Found on main @ b225a43, RTX 4090 (CUDA 13.2, torch 2.15, accelerate 1.15). This is a regression from 2f16820 (#4611, "finish the in-session materialisation contract for resume ..."). The test below passes at 2f1682053^ and fails from 2f1682053 on.

What is wrong

Resuming an interrupted QQQ quantization with quantize(..., checkpoint=...) always crashes in the checkpoint restore, before any work is done:

gptqmodel/looper/checkpoint.py:117 prepare -> gptqmodel/looper/gptq_checkpoint.py:618 restore
  -> gptqmodel/utils/offload.py:1369 attach_disk_offload_hook -> accelerate.big_modeling.disk_offload
  -> accelerate/hooks.py:339 init_hook -> set_module_tensor_to_device
ValueError: workspace is on the meta device, we need a `value` to put in on cpu.

GPTQCheckpoint.restore() (looper/gptq_checkpoint.py:~600-618) rebuilds each finished module on meta, writes an offload index.json from module.state_dict(), and then (since #4611) calls attach_disk_offload_hook(module, directory). QQQLinear registers its split-K lock array as a non-persistent buffer: register_buffer("workspace", torch.zeros(...), persistent=False) at nn_modules/qlinear/qqq.py:~267. That buffer is not in state_dict(), so it is not in the index. accelerate's hook init then tries to move every buffer, finds workspace still on meta with no stored value, and raises.

Every resume path for QQQ is affected: SIGTERM, SIGKILL before or after a layer, and an in-process error, for dense, EoRA and MoE models. The checkpoint feature exists so a long run is not lost. For QQQ, a resumed run can never complete, and the only way out is to start over. Any other kernel with a non-persistent buffer would hit the same path.

Failing repo tests (10, 3/3 deterministic)

tests/test_checkpoint_method_compatibility.py:

  • test_specialized_checkpoint_recovery[{term,kill-before,kill-after,error}-qqq]
  • test_specialized_eora_checkpoint_recovery[{term,kill-before}-{llama,qwen3_moe}-qqq]
  • test_moe_method_checkpoint_recovery[{term,kill-before}-qqq]

All 10 fail with the ValueError above, raised in the resumed child process. The file needs more than the default 600 s (about 30 min in total), which is why it is easy to miss in a timed CI run.

Repro

pytest -q tests/test_checkpoint_method_compatibility.py -k "test_specialized_checkpoint_recovery and error-qqq"
# 2f1682053^ : 1 passed
# 2f1682053  : 1 failed  (ValueError: workspace is on the meta device ...)
# b225a4383  : 1 failed

Suggested fix

When restoring, materialize non-persistent buffers before attaching the offload hook. Re-run the module's buffer initialization (for QQQ, workspace = torch.zeros(_workspace_numel(...), dtype=torch.int32)), or include non-persistent buffers in the offload index. Since #4665/#4717 allocate the lock array per forward call, another option is to stop registering workspace as a module buffer at all.

Severity

Medium-high. Checkpoint/resume is unusable for QQQ. The run dies at restore every time, after the user's earlier progress was saved.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Claiming. Will fix the restore path so non-persistent buffers (QQQ workspace) are materialized before attach_disk_offload_hook, with a fast unit-level regression test in addition to the existing recovery tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions