Skip to content

Commit c6367cc

Browse files
Chia-Jung Changfacebook-github-bot
authored andcommitted
Fix bugs in executorch package (#10251)
Summary: There were bugs in `executorch`, which did not update `InputRecorder` import from `torchao` given changes in the path, which also required adding dependency to import `lm_eval`. Differential Revision: D73166222
1 parent cd72ec0 commit c6367cc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/models/llama/source_transformation/quantize.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def quantize( # noqa C901
5151
blocksize: int = 128,
5252
tokenizer_path: Optional[Path] = None,
5353
verbose: bool = False,
54+
online_access: bool = True,
5455
) -> torch.nn.Module:
5556
"""
5657
Quantizes a model by converting all weights to int8.
@@ -62,6 +63,7 @@ def quantize( # noqa C901
6263
Also the dtype of the rest of the non-quantized compoents of the model.
6364
checkpoint_dtype: The dtype of the checkpoint, this arg exists since it is more accurate to
6465
quantize the weight in its original dtype.
66+
online_access: whether the execution environment has internet access.
6567
6668
Returns:
6769
A quantized model.
@@ -164,7 +166,7 @@ def quantize( # noqa C901
164166

165167
try:
166168
# torchao 0.3+
167-
from torchao._eval import InputRecorder # pyre-fixme[21]
169+
from torchao._models._eval import InputRecorder
168170
except ImportError:
169171
from torchao.quantization.GPTQ import InputRecorder # pyre-ignore
170172

@@ -185,6 +187,7 @@ def quantize( # noqa C901
185187
None, # input_prep_func
186188
pad_calibration_inputs,
187189
model.vocab_size,
190+
online_access=online_access,
188191
)
189192
.record_inputs(
190193
calibration_tasks,

0 commit comments

Comments
 (0)