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

fix MPRS request index cycle #1311

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions torchdata/dataloader2/communication/iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,17 +431,16 @@ def __iter__(self):
disabled_pipe[res_idx] = True
cnt_disabled_pipes += 1
disabled = True
req_idx = next(req_idx_cycle)
else:
# Only request if buffer is empty and has not reached the limit
if len(self.res_buffers[res_idx]) == 0 and (
self._limit is None or self._request_cnt < self._limit
):
self.datapipes[req_idx].protocol.request_next()
req_idx = next(req_idx_cycle)
self._request_cnt += 1
total_req_cnt += 1
total_res_cnt += 1
req_idx = next(req_idx_cycle)
res_idx = next(res_idx_cycle)
if not disabled:
yield response.value
Expand Down