Repository navigation
fix(gptqmodel engine): stop passing device_map= to GPTQModel.load; use placement= - #154
Merged
Merged
Conversation
…e placement= (#153) GPT-QModel's weight_loader migration (ModelCloud/GPTQModel#6473) makes GPTQModel.load reject Accelerate placement keywords, including device_map=None, so every GPTQModel engine build raised TypeError. Default loads now pass only device=. An explicit device_map becomes placement= when GPTQModel.load accepts it ('auto' -> 'accel:auto'); older GPT-QModel releases without placement= still get device_map. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #153
Related: ModelCloud/GPTQModel#6511
Root cause
load_gptqmodel_runtimealways passeddevice_map=config.device_maptoGPTQModel.load. GPT-QModel's weight_loader migration (ModelCloud/GPTQModel#6473) rejects every Accelerate placement keyword, includingdevice_map=None, so every GPTQModel engine build raisedTypeErrorbefore loading.Change
New
_gptqmodel_placement_kwargsbuilds the placement keywords:flowchart TD A["load_gptqmodel_runtime"] --> B{"config.device_map is None?"} B -- yes --> C["device=resolved device (no device_map key)"] B -- no --> D{"GPTQModel.load signature has placement?"} D -- yes --> E["placement=device_map ('auto' -> 'accel:auto')"] D -- no --> F["device_map=device_map (older GPT-QModel)"] E --> G["device=config.device only if set"] F --> GOld flow: always
device_map=config.device_mapplusdevice=whendevice_mapwas None ordevicewas set. Thedevice=rule is unchanged.Tests
test_load_gptqmodel_runtime_uses_quantized_loader: no longer expects adevice_map=Nonekey.test_load_gptqmodel_runtime_uses_placement_with_weight_loader_gptqmodel(4 cases: default,"auto", device string + device, mapping) against aloadstand-in with the current GPT-QModel signature that rejectsdevice_map.test_load_gptqmodel_runtime_keeps_device_map_for_legacy_gptqmodel: older signature still receivesdevice_map.pytest --noconftest tests/test_gptqmodel_engine.py -k "not can_generate"TypeError: GPTQModel.load() does not accept device_map), 9 passedmain(c649fcb5f) +ModelCloud/Llama-3.2-1B-gptqmodel-ci-4biton an RTX 4090,evalution.GPTQModel(device="cuda:0").build(...)then generate'Paris, 1.5', input devicecuda:0device_map="auto"'Paris, 1.5'(placementaccel:auto)tests/test_requant_embed_lm_head_e2e.py(Evalution-backed ARC eval)Skips / not verified:
PYTHON_GIL=0; the test host env is a GIL build, so the unit file ran with--noconftest.test_gptqmodel_engine_can_generate_and_score_on_cudarequestsflash_attention_2, which is not installed here; after the fix it gets pastGPTQModel.loadand stops at the FlashAttention import (before the fix it failed at the TypeError).device_map) checked only with the signature stand-in, not a real older release.🤖 Generated with Claude Code