Skip to content
Discussion options

You must be logged in to vote

I see. It is not necessarily a good idea to use a data_list with num_workers > 0 since the loader has to move every element of this list to shared memory separately. One thing you can try is to convert your data_list to an InMemoryDataset:

class MyDataset(InMemoryDataset):

    def __init__(self, data_list):
        super().__init__(None)
        self.data, self.slices = self.collate(data_list)


dataset = MyDataset(train_data_list)

loader = DataLoader(
    dataset,
    batch_size=32,
    shuffle=True,
    num_workers=2,
)

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@rusty1s
Comment options

@yaoysyao
Comment options

@yaoysyao
Comment options

@rusty1s
Comment options

Answer selected by yaoysyao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants