You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with Ray Train, using the ray.train.torch.prepare_data_loader method with a dataset that returns a dictionary instead of a tuple from its __getitem__ method causes issues.
That's because in the _WrappedDataLoader class, the _move_to_device method only deals with a tuple:
logger.debug(f"Item {i} cannot be moved to device "f"{self.device}.")
returni
withtorch.cuda.stream(self._memcpy_stream):
returntuple(try_move_device(i) foriinitem)
Ideally, this should deal with a dictionary type batch and an arbitrary level of nesting just like Pytorch does.
Versions / Dependencies
Python: 3.8.10
Ray: Tested with 1.13.0. Code hasn't changed in master except for a move from torch.py -> train_loop_utils.py
Reproduction script
Using any dataset that returns a dictionary from its getitem method should demonstrate this issue.
Issue Severity
Medium: It is a significant difficulty but I can work around it.
The text was updated successfully, but these errors were encountered:
VishDev12
added
bug
Something that is supposed to be working; but isn't
triage
Needs triage (eg: priority, bug/not-bug, and owning component)
labels
Jul 8, 2022
xwjiang2010
added
P2
Important issue, but not time-critical
air
and removed
triage
Needs triage (eg: priority, bug/not-bug, and owning component)
labels
Jul 8, 2022
Hi folks, I have a Draft PR for this issue. Is this what we are intending to do here for dict handling ? Please provide feedback when you get a chance.
What happened + What you expected to happen
When working with Ray Train, using the
ray.train.torch.prepare_data_loader
method with a dataset that returns a dictionary instead of a tuple from its__getitem__
method causes issues.That's because in the
_WrappedDataLoader
class, the_move_to_device
method only deals with a tuple:ray/python/ray/train/torch/train_loop_utils.py
Lines 539 to 551 in 6dd564d
Ideally, this should deal with a dictionary type batch and an arbitrary level of nesting just like Pytorch does.
Versions / Dependencies
Python: 3.8.10
Ray: Tested with 1.13.0. Code hasn't changed in master except for a move from
torch.py -> train_loop_utils.py
Reproduction script
Using any dataset that returns a dictionary from its getitem method should demonstrate this issue.
Issue Severity
Medium: It is a significant difficulty but I can work around it.
The text was updated successfully, but these errors were encountered: