HR-VITON
HR-VITON copied to clipboard
[train_condition.py] Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
Trying to train try-on condition generator using the script and got the error. python3 train_condition.py --cuda --Ddownx2 --Ddropout --lasttvonly --interflowloss --occlusion
Traceback (most recent call last): File "C:\Users\Admin\Desktop\TryOn\hr_viton\train_condition.py", line 498, in <module> main() File "C:\Users\Admin\Desktop\TryOn\hr_viton\train_condition.py", line 489, in main train(opt, train_loader, val_loader, test_loader, board, tocg, D) File "C:\Users\Admin\Desktop\TryOn\hr_viton\train_condition.py", line 266, in train loss_G_GAN = criterionGAN(pred_segmap, True) File "C:\Users\Admin\Desktop\TryOn\hr_viton\networks.py", line 295, in __call__ loss += self.loss(pred, target_tensor) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\torch\nn\modules\loss.py", line 520, in forward return F.mse_loss(input, target, reduction=self.reduction) File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\torch\nn\functional.py", line 3112, in mse_loss return torch._C._nn.mse_loss(expanded_input, expanded_target, _Reduction.get_enum(reduction)) RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
How can I fix it?
Hi I have a issue when I try to test the model and I think it's also a gpu/cpu issue so did you resolve yours?

there is a screenshot of mine. Maybe you can help me! Kind regards, Sabrina
Hi I have a issue when I try to test the model and I think it's also a gpu/cpu issue so did you resolve yours?
![]()
there is a screenshot of mine. Maybe you can help me! Kind regards, Sabrina
you should check the model device, your inputs used cuda but your model didnt
Who can tell me, how to prepare train_pairs.txt and test.pairs?
I have the same problem with you. Have you solved it?
File "train_condition.py", line 498, in <module>
main()
File "train_condition.py", line 489, in main
train(opt, train_loader, val_loader, test_loader, board, tocg, D)
File "train_condition.py", line 158, in train
flow_list, fake_segmap, warped_cloth_paired, warped_clothmask_paired = tocg(opt,input1, input2)
File "C:\Users\user\.conda\envs\viton\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\AI_WORKS\HR-VITON\networks.py", line 135, in forward
warped_T1 = F.grid_sample(T1, flow_norm + grid, padding_mode='border')
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!