Skip to content
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

Enhance GPTQ act_order UT #1804

Merged
merged 5 commits into from
May 21, 2024
Merged
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
24 changes: 24 additions & 0 deletions test/3x/torch/quantization/weight_only/test_gptq.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,30 @@ def test_mse_search(self):
atol_false > atol_true
), "use_mse_search=True doesn't help accuracy, maybe is reasonable, please double check."

def test_act_order(self):
# act_order=False
model = copy.deepcopy(self.tiny_gptj)
quant_config = GPTQConfig(
act_order=False,
)
model = prepare(model, quant_config)
run_fn(model)
model = convert(model)
out = model(self.example_inputs)[0]
atol_false = (out - self.label).amax()
# act_order=True
model = copy.deepcopy(self.tiny_gptj)
quant_config = GPTQConfig(
act_order=True,
)
model = prepare(model, quant_config)
run_fn(model)
model = convert(model)
out = model(self.example_inputs)[0]
atol_true = (out - self.label).amax()
# compare atol, this case is an ideal case.
assert atol_false > atol_true, "act_order=True doesn't help accuracy, maybe is reasonable, please double check."

# def test_layer_wise(self):
# model = copy.deepcopy(self.tiny_gptj)
# quant_config = GPTQConfig(
Expand Down
Loading