-
Notifications
You must be signed in to change notification settings - Fork 152
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
[DataLoader2] Ensure finalize and finalize_iteration are called during shutdown/exception #846
Conversation
…g shutdown/exception [ghstack-poisoned]
…g shutdown/exception ghstack-source-id: 526069dfff1a3171c44288f8f639639784515e9e Pull Request resolved: #846
@@ -67,6 +67,11 @@ def __next__(self) -> T_co: | |||
if self.dataloader.reading_service is not None: | |||
self.dataloader.reading_service.finalize_iteration() | |||
raise | |||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Is this potentially too broad? Should I limit this to specific exceptions? I wonder if users would want to intentionally catch exceptions that are raised here (such that finalization calls aren't needed).
- We can also call
DataLoader2.shutdown()
here instead.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think calling dl2.shutdown should be good
@NivekT has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
…alled during shutdown/exception" Fixes #821 1. Ensure `finalize_iteration` is called during `DataLoader2.shutdown()` 2. If an uncaught exception is raised by `DataLoader2Iterator.next()`, ensure finalization calls are made Differential Revision: [D40569566](https://our.internmc.facebook.com/intern/diff/D40569566) [ghstack-poisoned]
…g shutdown/exception ghstack-source-id: eb65f0a99f8dbc6c4b741b0d5d295ed082a08bdc Pull Request resolved: #846
@NivekT has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
…eption (pytorch#846) Summary: Pull Request resolved: pytorch#846 Fixes pytorch#821 1. Ensure `finalize_iteration` is called during `DataLoader2.shutdown()` 2. If an uncaught exception is raised by `DataLoader2Iterator.next()`, ensure finalization calls are made Test Plan: Imported from OSS Reviewed By: ejguan Differential Revision: D40569566 Pulled By: NivekT fbshipit-source-id: f0768a62fcc6dfba1aef3a70c8c55563a45304aa
…eption (#846) Summary: Pull Request resolved: #846 Fixes #821 1. Ensure `finalize_iteration` is called during `DataLoader2.shutdown()` 2. If an uncaught exception is raised by `DataLoader2Iterator.next()`, ensure finalization calls are made Test Plan: Imported from OSS Reviewed By: ejguan Differential Revision: D40569566 Pulled By: NivekT fbshipit-source-id: f0768a62fcc6dfba1aef3a70c8c55563a45304aa
…eption (pytorch#846) Summary: Pull Request resolved: pytorch#846 Fixes pytorch#821 1. Ensure `finalize_iteration` is called during `DataLoader2.shutdown()` 2. If an uncaught exception is raised by `DataLoader2Iterator.next()`, ensure finalization calls are made Test Plan: Imported from OSS Reviewed By: ejguan Differential Revision: D40569566 Pulled By: NivekT fbshipit-source-id: f0768a62fcc6dfba1aef3a70c8c55563a45304aa
Stack from ghstack:
Fixes #821
finalize_iteration
is called duringDataLoader2.shutdown()
DataLoader2Iterator.next()
, ensure finalization calls are madeDifferential Revision: D40569566