kwea123 / nerf_pl

NeRF (Neural Radiance Fields) and NeRF in the Wild using pytorch-lightning
https://www.youtube.com/playlist?list=PLDV2CyUo4q-K02pNEyDr7DYpTQuka3mbV
MIT License
2.74k stars 483 forks source link

torchsearchsorted missing #107

Closed Riretta closed 3 years ago

Riretta commented 3 years ago

Describe the bug in rendering.py, there is import torchsearchsorted but it is missing and I do not get where is this file or library

To Reproduce I run the train.py with commands in the readme and I get File "/media/TBData/Rita/PyCharm_NERF_kwea/models/rendering.py", line 2, in from torchsearchsorted import searchsorted ImportError: cannot import name 'searchsorted' from 'torchsearchsorted' (unknown location)

Borailuce99 commented 3 years ago

I had the same problem recently. Searching it on internet I found that the torchsearchsorted is not required anymore. The current version of torch (I use 1.10.0+cu113) already makes what torchsearchsorted does. You just need on models > rendering.py, change "torchsearchsorted" to "torch.searchsorted" and don't import "torchsearchsorted" on the top of the code.

kwea123 commented 3 years ago

I recommend using the dev branch, which already has this change applied.

Borailuce99 commented 3 years ago

But now, I can't install torchvision 0.8.2. It shows an error:

ERROR: Could not find a version that satisfies the requirement torchvision==0.8.2 (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3, 0.5.0, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.11.1)

The 0.5.0 version depends on 1.4.0 torch's version, and the 0.9.0 depends on 1.8 so I can't install any version

Additionally, the torch version installed is "1.7.1+cpu" but I want to run the project with CUDA 11.5 and GPU.

kwea123 commented 3 years ago

@Borailuce99 You are right, it seems that torch==1.7.1 and torchvision==0.8.2 has disappeared... I will try to update to the latest pytorch and pytorch lightning versions recently. Your 1.10.0+cu113 should work out of the box though.

Borailuce99 commented 3 years ago

I installed both alternatively using the wheels commands from here https://pytorch.org/get-started/previous-versions/ and deleting the lines on the "requirements.txt". Now it works fine with torch==1.7.1+cu110 and torchvision==0.8.2+cu110 regardless of having CUDA 11.5 installed.

kwea123 commented 3 years ago

I just updated pytorch to the latest version (1.10.0). Now this should be solved.