Skip to content

Add option to skip certain unit tests #2878

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
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/scripts/tests_to_skip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_disabled_in_oss_compatibility
10 changes: 9 additions & 1 deletion .github/workflows/unittest_ci_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ jobs:
python -c "import numpy"
echo "numpy succeeded"
conda install -n build_binary -y pytest
# Read the list of tests to skip from a file, ignoring empty lines and comments
skip_expression=$(awk '!/^($|#)/ {printf " and not %s", $0}' ./.github/scripts/tests_to_skip.txt)
# Check if skip_expression is effectively empty
if [ -z "$skip_expression" ]; then
skip_expression=""
else
skip_expression=${skip_expression:5} # Remove the leading " and "
fi
conda run -n build_binary \
python -m pytest torchrec -v -s -W ignore::pytest.PytestCollectionWarning --continue-on-collection-errors \
--ignore-glob=**/test_utils/
--ignore-glob=**/test_utils/ -k "$skip_expression"
8 changes: 1 addition & 7 deletions torchrec/ir/tests/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,7 @@ def test_serialize_deserialize_ebc(self) -> None:
self.assertEqual(deserialized.shape, orginal.shape)
self.assertTrue(torch.allclose(deserialized, orginal))

# pyre-ignore[56]: Pyre was not able to infer the type of argument
@unittest.skipIf(
torch.cuda.device_count() == 0,
"skip this test in OSS (no GPU available) because torch.export uses training ir in OSS",
)
def test_dynamic_shape_ebc(self) -> None:
# TODO: https://fb.workplace.com/groups/1028545332188949/permalink/1138699244506890/
def test_dynamic_shape_ebc_disabled_in_oss_compatibility(self) -> None:
model = self.generate_model()
feature1 = KeyedJaggedTensor.from_offsets_sync(
keys=["f1", "f2", "f3"],
Expand Down
21 changes: 3 additions & 18 deletions torchrec/models/experimental/test_transformerdlrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ def test_larger(self) -> None:
concat_dense = inter_arch(dense_features, sparse_features)
self.assertEqual(concat_dense.size(), (B, D * (F + 1)))

# pyre-ignore[56]: Pyre was not able to infer the type of argument
@unittest.skipIf(
torch.cuda.device_count() == 0,
"skip this test in OSS (no GPU available) because seed might be different in OSS",
)
def test_correctness(self) -> None:
def test_correctness_disabled_in_oss_compatibility(self) -> None:
D = 4
B = 3
# multi-head attentions
Expand Down Expand Up @@ -170,12 +165,7 @@ def test_correctness(self) -> None:
)
)

# pyre-ignore[56]: Pyre was not able to infer the type of argument
@unittest.skipIf(
torch.cuda.device_count() == 0,
"skip this test in OSS (no GPU available) because seed might be different in OSS",
)
def test_numerical_stability(self) -> None:
def test_numerical_stability_disabled_in_oss_compatibility(self) -> None:
D = 4
B = 3
# multi-head attentions
Expand Down Expand Up @@ -204,12 +194,7 @@ def test_numerical_stability(self) -> None:


class DLRMTransformerTest(unittest.TestCase):
# pyre-ignore[56]: Pyre was not able to infer the type of argument
@unittest.skipIf(
torch.cuda.device_count() == 0,
"skip this test in OSS (no GPU available) because seed might be different in OSS",
)
def test_basic(self) -> None:
def test_basic_disabled_in_oss_compatibility(self) -> None:
torch.manual_seed(0)
B = 2
D = 8
Expand Down