microsoft / Bringing-Old-Photos-Back-to-Life

Bringing Old Photo Back to Life (CVPR 2020 oral)
https://arxiv.org/abs/2004.09484
MIT License
15.14k stars 2k forks source link

ModuleNotFoundError: No module named 'torch' #250

Open whitenight1985 opened 1 year ago

whitenight1985 commented 1 year ago

image ┌──(root㉿kali)-[/home/kirisawa/Bringing-Old-Photos-Back-to-Life] └─# python3 run.py
Running Stage 1: Overall restoration Traceback (most recent call last): File "/home/kirisawa/Bringing-Old-Photos-Back-to-Life/Global/test.py", line 6, in from torch.autograd import Variable ModuleNotFoundError: No module named 'torch' Traceback (most recent call last): File "/home/kirisawa/Bringing-Old-Photos-Back-to-Life/run.py", line 102, in for x in os.listdir(stage_1_results): FileNotFoundError: [Errno 2] No such file or directory: '/home/kirisawa/Bringing-Old-Photos-Back-to-Life/output/stage_1_restore_output/restored_image'

I've run the requirements .txt but I'm still having problems.😭😭

hanling1 commented 1 year ago

I met this problem too. I tried to re-install the torch by whl, but that not works. Python 3.9

Running Stage 1: Overall restoration Traceback (most recent call last): File "test.py", line 6, in from torch.autograd import Variable ImportError: No module named torch.autograd Finish Stage 1 ...

Running Stage 2: Face Detection Traceback (most recent call last): File "detect_all_dlib.py", line 4, in import torch ImportError: No module named torch Finish Stage 2 ...

...

zhangfeifei0907 commented 1 year ago

image

gyh-1 commented 1 year ago

Have you solved the problem? I met the same one.

boonyachengdu commented 1 year ago

root@master:/usr/local/ai/Bringing-Old-Photos-Back-to-Life# pip install -r requirements.txt Collecting torch Killed root@master:/usr/local/ai/Bringing-Old-Photos-Back-to-Life#

root@master:/usr/local/ai/Bringing-Old-Photos-Back-to-Life# python run.py --input_folder /usr/local/ai/Bringing-Old-Photos-Back-to-Life/input_folder --output_folder /usr/local/ai/Bringing-Old-Photos-Back-to-Life/output_folder --GPU 0 Running Stage 1: Overall restoration Traceback (most recent call last): File "test.py", line 6, in from torch.autograd import Variable ModuleNotFoundError: No module named 'torch' Finish Stage 1 ...

Running Stage 2: Face Detection Traceback (most recent call last): File "detect_all_dlib.py", line 4, in import torch ModuleNotFoundError: No module named 'torch' Finish Stage 2 ...

Running Stage 3: Face Enhancement Traceback (most recent call last): File "test_face.py", line 7, in import data File "/usr/local/ai/Bringing-Old-Photos-Back-to-Life/Face_Enhancement/data/init.py", line 5, in import torch.utils.data ModuleNotFoundError: No module named 'torch' Finish Stage 3 ...

Running Stage 4: Blending Traceback (most recent call last): File "align_warp_back_multiple_dlib.py", line 4, in import torch ModuleNotFoundError: No module named 'torch' Finish Stage 4 ...

All the processing is done. Please check the results. root@master:/usr/local/ai/Bringing-Old-Photos-Back-to-Life#

digvijayu commented 1 year ago

Having the same problem any ideas how to fix this, tried installing torch several times but no use with pip list I can see its installed

image
ChitturiSaiSuman commented 1 year ago

Changing python in line #55 in the run.py to python3 worked for me. But, sadly I don't have an NVIDIA GPU in my Laptop.