Skip to content

Commit

Permalink
test (ex/llm): softened accuracy conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfraser committed Aug 23, 2024
1 parent d4509c6 commit 513cac0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/brevitas_examples/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def allclose(x, y):
return np.allclose(x, y, rtol=1e-04, atol=3e-00, equal_nan=False)


def allveryclose(x, y):
return np.allclose(x, y, rtol=1e-08, atol=1e-01, equal_nan=False)


def allexact(x, y):
return np.allclose(x, y, rtol=0.0, atol=0.0, equal_nan=False)

Expand Down Expand Up @@ -181,8 +185,8 @@ def test_small_models_acc(caplog, acc_args_and_acc):
assert allclose(exp_float_ppl, float_ppl), f"Expected float PPL {exp_float_ppl}, measured PPL {float_ppl}"
assert allclose(exp_quant_ppl, quant_ppl), f"Expected quant PPL {exp_quant_ppl}, measured PPL {quant_ppl}"
else:
assert allexact(exp_float_ppl, float_ppl), f"Expected float PPL {exp_float_ppl}, measured PPL {float_ppl}"
assert allexact(exp_quant_ppl, quant_ppl), f"Expected quant PPL {exp_quant_ppl}, measured PPL {quant_ppl}"
assert allveryclose(exp_float_ppl, float_ppl), f"Expected float PPL {exp_float_ppl}, measured PPL {float_ppl}"
assert allveryclose(exp_quant_ppl, quant_ppl), f"Expected quant PPL {exp_quant_ppl}, measured PPL {quant_ppl}"


@pytest.fixture(
Expand Down

0 comments on commit 513cac0

Please sign in to comment.