# Guidelines for assigning num\_workers to DataLoader

**URL:** <https://discuss.pytorch.org/t/guidelines-for-assigning-num-workers-to-dataloader/813>\
**Category:** Uncategorized\
**Created:** [March 1, 2017, 7:03pm UTC](https://discuss.pytorch.org/t/guidelines-for-assigning-num-workers-to-dataloader/813 "2017-03-01T19:03:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![apaszke](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/apaszke/32/21_2.png) [@apaszke](https://discuss.pytorch.org/u/apaszke)\
**Post date:** [March 1, 2017, 9:55pm UTC](https://discuss.pytorch.org/t/guidelines-for-assigning-num-workers-to-dataloader/813/2 "2017-03-01T21:55:58Z")

</div>

Having more workers will increase the memory usage and that’s the most serious overhead. I’d just experiment and launch approximately as many as are needed to saturate the training. It depends on the batch size, but I wouldn’t set it to the same number - each worker loads a single batch and returns it only once it’s ready.

num\_workers equal 0 means that it’s the main process that will do the data loading when needed, num\_workers equal 1 is the same as any n, but you’ll only have a single worker, so it might be slow

---

_[View the full topic](https://discuss.pytorch.org/t/guidelines-for-assigning-num-workers-to-dataloader/813)._
