Skip to content

Commit

Permalink
Fix GPTQ import error after torchao refactor (pytorch#3760)
Browse files Browse the repository at this point in the history
Summary:

Fix broken import after pytorch/ao#275

Reviewed By: jerryzh168

Differential Revision: D57888168
  • Loading branch information
andrewor14 authored and facebook-github-bot committed May 29, 2024
1 parent 757a6ad commit 2282a22
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/models/llama2/source_transformation/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ def quantize(
if calibration_tasks is None:
calibration_tasks = ["wikitext"]

from torchao.quantization.GPTQ import InputRecorder
try:
# torchao 0.3+
# pyre-ignore
from torchao._eval import InputRecorder
except ImportError:
from torchao.quantization.GPTQ import InputRecorder

from torchao.quantization.quant_api import Int8DynActInt4WeightGPTQQuantizer

if tokenizer_path is None:
Expand Down

0 comments on commit 2282a22

Please sign in to comment.