Repository navigation
Description
Found on main @ 4f287eb, 2 GPUs visible: cuda:0 = RTX 5090 (sm_120), cuda:1 = RTX 4090 (sm_89).
What is wrong
Quantizing on a mixed-generation pool works. The default GPTQModel.load(model_id, QuantizeConfig(...)) quantizes on both the 5090 and the 4090, and so does a compute_device_filter that keeps both. But naming those same GPUs through the documented explicit-sequence route raises before the model is loaded:
GPTQModel.load(model_id, GPTQConfig(bits=4, group_size=128), device=("cuda:1", "cuda:0")) # or device=(0, 1)
ValueError: Quantized kernel selection does not support a device map spanning different GPU compute capabilities: cuda:1=8.9, cuda:0=12.0. Place the model on one capability group with `device="cuda:N"`, a `max_memory` budget that names one card, or a `CUDA_VISIBLE_DEVICES` list.docs/multi_gpu_quantization.md ("Explicit device sequences") says a tuple of ordinals constrains quantization to those devices, and that from_pretrained needs a sequence for this (device="cuda:N" does not constrain the quantization pool). The quantize path still applies the inference-only check to that sequence:
ModelLoader.from_pretrained(gptqmodel/models/loader.py:2190) and the prewarm resolver_quantize_warmup_devices(gptqmodel/models/auto.py:725, added by fix(looper): stop claiming GPUs a quantization run excluded #4688) both call_explicit_requested_devices(device).- That helper runs
selector_device_family(targets) # validate every selected family/capability(loader.py:485) ->_validate_selector_device_families(utils/importer.py:1067). - That check exists because one quantized kernel is selected for a whole inference map ([BUG] load(max_memory=...) validates kernels against every visible GPU instead of the budget's devices: mixed-arch hosts (4090+5090) refuse even single-GPU or GPU+CPU budgets #4632/[BUG] Default GPTQModel.load(path) always fails on mixed compute-capability multi-GPU hosts (4090+5090): device map spans every visible GPU (#4632 fixed only max_memory) #4705/[BUG] #4714 incomplete: with one GPU per capability (4090+5090) the default layer-wise device_map still spans every visible GPU; the mixed-capability guard is bypassed instead of placement staying in one group #4734). A quantization load runs the dense model on CPU and selects no inference kernel for the device pool. The default pool already spans both capabilities without problems, as the run below shows.
So on a mixed host, the only way to quantize on a chosen subset that spans two generations is compute_device_filter. For example, use the 5090 plus one of two 4090s, or leave a busy card out. The documented tuple route fails, and its error suggests device="cuda:N", which for from_pretrained does not restrict the pool at all.
Repro
import gzip, json, torch
from gptqmodel import GPTQModel, CalibrationConfig
from gptqmodel.quantization import GPTQConfig
calib = [...] # 16 C4 texts
for name, lkw, ckw in [
("default", {}, {}),
("filter_both", {}, dict(compute_device_filter=lambda ds: [d for d in ds if d.index in (0, 1)])),
("tuple10", dict(device=("cuda:1", "cuda:0")), {}),
]:
m = GPTQModel.load("Qwen2.5-0.5B-Instruct", GPTQConfig(bits=4, group_size=128, **ckw), dtype=torch.float16, **lkw)
m.quantize(CalibrationConfig(dataset=calib))
print(name, [torch.cuda.max_memory_allocated(i) >> 20 for i in range(2)],
m.tokenizer.decode(m.generate(**m.tokenizer(["The capital of France is"], return_tensors="pt"), max_new_tokens=8, do_sample=False)[0][-8:]))Output:
default peak MiB [418, 386] ' Paris. The capital of the United States'
filter_both peak MiB [418, 386] ' Paris. The capital of the United States'
tuple10 ValueError: Quantized kernel selection does not support a device map spanning different GPU compute capabilities: cuda:1=8.9, cuda:0=12.0 ...
device=("cuda:1",) and device=("cuda:0",) work. Their checkpoints are bitwise identical to CUDA_VISIBLE_DEVICES=<that GPU> runs, and the other GPU gets no context or allocations. Only multi-entry sequences that span capabilities are refused.
Suggested fix
Do not apply the capability check when the sequence describes a quantization pool. For example, give _explicit_requested_devices a validate_capability flag (family-only for from_pretrained and _quantize_warmup_devices), or validate only the family there. The kernel-selection check stays on the from_quantized / inference-map path, where it belongs.
Test that should have caught it
tests/test_default_device_mixed_capability_4705.py covers only the inference loader. Add a case with fake capabilities where from_pretrained(device=(0, 1)) builds the 2-device compute_device_filter without raising.
Severity
Low-medium: a documented placement API fails on mixed-generation hosts while the equivalent filter works.
🤖 Generated with Claude Code
Activity
Qubitium commentedon Nov 17, 2026
Agent claim:
agent-root-4875-device-seqis working on this issue now.Started 2026-11-17T18:28:50Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
claiming: let an explicit quantize device sequence span compute capabilities; keep the single-capability check for the inference kernel selection
fix(load): let a quantize device sequence span GPU compute capabiliti…
Qubitium commentedon Nov 17, 2026
Agent claim released — fixed and merged.
#4920 landed as
436053174onmain; the issue is closed.