Are you running your code in a Jupyter notebook?
In the past we have some issues of “hidden” error messages and running your script in a terminal using python script.py args with num_workers=0 might give you the real error.
Also, is the DataLoader successfully loading a whole epoch if you set num_workers=0?
It looks like you are using some Linux OS and it shouldn’t be necessary, but could you wrap your code in an if-clause protection:
import torch

def main()
    for i, data in enumerate(dataloader):
        # do something here

if __name__ == '__main__':
    main()