Skip to content

Fix equality-vs-assignment bug in GptqHfQuantizer.update_device_map#41304

Closed
gapsong wants to merge 1 commit into
huggingface:mainfrom
gapsong:fix/gptq-device-map-assignment
Closed

Fix equality-vs-assignment bug in GptqHfQuantizer.update_device_map#41304
gapsong wants to merge 1 commit into
huggingface:mainfrom
gapsong:fix/gptq-device-map-assignment

Conversation

@gapsong

@gapsong gapsong commented Oct 2, 2025

Copy link
Copy Markdown

Fixes a typo in GptqHfQuantizer.update_device_map where an equality comparison (==) was used instead of an assignment (=). Due to this, device_map was never updated to CUDA when using auto-gptq (which does not support CPU), leaving the model on CPU contrary to the intent expressed in the comment.

Before:

if not is_gptqmodel_available() and device_map in ("cpu", {"": torch.device("cpu")}):
    device_map == {"": 0}

After:

if not is_gptqmodel_available() and device_map in ("cpu", {"": torch.device("cpu")}):
    device_map = {"": 0}

This change makes the code match the intended behavior: when gptqmodel is not available and the model would otherwise be placed on CPU, move to CUDA device map ({"": 0}).

Who can review?

Anyone in the community is also welcome to review.

@github-actions

github-actions Bot commented Oct 2, 2025

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: gptq

@MekkCyber MekkCyber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix 🤗 ! Sorry a PR was already merged to fix this issue

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

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.

3 participants