Skip to content

Skip big models per platform/device #6539

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
Sep 5, 2022
Merged
Changes from 1 commit
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
27 changes: 22 additions & 5 deletions test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import operator
import os
import pkgutil
import platform
import sys
import warnings
from collections import OrderedDict
from itertools import product
from tempfile import TemporaryDirectory
from typing import Any

Expand Down Expand Up @@ -343,12 +345,27 @@ def _check_input_backprop(model, inputs):
_model_params[m] = {"input_shape": (1, 3, 64, 64)}


# skip big models to reduce memory usage on CI test
# skip big models to reduce memory usage on CI test. We can exclude combinations of (platform-system, device).
_all_platforms = ("Darwin", "Linux", "Windows")
_all_devices = ("cpu", "cuda")
skipped_big_models = {
"vit_h_14",
"regnet_y_128gf",
"vit_h_14": set(product(_all_platforms, _all_devices)),
"regnet_y_128gf": set(product(_all_platforms, _all_devices)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see we already did this before. Is this a temporary thing? If not, how are we going to make sure that we don't introduce bugs in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I've pinged offline @YosuaMichael who had to introduce those to see if we can specify further the skips instead of blocking every version of it. I'll follow up in this PR with some commits to try to narrow it down on Windows GPU (maybe also CPU) which from memory was breaking. I'll turn this to draft to avoid accidental merges until we know the exact skips required.

Copy link
Contributor

@YosuaMichael YosuaMichael Sep 5, 2022

Choose a reason for hiding this comment

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

I have chatted with @datumbox, for vit_h_14 and regnet_y_128gf, TLDR it failed on Windows for both CPU and GPU. Just FYI for some context on the failures, it first fails on Windows GPU first in 27 April 2022 and after ~2 months though it fails on Windows CPU.

I think this PR is a good idea to loosen the test for the big model so we can still test them on Linux and Mac if possible :)

I have looked at the code and it looks good to me too.

Copy link
Contributor Author

@datumbox datumbox Sep 5, 2022

Choose a reason for hiding this comment

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

Perfect thanks for the references. I just pushed skipping only Windows for these tests as well. Let's see how this will go. If green, I'll clean up the PR and merge using the more specific skips as you both proposed.

"mvit_v1_b": {("Windows", "cuda")},
"mvit_v2_s": {("Windows", "cuda")},
}


def is_skippable(model_name, device):
if model_name not in skipped_big_models:
return False

platform_system = platform.system()
device_name = str(device).split(":")[0]

return (platform_system, device_name) in skipped_big_models[model_name]


# The following contains configuration and expected values to be used tests that are model specific
_model_tests_values = {
"retinanet_resnet50_fpn": {
Expand Down Expand Up @@ -612,7 +629,7 @@ def test_classification_model(model_fn, dev):
"input_shape": (1, 3, 224, 224),
}
model_name = model_fn.__name__
if SKIP_BIG_MODEL and model_name in skipped_big_models:
if SKIP_BIG_MODEL and is_skippable(model_name, dev):
pytest.skip("Skipped to reduce memory usage. Set env var SKIP_BIG_MODEL=0 to enable test for this model")
kwargs = {**defaults, **_model_params.get(model_name, {})}
num_classes = kwargs.get("num_classes")
Expand Down Expand Up @@ -841,7 +858,7 @@ def test_video_model(model_fn, dev):
"num_classes": 50,
}
model_name = model_fn.__name__
if SKIP_BIG_MODEL and model_name in skipped_big_models:
if SKIP_BIG_MODEL and is_skippable(model_name, dev):
pytest.skip("Skipped to reduce memory usage. Set env var SKIP_BIG_MODEL=0 to enable test for this model")
kwargs = {**defaults, **_model_params.get(model_name, {})}
num_classes = kwargs.get("num_classes")
Expand Down