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.15k stars 2k forks source link

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same #151

Closed energy888666 closed 3 years ago

energy888666 commented 3 years ago

python run.py --input_folder test_images\old_w_scratch --output_folder output --GPU -1 --with_scratch Running Stage 1: Overall restoration initializing the dataloader model weights loaded directory of testing image: D:\project\Bringing-Old-Photos-Back-to-Life\test_images\old_w_scratch processing 1.png Traceback (most recent call last): File "detection.py", line 174, in main(config) File "detection.py", line 144, in main P = torch.sigmoid(model(scratch_image_scale)) File "D:\ProgramData\Anaconda3\envs\GAN\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "D:\project\Bringing-Old-Photos-Back-to-Life\Global\detection_models\networks.py", line 112, in forward x = self.first(x) File "D:\ProgramData\Anaconda3\envs\GAN\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "D:\ProgramData\Anaconda3\envs\GAN\lib\site-packages\torch\nn\modules\container.py", line 119, in forward input = module(input) File "D:\ProgramData\Anaconda3\envs\GAN\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "D:\ProgramData\Anaconda3\envs\GAN\lib\site-packages\torch\nn\modules\conv.py", line 399, in forward return self._conv_forward(input, self.weight, self.bias) File "D:\ProgramData\Anaconda3\envs\GAN\lib\site-packages\torch\nn\modules\conv.py", line 396, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same You are using NL + Res Finish Stage 1 ...

Running Stage 2: Face Detection Finish Stage 2 ...

sjscotti commented 3 years ago

I am having the same problem when I use the flags --GPU -1 --with_scratch The runtime error does not appear to depend on the image size since it also occurs when I use a small image that would work with --GPU 0