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

Dataset hanging problem in Pytorch #1

Open
parkseobin opened this issue Apr 6, 2020 · 2 comments
Open

Dataset hanging problem in Pytorch #1

parkseobin opened this issue Apr 6, 2020 · 2 comments

Comments

@parkseobin
Copy link
Owner

parkseobin commented Apr 6, 2020

There is a very nasty problem involving pytorch DataLoader. In the log below, you notice that dataloader delay is 6s while the overall epoch takes only 8s. Tensorflow2 only takes 3s for one epoch on same settings(TODO: make tf2 time consumption test code).

Log: (in branch pytorch_dataset_hanging_problem)

[*] Start training

***> dataloader delay: 5.8484
>> end of iteration (time interval: 0.0408) ) 


[2020-04-06 22:22:14]
>> epoch 1       loss: 0.045038 (lr: 1.00e-03)

***> dataloader delay: 6.1289
>> end of iteration (time interval: 0.0431) ) 


[2020-04-06 22:22:26]
>> epoch 2       loss: 0.001379 (lr: 1.00e-03)

Possible scenarios:

  1. On every start of epoch, there is a heavy operation done by DataLoader. For example, remaking threads, thus re-copying each resources.

  2. Iteration doesn't start until each worker completes on batch(=32).

Useful links:

https://discuss.pytorch.org/t/dataloader-with-num-workers-1-hangs-every-epoch/20323/9
https://discuss.pytorch.org/t/dataloader-resets-dataset-state/27960/4
https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader

@parkseobin
Copy link
Owner Author

#2

@parkseobin
Copy link
Owner Author

Just iterate on one dataloader without thinking about "epoch". #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant