Skip to content

Turn warnings in prototype datasets tests into errors #5540

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 6 commits into from
Mar 25, 2022

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Mar 3, 2022

I noticed a couple of warnings in the prototype datasets test suite:

test/test_prototype_builtin_datasets.py: 341 warnings
  /home/circleci/.local/lib/python3.7/site-packages/torch/utils/data/datapipes/utils/common.py:110: DeprecationWarning: _DataPipeMeta and its functional API are deprecated and will be removed from the package `torch`. Please use ZipArchiveLoader instead.
    new_name_statement, DeprecationWarning)

test/test_prototype_builtin_datasets.py: 860 warnings
  /home/circleci/.local/lib/python3.7/site-packages/torch/utils/data/datapipes/utils/common.py:110: DeprecationWarning: _DataPipeMeta and its functional API are deprecated and will be removed from the package `torch`. Please use TarArchiveLoader instead.
    new_name_statement, DeprecationWarning)

test/test_prototype_builtin_datasets.py: 10 warnings
  /home/circleci/.local/lib/python3.7/site-packages/scipy/io/matlab/mio5.py:493: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
    narr = np.asanyarray(source)

test/test_prototype_builtin_datasets.py: 18 warnings
  /home/circleci/project/torchvision/prototype/features/_image.py:38: UserWarning: Unable to guess a specific color space. Consider passing it explicitly.
    warnings.warn("Unable to guess a specific color space. Consider passing it explicitly.")

From top to bottom this PR does the following to fix them:

  • Replace the deprecated (Zip|Tar)ArchiveReader with (Zip|Tar)ArchiveLoader. This is related to the first two warnings although it is not immediately clear. See Warnings for deprecated datapipes are insufficient data#322 for details.
  • Suppress a warning emitted by internals of scipy.io.savemat that we have no control over
  • Fix an error PCAM dataset that was missed during review that leads to a warning in the test suite.

Additionally, this PR enforces that in the future datasets test are not allowed to raise any warnings.

@facebook-github-bot
Copy link

facebook-github-bot commented Mar 3, 2022

💊 CI failures summary and remediations

As of commit 1718a82 (more details on the Dr. CI page):



🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build binary_libtorchvision_ops_android (1/1)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-03-25T15:36:52.910+0000 [QUIET] [system.ou...ake 3.10.2.4988404: archive is not a ZIP archive.:
2022-03-25T15:36:50.496+0000 [INFO] [com.android.build.gradle.internal.cxx.logging.IssueReporterLoggingEnvironment] No CMake version was specified in build.gradle. Using default version 3.10.2.
2022-03-25T15:36:50.498+0000 [INFO] [com.android.build.gradle.internal.cxx.logging.IssueReporterLoggingEnvironment] No CMake version was specified in build.gradle. Using default version 3.10.2.
2022-03-25T15:36:50.524+0000 [INFO] [com.android.build.gradle.internal.cxx.logging.ThreadLoggingEnvironment$Companion$BottomLoggingEnvironment] No CMake version was specified in build.gradle. Using default version 3.10.2.
2022-03-25T15:36:50.524+0000 [INFO] [com.android.build.gradle.internal.cxx.logging.ThreadLoggingEnvironment$Companion$BottomLoggingEnvironment] Trying to locate CMake in local SDK repository.
2022-03-25T15:36:50.524+0000 [INFO] [com.android.build.gradle.internal.cxx.logging.ThreadLoggingEnvironment$Companion$BottomLoggingEnvironment] - Downloading '3.10.2'.
2022-03-25T15:36:50.608+0000 [QUIET] [system.out] Checking the license for package CMake 3.10.2.4988404 in /opt/android/sdk/licenses
2022-03-25T15:36:50.608+0000 [QUIET] [system.out] License for package CMake 3.10.2.4988404 accepted.
2022-03-25T15:36:50.608+0000 [QUIET] [system.out] Preparing "Install CMake 3.10.2.4988404 (revision: 3.10.2)".
2022-03-25T15:36:50.610+0000 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@5c84b9b15 pairs: {GET /android/repository/cmake-3.10.2-linux-x86_64.zip HTTP/1.1: null}{User-Agent: Java/11.0.12}{Host: dl.google.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
2022-03-25T15:36:50.631+0000 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@60d42cc716 pairs: {null: HTTP/1.1 200 OK}{Accept-Ranges: bytes}{Content-Disposition: attachment}{Content-Security-Policy: default-src 'none'}{Server: downloads}{X-Content-Type-Options: nosniff}{X-Frame-Options: SAMEORIGIN}{X-Xss-Protection: 0}{Date: Fri, 25 Mar 2022 15:36:50 GMT}{Cache-Control: public,max-age=86400}{Last-Modified: Mon, 24 Sep 2018 20:11:42 GMT}{ETag: "2bcf6d"}{Content-Type: application/zip}{Content-Length: 14275684}{Age: 0}{Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"}
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] Warning: An error occurred while preparing SDK package CMake 3.10.2.4988404: archive is not a ZIP archive.:
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] java.util.zip.ZipException: archive is not a ZIP archive
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at org.apache.commons.compress.archivers.zip.ZipFile.positionAtEndOfCentralDirectoryRecord(ZipFile.java:871)
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:801)
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:542)
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:217)
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:193)
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:154)
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at com.android.repository.util.InstallerUtil.unzip(InstallerUtil.java:98)
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at com.android.repository.impl.installer.BasicInstaller.doPrepare(BasicInstaller.java:84)
2022-03-25T15:36:52.910+0000 [QUIET] [system.out] 	at com.android.repository.impl.installer.AbstractPackageOperation.prepare(AbstractPackageOperation.java:337)

1 failure not recognized by patterns:

Job Step Action
CircleCI cmake_linux_gpu Build torchvision C++ distribution and test 🔁 rerun

🚧 3 ongoing upstream failures:

These were probably caused by upstream breakages that are not fixed yet.


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Conflicts:
	torchvision/prototype/datasets/_builtin/imagenet.py
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

Though you are doing quite a few changes more than what you describe. Might be worth disclosing this on the PR description.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks @pmeier ,

@pmeier
Copy link
Collaborator Author

pmeier commented Mar 25, 2022

If this comes back to bite us (see #5540 (comment)): @pytest.mark.filterwarnings("error:::torch(vision|data)?.*") is the decorator that will only fail the tests in case the warning is coming from torch, torchvision, or torchdata.

@pmeier pmeier merged commit 43dbfd2 into pytorch:main Mar 25, 2022
@pmeier pmeier deleted the prototype-datasets-tests-warnings branch March 25, 2022 15:49
facebook-github-bot pushed a commit that referenced this pull request Apr 5, 2022
Summary:
* fix PCAM prototype dataset

* update Zip and Tar archive loader datapipes

* only fail on warnings from the pytorch ecosystem

* Revert "only fail on warnings from the pytorch ecosystem"

This reverts commit 2bf3aa6.

(Note: this ignores all push blocking failures!)

Reviewed By: datumbox

Differential Revision: D35216776

fbshipit-source-id: 2cf636ea5c037da771ab2c46ed6b632b4780d477
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