Skip to content

[TEST] HF-bridge legacy-qzeros Marlin test no longer reaches Marlin: from_pretrained().to(cuda) selects a CPU kernel (since #6473) #6527

Done

Description

@Qubitium

tests/test_hf_bridge_legacy_qzeros_marlin_6274.py::test_legacy_symmetric_checkpoint_loads_on_the_auto_marlin_kernel fails on main (c649fcb, RTX 4090):

>       assert any(isinstance(m, MarlinLinear) for m in model.modules())
E       assert False

#6473 changed the test's loader from AutoModelForCausalLM.from_pretrained(dir, device_map={"": 0}) to AutoModelForCausalLM.from_pretrained(dir).to("cuda:0"). Without a device_map, Transformers runs the load (and the GPT-QModel HF bridge's kernel selection) on CPU. AUTO therefore correctly picks a CPU kernel (TorchCpuAvx512Linear here), and .to() only moves it. So the test no longer reaches the Marlin path it guards (#6274: deferred symmetric qzeros must not break the Marlin post_init).

The product behaves correctly. I checked on the same host with accelerate 1.15 installed, in a process that has imported gptqmodel:

  • from_pretrained(dir, device_map={"": 0}) → MarlinLinear, the forward is finite and matches the CPU-selected kernel (max abs diff 2e-3).
  • from_pretrained(dir).to("cuda:0") → TorchCpuAvx512Linear, which is expected for a CPU-time selection.

#6501 restored Transformers/Accelerate compatibility for non-GPT-QModel calls, so the original device_map spelling works again.

Fix: restore device_map={"": 0} for the Marlin node, with pytest.importorskip("accelerate"), since Accelerate is now optional.

Activity

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