Skip to content
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

Add warnings checks for v2 namespaces #7288

Merged
merged 6 commits into from
Feb 21, 2023

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Feb 20, 2023

This PR adds tests related to warnings we raise in the v2 namespaces (transforms, datapoints, dataset wrapper). Also added import tests related to the deprecated function_pil and functiona_tensor modules

cc @vfdev-5 @pmeier

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

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

A few minor comments inline. Instead of scattering these tests in multiple files, should we maybe put them all into test_namespaces.py or the like?

test/common_utils.py Outdated Show resolved Hide resolved
test/test_transforms_v2.py Show resolved Hide resolved


torchvision.disable_beta_transforms_warning()

from common_utils import CUDA_NOT_AVAILABLE_MSG, IN_FBCODE, IN_OSS_CI, IN_RE_WORKER, OSS_CI_GPU_NO_CUDA_MSG
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you add this for #7265 or because we actually need it for these tests. I'm not against it, but want to make sure I understand correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is mostly a drive-by, I stole it from #7282.

I think #7278 added some v2 imports in common_utils and we started seeing the warnings in the test suite, so now we have to disable them before we import anything from common_utils.

@NicolasHug
Copy link
Member Author

Instead of scattering these tests in multiple files, should we maybe put them all into test_namespaces.py or the like?

I put the v2-related test in test_transforms_v2.py, the rest is related to the deprecated functional_[pil, tensor].py so I feel like they should be separate?

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

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

Yeah after the duplicate removal, it looks a lot nicer. Especially since we will have all tests in a single file after 0.17. Thanks Nicolas!

),
)
@pytest.mark.parametrize("from_private", (True, False))
def test_functional_deprecation_warning(import_statement, from_private):
Copy link
Member Author

@NicolasHug NicolasHug Feb 20, 2023

Choose a reason for hiding this comment

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

I realize this is slightly overkill, we don't need assert_run_python_script to check the warnings of the deprecated (public) files, we could just use a normal test. But we kinda still need it to properly check the lack of warnings for the now private files, so I mixed both. The whole thing will be removed soon anyway.

@malfet
Copy link
Contributor

malfet commented Feb 27, 2023

This broke unittest for 3.10, as one can observe in hud:
image

facebook-github-bot pushed a commit that referenced this pull request Mar 29, 2023
…7288)

Summary: Co-authored-by: Philip Meier <[email protected]>

Reviewed By: vmoens

Differential Revision: D44416588

fbshipit-source-id: 745e518fcca11abee87de3ced91571206c2e13fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants