daitao / SAN

Second-order Attention Network for Single Image Super-resolution (CVPR-2019)
550 stars 106 forks source link

ImportError: cannot import name '_update_worker_pids' #37

Open shazib-summar opened 4 years ago

shazib-summar commented 4 years ago

Specs: OS: Ubuntu 18.04 PyTorch: 1.3.1 Python: 3.6.9

Command: python3 main.py --model san --data_test MyImage --save save_name --scale 4 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --test_only --testpath 'your path' --testset Set5 --pre_train ../model/SAN_BIX4.pt

Output:

  File "main.py", line 4, in <module>
    import data
  File "<some_directory_containing_SAN>/SAN/TestCode/code/data/__init__.py", line 3, in <module>
    from dataloader import MSDataLoader
  File "<some_directory_containing_SAN>/SAN/TestCode/code/dataloader.py", line 10, in <module>
    from torch._C import _set_worker_signal_handlers, _update_worker_pids, \
ImportError: cannot import name '_update_worker_pids'

Problem Upon running the specified command, the provided output is returned. I'm confused as to how everyone else has been able to run the network. Any help would be sincerely appreciated.

Akshaypatil7 commented 4 years ago

Have you solved this problem

shazib-summar commented 4 years ago

TLDR: No

This is due to version mismatch of PyTorch. This model, I believe, is based on PyTorch 0.3.1. If you use this version, this issue does not occur. Now this gives rise to a new problem as PyTorch 0.3.1 is old school. You could modify the code so that it can run on PyTorch 1.4 or whatever version you have. So, I guess it up to how seriously do you need this specific model, otherwise, there are quite a few other SR GANs available.

You might want to see this, this and specifically this comment

liucong521 commented 3 years ago

Has this problem been solved? How to solve it, can you teach me?

shazib-summar commented 3 years ago

@liucong12345678 see my above-mentioned comment

prakanshuls22 commented 3 years ago

The version conflict is just a rename issue I guess. You can try to replace _update_worker_pids with _set_worker_pids. I think it should work.