After training on server, I got DS-GAN-Epoch300.pth, I wanted to use this weight for single-card inference.
I changed device_ids = [0, 1, 2, 3] to device_ids = [0], and ran infer.py, then I got this error:
Traceback (most recent call last):
File "/data/PosterLayout-CVPR2023/infer.py", line 114, in <module>
main()
File "/data/PosterLayout-CVPR2023/infer.py", line 111, in main
test(G, testing_dl, 1)
File "/data/PosterLayout-CVPR2023/infer.py", line 58, in test
cls, box = G(imgs, fix_noise)
File "/data/anaconda3/envs/pl/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/data/anaconda3/envs/pl/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 166, in forward
return self.module(*inputs[0], **kwargs[0])
File "/data/anaconda3/envs/pl/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/data/PosterLayout-CVPR2023/model.py", line 99, in forward
lstm_output = self.cnnlstm(layout, h0)
File "/data/anaconda3/envs/pl/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/data/PosterLayout-CVPR2023/model.py", line 78, in forward
output, _ = self.lstm(x, (torch.zeros_like(h0).contiguous(), h0.contiguous()))
File "/data/anaconda3/envs/pl/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/data/anaconda3/envs/pl/lib/python3.9/site-packages/torch/nn/modules/rnn.py", line 767, in forward
self.check_forward_args(input, hx, batch_sizes)
File "/data/anaconda3/envs/pl/lib/python3.9/site-packages/torch/nn/modules/rnn.py", line 693, in check_forward_args
self.check_hidden_size(hidden[0], self.get_expected_hidden_size(input, batch_sizes),
File "/data/anaconda3/envs/pl/lib/python3.9/site-packages/torch/nn/modules/rnn.py", line 226, in check_hidden_size
raise RuntimeError(msg.format(expected_hidden_size, list(hx.size())))
RuntimeError: Expected hidden[0] size (8, 4, 256), got [8, 1, 256]
Would you please try this, or offer some tips and instructions on single-card inference? Thank you!
After training on server, I got
DS-GAN-Epoch300.pth
, I wanted to use this weight for single-card inference.I changed
device_ids = [0, 1, 2, 3]
todevice_ids = [0]
, and raninfer.py
, then I got this error:Would you please try this, or offer some tips and instructions on single-card inference? Thank you!