Skip to content

Commit

Permalink
remove torch_dtype override (huggingface#25894)
Browse files Browse the repository at this point in the history
* remove torch_dtype override

* style

* Update src/transformers/modeling_utils.py

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

---------

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
  • Loading branch information
2 people authored and blbadger committed Nov 8, 2023
1 parent b932fda commit c62fe59
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2578,11 +2578,11 @@ def from_pretrained(
if quantization_method_from_config == QuantizationMethod.GPTQ:
quantization_config = GPTQConfig.from_dict(config.quantization_config)
config.quantization_config = quantization_config
logger.info(
f"Overriding torch_dtype={torch_dtype} with `torch_dtype=torch.float16` due to "
"requirements of `auto-gptq` to enable model quantization "
)
torch_dtype = torch.float16
if torch_dtype is None:
torch_dtype = torch.float16
else:
logger.info("We suggest you to set `torch_dtype=torch.float16` for better efficiency with GPTQ.")

quantizer = GPTQQuantizer.from_dict(quantization_config.to_dict())

if (
Expand Down

0 comments on commit c62fe59

Please sign in to comment.