From 1435d0b456f5a349564717622885de2fbadc3737 Mon Sep 17 00:00:00 2001 From: erjia Date: Fri, 23 Sep 2022 22:12:52 +0000 Subject: [PATCH 1/4] Ignore deprecation warning from traverse function --- test/test_prototype_datasets_builtin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_prototype_datasets_builtin.py b/test/test_prototype_datasets_builtin.py index 6ddba1806c6..554b280bbc3 100644 --- a/test/test_prototype_datasets_builtin.py +++ b/test/test_prototype_datasets_builtin.py @@ -42,6 +42,9 @@ def test_coverage(): ) +# TODO: Remove filterwarnings after only_datapipe is deprecated from traverse function +# and `traverse` function behaves like only_datapipe=True by default +@pytest.mark.filterwarnings("ignore:`only_datapipe` is deprecated:FutureWarning") @pytest.mark.filterwarnings("error") class TestCommon: @pytest.mark.parametrize("name", datasets.list_datasets()) From f66e7ff828f06caa847dfcb6805cbe06da2625e3 Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Tue, 27 Sep 2022 09:05:02 +0200 Subject: [PATCH 2/4] remove only_datapipe --- test/test_prototype_datasets_builtin.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/test_prototype_datasets_builtin.py b/test/test_prototype_datasets_builtin.py index 554b280bbc3..807863b102f 100644 --- a/test/test_prototype_datasets_builtin.py +++ b/test/test_prototype_datasets_builtin.py @@ -22,7 +22,7 @@ def extract_datapipes(dp): - return get_all_graph_pipes(traverse(dp, only_datapipe=True)) + return get_all_graph_pipes(traverse(dp)) @pytest.fixture(autouse=True) @@ -42,9 +42,6 @@ def test_coverage(): ) -# TODO: Remove filterwarnings after only_datapipe is deprecated from traverse function -# and `traverse` function behaves like only_datapipe=True by default -@pytest.mark.filterwarnings("ignore:`only_datapipe` is deprecated:FutureWarning") @pytest.mark.filterwarnings("error") class TestCommon: @pytest.mark.parametrize("name", datasets.list_datasets()) @@ -104,12 +101,11 @@ def test_transformable(self, dataset_mock, config): next(iter(dataset.map(transforms.Identity()))) - @pytest.mark.parametrize("only_datapipe", [False, True]) @parametrize_dataset_mocks(DATASET_MOCKS) - def test_traversable(self, dataset_mock, config, only_datapipe): + def test_traversable(self, dataset_mock, config): dataset, _ = dataset_mock.load(config) - traverse(dataset, only_datapipe=only_datapipe) + traverse(dataset) @parametrize_dataset_mocks(DATASET_MOCKS) def test_serializable(self, dataset_mock, config): From 0001834060221fe42aa3d97c74cc6c287b4d9127 Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Tue, 27 Sep 2022 09:28:56 +0200 Subject: [PATCH 3/4] reinstate warning ignore for DL test --- test/test_prototype_datasets_builtin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test_prototype_datasets_builtin.py b/test/test_prototype_datasets_builtin.py index 807863b102f..1a1d8a9a865 100644 --- a/test/test_prototype_datasets_builtin.py +++ b/test/test_prototype_datasets_builtin.py @@ -119,6 +119,10 @@ def test_serializable(self, dataset_mock, config): def _collate_fn(self, batch): return batch + # FIXME: Although we are not using `traverse(..., only_datapipe=...)` here directly, the `DataLoader` does. This + # will emit the warning, which in turn will fail the test if we don't ignore it. There is a push to fix this in + # https://github.com/pytorch/pytorch/pull/85667. + @pytest.mark.filterwarnings("ignore:`only_datapipe` is deprecated:FutureWarning") @pytest.mark.parametrize("num_workers", [0, 1]) @parametrize_dataset_mocks(DATASET_MOCKS) def test_data_loader(self, dataset_mock, config, num_workers): From b24945391fe427981d91d2286deaf4d2b7ddf2af Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Tue, 27 Sep 2022 10:00:48 +0200 Subject: [PATCH 4/4] ignore warning class wide due to priority --- test/test_prototype_datasets_builtin.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/test_prototype_datasets_builtin.py b/test/test_prototype_datasets_builtin.py index 1a1d8a9a865..231ca86b56b 100644 --- a/test/test_prototype_datasets_builtin.py +++ b/test/test_prototype_datasets_builtin.py @@ -42,6 +42,12 @@ def test_coverage(): ) +# FIXME: This decorator only applies to `test_data_loader`, but we can't put it there because the class-wide fail on +# warnings would take higher priority. +# Although we are not using `traverse(..., only_datapipe=...)` in `test_data_loader` directly, the `DataLoader` does. +# This will emit the warning, which in turn will fail the test if we don't ignore it. There is a push to fix this in +# https://github.com/pytorch/pytorch/pull/85667. +@pytest.mark.filterwarnings("ignore:`only_datapipe` is deprecated:FutureWarning") @pytest.mark.filterwarnings("error") class TestCommon: @pytest.mark.parametrize("name", datasets.list_datasets()) @@ -119,10 +125,6 @@ def test_serializable(self, dataset_mock, config): def _collate_fn(self, batch): return batch - # FIXME: Although we are not using `traverse(..., only_datapipe=...)` here directly, the `DataLoader` does. This - # will emit the warning, which in turn will fail the test if we don't ignore it. There is a push to fix this in - # https://github.com/pytorch/pytorch/pull/85667. - @pytest.mark.filterwarnings("ignore:`only_datapipe` is deprecated:FutureWarning") @pytest.mark.parametrize("num_workers", [0, 1]) @parametrize_dataset_mocks(DATASET_MOCKS) def test_data_loader(self, dataset_mock, config, num_workers):