Skip to content

does each worker (num_workers>1) has its own instance of the Dataset object? #14166

Discussion options

You must be logged in to vote

It's because when you use num_workers> 0, the data is loaded, and the collate_fn is called inside the worker and that fetched data is pushed to the main process. So all the updates are happening inside the sub-worker process, but training_step runs on the main process, so no effect is reflected there.

potential sol you can try: https://stackoverflow.com/questions/63460992/how-do-i-fix-the-dataset-to-return-desired-output-pytorch

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@malfonsoarquimea
Comment options

Answer selected by malfonsoarquimea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment