Skip to content

test(hf-bridge): load the legacy-qzeros Marlin case with device_map again (#6473 follow-up) - #6528

Merged
Qubitium merged 1 commit into
mainfrom
test/hf-bridge-marlin-device-map
Dec 1, 2026
Merged

Qubitium merged 1 commit into
mainfrom
test/hf-bridge-marlin-device-map

Conversation

@Qubitium

@Qubitium Qubitium commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

tests/test_hf_bridge_legacy_qzeros_marlin_6274.py::test_legacy_symmetric_checkpoint_loads_on_the_auto_marlin_kernel has been red on main since #6473 (assert any(isinstance(m, MarlinLinear) ...) → False).

#6473 rewrote the load as from_pretrained(dir).to("cuda:0"). Without a device_map, Transformers loads on CPU and the HF bridge's AUTO selection correctly picks a CPU kernel (TorchCpuAvx512Linear). .to() only moves it, so the test no longer reaches the Marlin + deferred-qzeros path it guards (#6274). #6501 restored Transformers/Accelerate compatibility, so this PR restores the original device_map={"": 0} spelling for this node. The node now skips when the optional accelerate package is absent.

Fixes #6527

What Changed

  • The Marlin node loads with AutoModelForCausalLM.from_pretrained(dir, device_map={"": 0}) after pytest.importorskip("accelerate").
  • The CPU nodes and the _load helper are unchanged.
  • Test-only change.

Tests

Red (origin/main c649fcb, RTX 4090):

PYTHONPATH=. python -m pytest -q -p no:cacheprovider --timeout=900 tests/test_hf_bridge_legacy_qzeros_marlin_6274.py
FAILED ...::test_legacy_symmetric_checkpoint_loads_on_the_auto_marlin_kernel - assert False
1 failed, 5 passed

Green (this PR, accelerate 1.15 installed):

PYTHONPATH=. python -m pytest -q -p no:cacheprovider --timeout=900 -rs tests/test_hf_bridge_legacy_qzeros_marlin_6274.py
6 passed
uvx [email protected] check tests/test_hf_bridge_legacy_qzeros_marlin_6274.py   -> All checks passed!

Product behavior check (same checkpoint): device_map={"": 0} loads MarlinLinear with a finite forward that matches the CPU-selected kernel (max abs diff 2e-3). .to("cuda:0") gives TorchCpuAvx512Linear, as expected for CPU-time selection.

  • Unit tests have been executed and passed.
  • Updated an existing test (no product change).

Model Support / Module Plan / AWQ / Logic Flow / Kernel Accuracy

Not applicable (test-only change).

Review Requirements

  • Reviewed this PR.
  • Minimized the impacted code surface.

Notes

The node now needs the optional accelerate package. Where it is not installed, the node skips, and that skip is not Marlin validation.

🤖 Generated with Claude Code

…gain

#6473 replaced device_map={'': 0} with from_pretrained().to('cuda:0').
Without a device_map the HF bridge selects the kernel on CPU, so the
test never reached MarlinLinear (the #6274 path) and failed. Restore the
device_map spelling, gated on the now-optional accelerate.

Fixes #6527

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Qubitium
Qubitium marked this pull request as ready for review December 1, 2026 02:40
@Qubitium
Qubitium merged commit d96e30f into main Dec 1, 2026
6 checks passed
@Qubitium
Qubitium deleted the test/hf-bridge-marlin-device-map branch December 1, 2026 02:40
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.

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

1 participant