Skip to content

Plumb group_size to 4b quant #2734

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

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 8 additions & 2 deletions examples/models/llama2/export_llama_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ def quantize(
elif qmode == "8da4w":
from torchao.quantization.quant_api import Int8DynActInt4WeightQuantizer

model = Int8DynActInt4WeightQuantizer(precision=torch_dtype).quantize(model)
model = Int8DynActInt4WeightQuantizer(
precision=torch_dtype, group_size=group_size
).quantize(model)
if verbose_export():
print("quantized model:", model)
return model
Expand Down Expand Up @@ -406,7 +408,11 @@ def build_args_parser() -> argparse.ArgumentParser:
help="Use cProfile to profile model export. Results saved to profile_path as a html file.",
)
parser.add_argument(
"-G", "--group_size", default=None, help="group_size for weight quantization"
"-G",
"--group_size",
type=int,
default=None,
help="group_size for weight quantization",
)

parser.add_argument(
Expand Down