threestudio-project / threestudio

A unified framework for 3D content generation.
Apache License 2.0
5.92k stars 457 forks source link

Problem with tinycudann #440

Open notdanilo opened 4 months ago

notdanilo commented 4 months ago

I am facing this after setting up the Docker project:

dreamer@9d615a31c0af:~/threestudio$ python launch.py --config configs/dreamfusion-if.yaml --train --gpu 0 system.prompt_processor.prompt="white flully dog :)" trainer.max_steps=10000 system.prompt_processor.spawn=false
Traceback (most recent call last):
  File "/home/dreamer/threestudio/launch.py", line 301, in <module>
    main(args, extras)
  File "/home/dreamer/threestudio/launch.py", line 135, in main
    import threestudio
  File "/home/dreamer/threestudio/threestudio/__init__.py", line 55, in <module>
    from . import data, models, systems
  File "/home/dreamer/threestudio/threestudio/data/__init__.py", line 1, in <module>
    from . import co3d, image, multiview, uncond
  File "/home/dreamer/threestudio/threestudio/data/co3d.py", line 17, in <module>
    from threestudio.data.uncond import (
  File "/home/dreamer/threestudio/threestudio/data/uncond.py", line 14, in <module>
    from threestudio.utils.base import Updateable
  File "/home/dreamer/threestudio/threestudio/utils/__init__.py", line 1, in <module>
    from . import base
  File "/home/dreamer/threestudio/threestudio/utils/base.py", line 7, in <module>
    from threestudio.utils.misc import get_device, load_module_weights
  File "/home/dreamer/threestudio/threestudio/utils/misc.py", line 6, in <module>
    import tinycudann as tcnn
  File "/home/dreamer/.local/lib/python3.10/site-packages/tinycudann/__init__.py", line 9, in <module>
    from tinycudann.modules import free_temporary_memory, NetworkWithInputEncoding, Network, Encoding
  File "/home/dreamer/.local/lib/python3.10/site-packages/tinycudann/modules.py", line 51, in <module>
    _C = importlib.import_module(f"tinycudann_bindings._{cc}_C")
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /home/dreamer/.local/lib/python3.10/site-packages/tinycudann_bindings/_89_C.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN2at4_ops5zeros4callEN3c108ArrayRefINS2_6SymIntEEENS2_8optionalINS2_10ScalarTypeEEENS6_INS2_6LayoutEEENS6_INS2_6DeviceEEENS6_IbEE
XueyingJia commented 4 months ago

Got saimilar issue

dreamer@e4ec35602742:~/threestudio$ python launch.py --config configs/zero123.yaml --train --gpu 0 data.image_path=./load/images/dog1_rgba.png Traceback (most recent call last): File "/home/dreamer/threestudio/launch.py", line 301, in main(args, extras) File "/home/dreamer/threestudio/launch.py", line 135, in main import threestudio File "/home/dreamer/threestudio/threestudio/init.py", line 55, in from . import data, models, systems File "/home/dreamer/threestudio/threestudio/data/init.py", line 1, in from . import co3d, image, multiview, uncond File "/home/dreamer/threestudio/threestudio/data/co3d.py", line 17, in from threestudio.data.uncond import ( File "/home/dreamer/threestudio/threestudio/data/uncond.py", line 14, in from threestudio.utils.base import Updateable File "/home/dreamer/threestudio/threestudio/utils/init.py", line 1, in from . import base File "/home/dreamer/threestudio/threestudio/utils/base.py", line 7, in from threestudio.utils.misc import get_device, load_module_weights File "/home/dreamer/threestudio/threestudio/utils/misc.py", line 6, in import tinycudann as tcnn File "/home/dreamer/.local/lib/python3.10/site-packages/tinycudann/init.py", line 9, in from tinycudann.modules import free_temporary_memory, NetworkWithInputEncoding, Network, Encoding File "/home/dreamer/.local/lib/python3.10/site-packages/tinycudann/modules.py", line 51, in _C = importlib.import_module(f"tinycudannbindings.{cc}_C") File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: /home/dreamer/.local/lib/python3.10/site-packages/tinycudann_bindings/_75_C.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN2at4_ops5zeros4callEN3c108ArrayRefINS2_6SymIntEEENS2_8optionalINS2_10ScalarTypeEEENS6_INS2_6LayoutEEENS6_INS2_6DeviceEEENS6_IbEE

notdanilo commented 4 months ago

This issue seem to be linked. I am working on getting gcc10 up on the system. I will report back if I succeed https://github.com/threestudio-project/threestudio/issues/438

andytriboletti commented 4 months ago

I got it installed. I commented out tinycudann in the requirements file, ran and then commented it back in, run pip install again. I created a new conda to do this. I had said gcc version 10 in the other bug but im using 11 and it works. I'm currently stuck on exporting a mesh. It is running with no progress. But the video was generated.

https://blog.andytriboletti.com/2024/02/26/installing-dreamfusion-on-ubuntu-wsl-windows/

andytriboletti commented 4 months ago

I increased the ram in my machine and was able to export a mesh. One problem I saw is the mesh is not oriented the same way as the video and pictures. Screenshot 2024-03-03 191637

gganjang commented 4 months ago

I had the same problem but solved it.

Environment

I followed the installation instruction in the link below: https://www.youtube.com/watch?v=jaRr5W80N8E&t=260s

After that, I encountered the same issue you are experiencing, but found this solution.

As the link below states: https://github.com/autonomousvision/sdfstudio/issues/33

It seems that _89_C.cpython-310-x86_64-linux-gnu.so is the problem, so you need to re-build your tinycudann by yourself (which is easy. just follow the instruction in the comment in the link)

once the build is complete, COPY '_89_C.cpython-310-x86_64-linux-gnu.so' UNDER 'tiny-cuda-nn/bindings/torch/build/lib.linux-x86_64-cpython-310/tinycudann_bindings' TO '/home/dreamer/.local/lib/python3.10/site-packages/tinycudann_bindings/' in your case.

RYYAI commented 3 months ago

This issue seem to be linked. I am working on getting gcc10 up on the system. I will report back if I succeed #438

did gcc10 solve this problem?

Wisriter commented 3 months ago

I meet the same problem, has anyone solved this problem?

ivanpuhachov commented 3 months ago

@Wisriter solved this by builing tiny-cuda-nn separately as @gganjang suggested. https://github.com/NVlabs/tiny-cuda-nn I just followed the instructions there

git clone --recursive https://github.com/nvlabs/tiny-cuda-nn
cd tiny-cuda-nn
cmake . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build --config RelWithDebInfo -j

Build took approx 20 minutes. In my case it also complained that "The detected CUDA version (11.8) mismatches the version that was used to compile PyTorch (12.1). Please make sure to use the same CUDA versions." Which is solved by pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118

Then:

cd bindings/torch
python setup.py install
ArielQuinn commented 3 months ago

FYI, if you're using the docker approach, this looks like it is happening because when we install xformers as part of the pip install -r requirements.txt step, xformers is upgrading the version of torch. (I did a pip freeze in my container and found it was torch==2.2.2 even though we explicitly set it in an earlier step of the docker container: pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 --index-url https://download.pytorch.org/whl/cu118. I recommend that somebody go and pin all the versions in requirements.txt as per the recommendations in this guide so this doesn't happen again. I would do it myself, but I don't have approval. P.S. This is an awesome project! Love what you guys are doing here. :)

ivanpuhachov commented 3 months ago

@ArielQuinn you are right, it was mentioned in xformers issue #380 For me pip3 install -U xformers==0.0.23 --index-url https://download.pytorch.org/whl/cu118 worked

koyy001 commented 2 months ago

I had the same problem but solved it.

Environment

  • WSL2 Ubuntu 20.04.6 LTS

I followed the installation instruction in the link below: https://www.youtube.com/watch?v=jaRr5W80N8E&t=260s

After that, I encountered the same issue you are experiencing, but found this solution.

As the link below states: autonomousvision/sdfstudio#33

It seems that _89_C.cpython-310-x86_64-linux-gnu.so is the problem, so you need to re-build your tinycudann by yourself (which is easy. just follow the instruction in the comment in the link)

once the build is complete, COPY '_89_C.cpython-310-x86_64-linux-gnu.so' UNDER 'tiny-cuda-nn/bindings/torch/build/lib.linux-x86_64-cpython-310/tinycudann_bindings' TO '/home/dreamer/.local/lib/python3.10/site-packages/tinycudann_bindings/' in your case.

solved!!! thanks!!!!!!!!!!!!!!!

crystalthoughts commented 1 month ago

This is still an issue, is it possible to alter the Docker file so that it installs in one go? That's supposed to be the point of them!

ivanpuhachov commented 1 month ago

@crystalthoughts I guess we can comment on this pull request to fix this https://github.com/threestudio-project/threestudio/pull/472