Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPTQ - Move quantized_model to CUDA device #1535

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions olive/passes/pytorch/gptq.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ def _run_for_config(
model_type = pytorch_model.config.model_type if hasattr(pytorch_model, "config") else ""
model_class = GPTQ_CAUSAL_LM_MODEL_MAP.get(model_type, BaseGPTQForCausalLM)
quantized_model: BaseGPTQForCausalLM = model_class(pytorch_model, False, quantize_config)
# explicitly move quantized model to CUDA device to avoid the "Expected all tensors to be
# on the same device" error in auto-gptq.
# see https://github.com/AutoGPTQ/AutoGPTQ/issues/729
quantized_model.to("cuda")

fields_to_set = {
"outside_layer_modules": MODEL_OUTSIDE_LAYER_MODULES,
Expand Down
Loading