moein-shariatnia / Deep-Learning

In-depth tutorials on deep learning. The first one is about image colorization using GANs (Generative Adversarial Nets).
MIT License
152 stars 51 forks source link

Error on pretrain_generator #4

Closed diouck closed 2 years ago

diouck commented 2 years ago

Hello, excellent your model and it is well explained. Only while running the code did I encounter this error. Do you know how to solve it. Thank you

`/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py:481: UserWarning: This DataLoader will create 4 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary. cpuset_checked))

KeyboardInterrupt Traceback (most recent call last)

in () 18 opt = optim.Adam(net_G.parameters(), lr=1e-4) 19 criterion = nn.L1Loss() ---> 20 pretrain_generator(net_G, train_dl, opt, criterion, 20) 21 torch.save(net_G.state_dict(), "res18-unet.pt") 6 frames /usr/local/lib/python3.7/dist-packages/torch/autograd/__init__.py in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables, inputs) 154 Variable._execution_engine.run_backward( 155 tensors, grad_tensors_, retain_graph, create_graph, inputs, --> 156 allow_unreachable=True, accumulate_grad=True) # allow_unreachable flag 157 158 KeyboardInterrupt: `
moein-shariatnia commented 2 years ago

Hi, Thanks. This highlighted error is saying that you need to lower the num_workers when building the dataloader in make_dataloaders function in the tutorial. You can set it to 2 or even 0 and see if this resolves the issue. The error is not related to pretrain_generator.

diouck commented 2 years ago

Thank you, that's exactly it. Otherwise I had one last question. Is the resolution of the output image degraded? For example if I have a satellite image of 50cm resolution per pixel, will the output image be 50cm too? Thank you

moein-shariatnia commented 2 years ago

Glad it resolved the issue; so, I will close this issue. About your second question I can say that all the images get resized to 256 * 256 in this tutorial.