Skip to content

shufflebuffer is not compatible with the dataloader #4478

@wyli

Description

@wyli

Describe the bug

import monai

buffer = monai.data.ShuffleBuffer([1,2,3,4])
for x in monai.data.DataLoader(buffer, batch_size=2):
    print(x)
    for x in monai.data.DataLoader(buffer, batch_size=2):
  File "/Users/Documents/MONAI/monai/data/dataloader.py", line 78, in __init__
    set_rnd(dataset, int(_seed))
  File "/Users/Documents/MONAI/monai/data/utils.py", line 624, in set_rnd
    obj.set_random_state(seed=seed % MAX_SEED)
  File "/Users/Documents/MONAI/monai/data/iterable_dataset.py", line 119, in set_random_state
    raise NotImplementedError(f"`set_random_state` is not available in {self.__class__.__name__}.")
NotImplementedError: `set_random_state` is not available in ShuffleBuffer.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions