Skip to content

Make test precision stricter for Classification #6380

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

Merged
merged 4 commits into from
Aug 8, 2022
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
6 changes: 3 additions & 3 deletions test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def test_classification_model(model_fn, dev):
# RNG always on CPU, to ensure x in cuda tests is bitwise identical to x in cpu tests
x = torch.rand(input_shape).to(device=dev)
out = model(x)
_assert_expected(out.cpu(), model_name, prec=0.1)
_assert_expected(out.cpu(), model_name, prec=1e-3)
assert out.shape[-1] == num_classes
_check_jit_scriptable(model, (x,), unwrapper=script_model_unwrapper.get(model_name, None), eager_out=out)
_check_fx_compatible(model, x, eager_out=out)
Expand Down Expand Up @@ -841,7 +841,7 @@ def test_video_model(model_fn, dev):
# RNG always on CPU, to ensure x in cuda tests is bitwise identical to x in cpu tests
x = torch.rand(input_shape).to(device=dev)
out = model(x)
_assert_expected(out.cpu(), model_name, prec=0.1)
_assert_expected(out.cpu(), model_name, prec=1e-5)
Copy link
Member

@NicolasHug NicolasHug Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @datumbox I am suspecting that this chang might cause flakyness in our internal tests

D38824237 shows that pytorch_vision_gpu-buck_2 is failing: https://www.internalfb.com/intern/testinfra/diagnostics/844425187765605.562950021904293.1660819094/

I don't see that on the other diffs (yet?) so I assume it's flaky.

Copy link
Contributor Author

@datumbox datumbox Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up. I would recommend turning off the internal test and relying on Github for verifying the models. Historically the test_models.py at Meta has been a source of flakyness, so feel free to turn off anything that breaks. Let me know if you need any help from me.

Edit: Hmm actually the very specific model is internal only and I wonder if its expected file is produced properly. The previous precision value was so high that was doing nothing effectively. looping @jdsgomes in case he wants to have a look on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into it, could be that the expected files are wrong.

assert out.shape[-1] == num_classes
_check_jit_scriptable(model, (x,), unwrapper=script_model_unwrapper.get(model_name, None), eager_out=out)
_check_fx_compatible(model, x, eager_out=out)
Expand Down Expand Up @@ -884,7 +884,7 @@ def test_quantized_classification_model(model_fn):
out = model(x)

if model_name not in quantized_flaky_models:
_assert_expected(out, model_name + "_quantized", prec=0.1)
_assert_expected(out, model_name + "_quantized", prec=2e-2)
assert out.shape[-1] == 5
_check_jit_scriptable(model, (x,), unwrapper=script_model_unwrapper.get(model_name, None), eager_out=out)
_check_fx_compatible(model, x, eager_out=out)
Expand Down