GithubHelp home page GithubHelp logo

dreampropeller's Introduction

DreamPropeller: Supercharge Text-to-3D Generation with Parallel Sampling (CVPR 2024 Highlight)

Official Implementation of DreamPropeller: Supercharge Text-to-3D Generation with Parallel Sampling

1Stanford University, 2Pika Labs

This codebase is based on threestudio with minor changes to some files for parallel processing.

Installation

  • Install Python >= 3.11.
  • Create a virtual environment:
conda create -n dreampropeller python=3.11
  • (Optional, Recommended) Install ninja to speed up the compilation of CUDA extensions:
pip install ninja
  • Install dependencies:
pip install -r requirements.txt
  • Install PyTorch == 2.1.0. We have tested on torch2.1.0+cu121.
pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
  • (Optional, Recommended) The best-performing models in threestudio use the newly-released T2I model DeepFloyd IF, which currently requires signing a license agreement. If you would like to use these models, you need to accept the license on the model card of DeepFloyd IF, and login into the Hugging Face hub in the terminal by huggingface-cli login.

Usage

We can compare the runtime for baseline and DreamPropeller by using launch_baseline.py and launch_speedup.py respectively. For DreamPropeller, one can tune speedup parameters in .yaml config files. The preset values in the files are the default values. We note their meaning below:

  • speedup.threshold denotes the threshold for fixed-point error. Larger threshold gives greater speedup but lower generation quality.
  • speedup.ema_decay denotes the EMA rate of updating the threshold. This parameter makes it robust against variation in speedup for different prompts.
  • speedup.P denotes the window size, typically set to num_gpu-1. e.g. 8 GPU cluster uses window size of 7.
  • speedup.adaptivity_type denotes the error aggregation function used to update speedup.ema_decay. We only support median and mean and we use median for all but ProlificDreamer. We find using median makes quality more stable for tested frameworks but gives slower speedup than mean.

Other visualization options:

  • trainer.visualize_progress sets whether to visualize the generation progress.
  • trainer.display_time sets whether to display current runtime for each displayed image.
  • train_config.val_check_interval denotes the wallclock time in seconds (instead of iteration number) after which the script will save a visualization.

We can quickly test each of the frameworks presented in the paper below. Our method is tested on an 8-GPU A100-80G PCIe cluster.

You can freely switch between baseline and DreamPropeller by simply setting FILE to launch_baseline.py or launch_speedup.py.

DreamFusion

python $FILE --config configs/dreamfusion-if.yaml --train system.prompt_processor.prompt="an ice cream sundae" data.batch_size=16 trainer.visualize_progress=true

Magic3D

python $FILE  --config configs/magic3d-coarse-if.yaml --train system.prompt_processor.prompt="a beautiful dress made out of fruit, on a mannequin. Studio lighting, high quality, high resolution" data.batch_size=16 trainer.visualize_progress=true

python $FILE --config configs/magic3d-refine-sd.yaml --train system.prompt_processor.prompt="a beautiful dress made out of fruit, on a mannequin. Studio lighting, high quality, high resolution" data.batch_size=16 trainer.visualize_progress=true system.geometry_convert_from=path/to/coarse/stage/trial/dir/ckpts/last.ckpt

TextMesh

python $FILE --config configs/textmesh-if.yaml --train system.prompt_processor.prompt="an old vintage car" data.batch_size=16 trainer.visualize_progress=true

ProlificDreamer

python $FILE --config configs/prolificdreamer.yaml --train system.prompt_processor.prompt="a detailed Victorian era house" data.batch_size=[8,2] trainer.visualize_progress=true

python $FILE --config configs/prolificdreamer-geometry.yaml --train system.prompt_processor.prompt="a detailed Victorian era house" data.batch_size=8 trainer.visualize_progress=true system.geometry_convert_from=path/to/coarse/stage/trial/dir/ckpts/last.ckpt

python $FILE --config configs/prolificdreamer-texture.yaml --train system.prompt_processor.prompt="a detailed Victorian era house"  data.batch_size=1 trainer.visualize_progress=true system.geometry_convert_from=path/to/geometry/stage/trial/dir/ckpts/last.ckpt

DreamGaussian

Since DreamGaussian is a separate standalone repo, we have copied it in the dreamgaussian/ subfolder with our dreampropeller implementation specifically tailored to this repo. Please find specific instructions to run DreamGaussian inside.

Zero 1-to-3

Our method can also be applied to Image-to-3D using score distillation. Luckily Zero 1-to-3 is implemented in the original threestudio code, so we can directly plug in our method.

Download pretrained Zero123XL weights into load/zero123:

cd load/zero123
wget https://zero123.cs.columbia.edu/assets/zero123-xl.ckpt

To run,

python $FILE --config configs/zero123.yaml --train data.image_path=./load/images/grootplant_rgba.png data.random_camera.batch_size=[16,16,10] trainer.visualize_progress=true

Reference

@article{zhou2023dreampropeller,
  title={DreamPropeller: Supercharge Text-to-3D Generation with Parallel Sampling},
  author={Zhou, Linqi and Shih, Andy and Meng, Chenlin and Ermon, Stefano},
  journal={arXiv preprint arXiv:2311.17082},
  year={2023}
}

dreampropeller's People

Contributors

alexzhou907 avatar

Stargazers

Yanis Falaki avatar Edward Seo avatar Junwei Zhou avatar Ray Xu avatar  avatar Luis avatar ZhiyuanthePony avatar inFinith avatar  avatar Eric Wu avatar Xinhua Cheng avatar  avatar Nippun Sharma avatar  avatar Obaradesu avatar Yong Liu avatar  avatar Vikas Thamizharasan avatar Jack_Lee avatar Yabo Zhang avatar Mr. For Example avatar Norman Zheng avatar Simon Shengyu Meng avatar  avatar  avatar  avatar RitaRao avatar Chenfanfu Jiang avatar antbits avatar Chen Mingxing avatar  avatar Zhe Wang avatar Cyberpunk2077 avatar Xuemin Zhao avatar  avatar  avatar  avatar Yuheng Jiao avatar taoranyi avatar Aria F avatar redaready avatar Jiayao Zhang 张嘉瑶 avatar Akash avatar  avatar  avatar Qian Bao avatar  avatar  avatar Yu Zhang avatar Tiantian Liu avatar 黄佳 avatar Raphaël avatar  avatar halfrost avatar  avatar Marko Mihajlovic avatar Logan avatar Xuanchi Ren avatar Haoge Deng avatar Crossingzebra avatar Paragoner avatar  avatar  avatar Zhizheng Xiang (向 志政) avatar Zeren Xiong avatar Researcher.YuanYuhui avatar Mai Congyi 麦从一 avatar Qu Zhiyu avatar Ng Kam Woh avatar Jianjin Xu avatar 爱可可-爱生活 avatar Zilong Chen avatar Lu Ming avatar Haodong LI avatar Zizhang Li avatar Ruocheng Wang avatar kiui avatar Florin Shen avatar Andy Shih avatar Zhiqi Li avatar Jingnan Gao avatar

Watchers

 avatar Paragoner avatar Marko Mihajlovic avatar  avatar  avatar

dreampropeller's Issues

how to export 3d file?

Hi, I successfully ran the launch_speedup.py file for training, but when I tried to export a 3D file by changing -- train to -- export, I found that the program could not run. I carefully checked the launch_speedup.py and launch_baseline.py in the project and found that there were export parameters inside, but never used. When I tried to export 3D files using launch. py in threshtudio, I found it to be incompatible with this project. So how can I export 3D files, or does the project not provide this function?

Acceleration for single GPU?

The speedup is impressive!
I'm also curious about its Acceleration for single GPU. Can it speed up 3D generation when only one GPU is avaible?
Thanks!

Not able to run DreamPropeller

Hi, I tried launching the launch_speedup.py but was not able to run any training due to the torch.multiprocessing queue in train_loop() being stuck.

_preds, _step = queues[1].get()

After looking through the code I found it very odd that items are put into queue[1] in run_workers() but run_workers() is not invoked in run(), therefore when train_loop() tries to get the predicted item from queue[1] it will be stuck indefinitely. I don't understand why is it written that way and not sure how to fix it. May I know if is this design is intended and are you able to run launch_speedup.py without any issues? Thanks.

Install Error with requirements.txt

I install ninja and torch2.1.0+cu121 first, then install the other requirement, but when i run the code, i meet the error
pip install -r requirements.txt
...
_build_ext.run(self)
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 345, in run
self.build_extensions()
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\torch\utils\cpp_extension.py", line 873, in build_extensions
build_ext.build_extensions(self)
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 467, in build_extensions
self._build_extensions_serial()
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 493, in _build_extensions_serial
self.build_extension(ext)
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\setuptools\command\build_ext.py", line 246, in build_extension
_build_ext.build_extension(self, ext)
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 548, in build_extension
objects = self.compiler.compile(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\torch\utils\cpp_extension.py", line 845, in win_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\torch\utils\cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "C:\ProgramData\anaconda3\envs\dreampropeller\Lib\site-packages\torch\utils\cpp_extension.py", line 2116, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tinycudann
Running setup.py clean for tinycudann
Building wheel for nvdiffrast (setup.py) ... done
Created wheel for nvdiffrast: filename=nvdiffrast-0.3.1-py3-none-any.whl size=141467 sha256=2bf37bd56803a0c18abb8dab0f879590bee22e5b00d72af419de8cab10d811c3
Stored in directory: C:\Users\renjiezhang\AppData\Local\Temp\pip-ephem-wheel-cache-wvd3316i\wheels\1f\02\42\f8a0a54a25f789f27dd0a5509a22236057abd5d75f3f69969f
Building wheel for pysdf (setup.py) ... done
Created wheel for pysdf: filename=pysdf-0.1.9-cp311-cp311-win_amd64.whl size=128067 sha256=0eadd7f7f7d83d3fde0bccfa948bcbea3ea80b2d266d2467b7fba7a6710cc613
Stored in directory: c:\users\renjiezhang\appdata\local\pip\cache\wheels\70\14\13\db6ce1ad9f1f170ef0aaeadc7fc58e082a5147a5953e93628a
Building wheel for envlight (setup.py) ... done
Created wheel for envlight: filename=envlight-0.1.0-py3-none-any.whl size=40061 sha256=bbf3cd529c7c2e4b46e6689cf2777b4fd3feecd500046577900e98feb8c99fbf
Stored in directory: C:\Users\renjiezhang\AppData\Local\Temp\pip-ephem-wheel-cache-wvd3316i\wheels\9e\aa\90\b01e0473e0659bde0d0766c6f80e2fdb4d092103587453dcb7
Building wheel for clip (setup.py) ... done
Created wheel for clip: filename=clip-1.0-py3-none-any.whl size=1369578 sha256=4f7fdf53ac708fc973c4c9a4bccdf09bf4138d426800bd04acc9f7d858c1cdf7
Stored in directory: C:\Users\renjiezhang\AppData\Local\Temp\pip-ephem-wheel-cache-wvd3316i\wheels\3f\7c\a4\9b490845988bf7a4db33674d52f709f088f64392063872eb9a
Building wheel for controlnet_aux (setup.py) ... done
Created wheel for controlnet_aux: filename=controlnet_aux-0.0.7-py3-none-any.whl size=274369 sha256=220b33f6f9a237ab2ed6720e9732c17b31c62e167eb7817eedf45ae9d25b84a5
Stored in directory: c:\users\renjiezhang\appdata\local\pip\cache\wheels\08\a1\0f\79d1529bbc60d1598da66052a2c60a2a13e5ac462b5f990653
Building wheel for ffmpy (setup.py) ... done
Created wheel for ffmpy: filename=ffmpy-0.3.1-py3-none-any.whl size=5601 sha256=7734b4025ec2dae682138fabf0b312875ebc016deccfc74a51bf3bec4939e92c
Stored in directory: c:\users\renjiezhang\appdata\local\pip\cache\wheels\99\3b\84\22ac1eab7a10222ac6bbc3f7e69b04f3980db328978c533a3f
Building wheel for pycollada (setup.py) ... done
Created wheel for pycollada: filename=pycollada-0.7.2-py3-none-any.whl size=127024 sha256=d1e9a77ad169356ece433027c2985f44b4dba1b487445251d49398f622644c2c
Stored in directory: c:\users\renjiezhang\appdata\local\pip\cache\wheels\07\31\f9\395db362d2ceb6314508ed93426113131978eaca551cb359eb
Successfully built antlr4-python3-runtime nerfacc nvdiffrast pysdf envlight clip controlnet_aux ffmpy pycollada
Failed to build tinycudann
ERROR: Could not build wheels for tinycudann, which is required to install pyproject.toml-based projects

Maybe it has some relation with my env or something, could you please give us some threestudio custom Extensions? just like those:
https://threestudio-project.github.io/threestudio-extensions/
It will be more convenient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.