Skip to content

Commit 1c8b9d4

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Do not require checkpoint in quantize() unless it's gptq
Summary: As titled. Differential Revision: D71571527
1 parent 1300cda commit 1c8b9d4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

examples/models/llama/source_transformation/quantize.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ def quantize( # noqa C901
6363
else:
6464
torch_dtype = torch.float16
6565

66-
assert checkpoint_path, "Need to specify a checkpoint"
67-
# if checkpoint_path is None:
68-
# checkpoint_path = Path("checkpoints/meta-llama/Llama-2-7b-chat-hf/model.pth")
69-
7066
if qmode == "int8":
7167
# Add quantization mode options here: group size, bit width, etc.
7268
return WeightOnlyInt8QuantHandler(model).quantized_model()
@@ -149,6 +145,7 @@ def quantize( # noqa C901
149145
from torchao.quantization.quant_api import Int8DynActInt4WeightGPTQQuantizer
150146

151147
if tokenizer_path is None:
148+
assert checkpoint_path is not None, "checkpoint_path must be specified"
152149
tokenizer_path = checkpoint_path.parent / "tokenizer.model"
153150
assert tokenizer_path.is_file(), tokenizer_path
154151
tokenizer = SentencePieceProcessor( # pyre-ignore[28]

0 commit comments

Comments
 (0)