You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] export(..., "mlx") of AWQ GEMV / GEMV_FAST checkpoints always fails on a GPU host: export forces BACKEND.AWQ_TORCH whose GEMV readers are CPU-only, but loads on the default accelerator ('does not support device: cuda:0') #4809
Found on main @ dba142d, RTX 5090 host, mlx==0.32.4 (CPU) / mlx-lm==0.32.2.
What is wrong
GPTQModel.export(path, out, "mlx") loads the checkpoint with a hard-coded backend per method (gptqmodel/models/auto.py:1288-1310) and no device. For AWQ it picks BACKEND.AWQ_TORCH. For FORMAT.GEMV / FORMAT.GEMV_FAST checkpoints that backend resolves to AwqGEMVTorchLinear / AwqGEMVFastTorchLinear, which are CPU-only readers (SUPPORTS_DEVICES = [DEVICE.CPU], nn_modules/qlinear/gemv_awq.py:510, added for #4554/#4736). Default device selection picks the accelerator whenever one is visible, so export fails before any conversion:
models/auto.py export -> GPTQModel.load(..., backend=AWQ_TORCH) -> loader.from_quantized -> make_quant -> select_quant_linear
ValueError: <class 'gptqmodel.nn_modules.qlinear.gemv_awq.AwqGEMVTorchLinear'> does not support device: cuda:0
ValueError: <class 'gptqmodel.nn_modules.qlinear.gemv_fast_awq.AwqGEMVFastTorchLinear'> does not support device: cuda:0
The converter itself supports these formats: FORMAT.GEMV / GEMV_FAST are in its allowed list (utils/mlx.py:533-538). The same checkpoint exports correctly when the process has no visible GPU: mlx_lm.load of the result matches GPTQModel.load, max logit diff 0.041 and argmax agreement 1.0. So the failure depends only on which device is visible. On an Apple Silicon host the default device is not CPU either, so the same selection is likely to fail there too (not verified, no Mac here).
Repro
importtorchfromgptqmodelimportGPTQModelfromgptqmodel.quantization.configimportCalibrationConfig, AWQConfigm=GPTQModel.load("Qwen/Qwen2.5-0.5B-Instruct", AWQConfig(bits=4, group_size=128, format="gemv"), dtype=torch.float16)
m.quantize(CalibrationConfig(dataset=texts)); m.save("q_gemv")
GPTQModel.export("q_gemv", "q_gemv_mlx", "mlx") # with a CUDA GPU visible# ValueError: <class '...AwqGEMVTorchLinear'> does not support device: cuda:0
The same call with CUDA_VISIBLE_DEVICES="" succeeds. format="gemv_fast" fails the same way with AwqGEMVFastTorchLinear.
Suggested fix
The MLX path only reads packed tensors on the host, so export(..., "mlx") should load with device="cpu" (or device_map="cpu") whatever accelerator is present. Alternatively, choose AWQ_TORCH only for GEMM and let AUTO pick a GEMV reader for the actual device.
Test that should have caught it
tests/test_export_contract_4386.py mocks the load. An export test that keeps an accelerator visible would have failed.
Severity
Low-medium: a documented export path for two AWQ formats always crashes on GPU hosts, which is where the checkpoints are produced. The failure is loud, and hiding the GPUs works around it.
Claiming. Will load the checkpoint on CPU for the MLX export path (the converter only reads packed host tensors) and add an export test that keeps an accelerator visible.
Activity
Qubitium commentedon Nov 17, 2026
Claiming. Will load the checkpoint on CPU for the MLX export path (the converter only reads packed host tensors) and add an export test that keeps an accelerator visible.
Qubitium commentedon Nov 17, 2026
Agent claim released:
agent-11788dff99fdfinished this issue.Pull request: #4834
Reproducing the AWQ GEMV/GEMV_FAST mlx export device failure on a CUDA host; will load the mlx export path on CPU since it only reads packed tensors
fix(export): load MLX exports on CPU so GEMV checkpoints export on GP…