THU-luvision / XScale-NVS

The official implementation of the CVPR'24 paper titled "XScale-NVS: Cross-Scale Novel View Synthesis with Hash Featurized Manifold".
MIT License
106 stars 7 forks source link

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu) #8

Closed itsrealkk closed 3 months ago

itsrealkk commented 3 months ago

Hi, i'm running this project on my custom data, i used Metashape to export cams.xml and model's obj. then when i tried to run the following code for ray caching

bash graphs/warping/warp.sh

it shows following error

self.summary_dir /home/kk/Projects/XScale-NVS/test/record/experiment/train/log/0328/SCENE_NAME
start mesh initialization
finish mesh initialization
  0%|                                                                                        | 0/578 [00:00<?, ?it/s]Loading:  ['frame_00002']
images:  1
cameraPoses:  torch.Size([1, 4, 4])
cameraPositions torch.Size([1, 3])
lit:  tensor(0)
  0%|                                                                                        | 0/578 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/home/kk/Projects/XScale-NVS/graphs/warping/giga_warping.py", line 166, in <module>
    warping_machine()
  File "/home/kk/miniconda3/envs/xscalenvs1/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/kk/miniconda3/envs/xscalenvs1/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/kk/Projects/XScale-NVS/graphs/warping/giga_warping.py", line 126, in forward
    colour = images_ori_batch[inlier_mask[v, ..., 0]].detach().cpu()
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

Is there something wrong with the code or my process?

Thx a lot.

GuangyuWang99 commented 3 months ago

Hi @itsrealkk,

Thanks for reporting this issue. Actually this is caused by a mismatch between pytorch versions. In the latest commit, the code regarding this issue is modified to adapt to newer pytorch versions. And you can just pull the latest commit to try it again.

itsrealkk commented 3 months ago

Thx a lot, it solved my problem