openai / shap-e

Generate 3D objects conditioned on text or images
MIT License
11.69k stars 951 forks source link

need setup.py adding pytorch3d by default installation #118

Open james-joobs opened 11 months ago

james-joobs commented 11 months ago

I spent a week for setting up shap-e installation to use sample files Jupyter notebook. Shap-e needs to install pytorch3d independently but always faces c++, cuda dependencies aren't capable. Pytorch3d definitely needs to build mesh's representation after generate some objects and other artifacts like ply, mil, or obj etc.

I need to official manual version on installation including pytorch3d dependencies.

Thank you.

Apotrox commented 11 months ago

If you're still looking for this, here's what to do. Create a virtual enviroment for shap-e and it's dependencies (if you haven't already when trying to set it up initially). Download and install the version of pytorch corresponding to your cuda version. There is no pytorch for Cuda 12.3, i rolled back to 11.8 for that one. Uninstall the installed version of the venv if you have to. YOU. NEED. THE. CUDA. VERSION. Install wheel for python in that venv. Now clone the NVIDIA CUB repo (https://github.com/NVIDIA/cub), preferably somewhere where you won't accidentally delete it, and set this path as an System Enviroment Variable called "CUB_HOME". Reboot your pc. Follow the instructions at the bottom on https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md (basically you just run the cmd pip install "git+https://github.com/facebookresearch/pytorch3d.git"). That should take care of everything, and install it just fine. To use it, install the jupyter extention, then run python -m jupyter notebook in the venv. That should open a browser window, navigate through .\Shap-E\shap_e\examples\ and pick the one mode you want to use (img->3d, text-> 3d, etc). Open the jupyter notebook and set the variables however you like. For debugging purposes, add print(device) to the second cell. If the output of that is "cuda" you're good. When everything's ready, click Run > Run all Cells at the top. Good luck!

james-joobs commented 11 months ago

If you're still looking for this, here's what to do. Create a virtual enviroment for shap-e and it's dependencies (if you haven't already when trying to set it up initially). Download and install the version of pytorch corresponding to your cuda version. There is no pytorch for Cuda 12.3, i rolled back to 11.8 for that one. Uninstall the installed version of the venv if you have to. YOU. NEED. THE. CUDA. VERSION. Install wheel for python in that venv. Now clone the NVIDIA CUB repo (https://github.com/NVIDIA/cub), preferably somewhere where you won't accidentally delete it, and set this path as an System Enviroment Variable called "CUB_HOME". Reboot your pc. Follow the instructions at the bottom on https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md (basically you just run the cmd pip install "git+https://github.com/facebookresearch/pytorch3d.git"). That should take care of everything, and install it just fine. To use it, install the jupyter extention, then run python -m jupyter notebook in the venv. That should open a browser window, navigate through .\Shap-E\shap_e\examples\ and pick the one mode you want to use (img->3d, text-> 3d, etc). Open the jupyter notebook and set the variables however you like. For debugging purposes, add print(device) to the second cell. If the output of that is "cuda" you're good. When everything's ready, click Run > Run all Cells at the top. Good luck!

This solution that I've already tried several times before is too unreliable to depends on official pytorch3d's installation. As well as Shap-e was written with conda-forge yaml file to config initially, pytorch3d is needed to be automatically to check dependencies and cuda version.