Git Product home page Git Product logo

guochengqian / magic123 Goto Github PK

View Code? Open in Web Editor NEW
1.5K 54.0 95.0 115.2 MB

[ICLR24] Official PyTorch Implementation of Magic123: One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors

Home Page: https://guochengqian.github.io/project/magic123

License: Apache License 2.0

Python 17.45% Shell 0.42% Roff 0.01% Dockerfile 0.02% C++ 0.59% Cuda 2.08% C 0.27% Jupyter Notebook 79.17%
image-to-3d 3d-generation diffusion-models

magic123's Introduction

Magic123: One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors [ICLR 2024]

arXiv | webpage

Guocheng Qian 1,2, Jinjie Mai 1, Abdullah Hamdi 3, Jian Ren 2, Aliaksandr Siarohin 2, Bing Li 1, Hsin-Ying Lee 2, Ivan Skorokhodov 1,2, Peter Wonka 1, Sergey Tulyakov 2, Bernard Ghanem 1

1 King Abdullah University of Science and Technology (KAUST), 2 Snap Inc., 3 Visual Geometry Group, University of Oxford

Training convergence of a demo example:

Compare Magic123 without textual inversion with abaltions using only 2D prior (SDS) or using only 3D prior (Zero123):

human-examples.mp4

Effects of Joint Prior. Increasing the strength of 2D prior leads to more imagination, more details, and less 3D consistencies.

output-lambda2d.mp4

Official PyTorch Implementation of Magic123: One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors. Code is built upon Stable-DreamFusion repo.

NEWS:

  • [2024/01/16] Magic123 gets accepted to ICLR24
  • [2023/07/25] Code is available at GitHub
  • [2023/07/03] Paper is available at arXiv
  • [2023/06/25] Much better performance than the submitted version is achieved by 1)reimplementing Magic123 using Stable DreamFusion code, 2)fixing some gradient issues, 3)leveraging the tricks
  • [2023] Initial version of Magic123 submitted to conference

Install

We only test on Ubuntu system. Make sure git, wget, Eigen are installed.

apt update && apt upgrade
apt install git wget libeigen3-dev -y

Install Environment

source install.sh

Note: in this install.sh, we use python venv by default. If you prefer conda, uncomment the conda and comment venv in the file and run the same command.

Download pre-trained models

  • Zero-1-to-3 for 3D diffusion prior. We use 105000.ckpt by default, reimplementation borrowed from Stable Diffusion repo, and is available in guidance/zero123_utils.py.

    cd pretrained/zero123
    wget https://huggingface.co/cvlab/zero123-weights/resolve/main/105000.ckpt
    cd ../../
  • MiDaS for depth estimation. We use dpt_beit_large_512.pt. Put it in folder pretrained/midas/

    mkdir -p pretrained/midas
    cd pretrained/midas
    wget https://github.com/isl-org/MiDaS/releases/download/v3_1/dpt_beit_large_512.pt
    cd ../../

Usage

Preprocess [Optional]

We have included all preprocessed files in ./data directory. Preprocessing is only necessary if you want to test on your own examples. Takes seconds.

Step1: Extract depth

python preprocess_image.py --path /path/to/image 

Step 2: textual inversion [Optional]

Magic123 uses the default textual inversion from diffuers, which consumes around 2 hours on a 32G V100. If you do not want to spend time in this textual inversion, you can: (1) study whether there is other faster textual inversion; or (2) do not use textual inversion in the loss of texture and shape consistencies. To run textual inversion:

bash scripts/textual_inversion/textual_inversion.sh $GPU_IDX runwayml/stable-diffusion-v1-5 /path/to/example/rgba.png /path/to/save $token_name $init_token --max_train_steps 5000

$token_name is a the special token, usually name that by examplename $init_token is a single token to describe the image using natural language

For example:

bash scripts/textual_inversion/textual_inversion.sh runwayml/stable-diffusion-v1-5 data/demo/a-full-body-ironman/rgba.png out/textual_inversion/ironman _ironman_ ironman --max_train_steps 3000

Don't forget to move the final learned_embeds.bin under data/demo/a-full-body-ironman/

Run

Run Magic123 for a single example

Takes ~40 mins for the coarse stage and ~20 mins for the second stage on a 32G V100.

bash scripts/magic123/run_both_priors.sh $GPU_NO $JOBNAME_First_Stage $JOBNAME_Second_Stage $PATH_to_Example_Directory $IMAGE_BASE_NAME $Enable_First_Stage $Enable_Second_Stage {More_Arugments}

As an example, run Magic123 in the dragon example using both stages in GPU 0 and set the jobname for the first stage as nerf and the jobname for the second stage as dmtet, by the following command:

bash scripts/magic123/run_both_priors.sh 0 nerf dmtet data/realfusion15/metal_dragon_statue 1 1 

More arguments (e.g. --lambda_guidance 1 40) can be appended to the command line such as:

bash scripts/magic123/run_both_priors.sh 0 nerf dmtet data/realfusion15/metal_dragon_statue 1 1 --lambda_guidance 1 40

Run Magic123 for a group of examples

  • Run all examples in a folder, check the scripts scripts/magic123/run_folder_both_priors.sh
  • Run all examples in a given list, check the scripts scripts/magic123/run_list_both_priors.sh

Run Magic123 on a single example without textual inversion

textual inversion is tedious (requires ~2.5 hours optimization), if you want to test Magic123 quickly on your own example without textual inversion (might degrade the performance), try the following:

  • first, foreground and depth estimation

    python preprocess_image.py --path data/demo/a-full-body-ironman/main.png
    
  • Run Magic123 coarse stage without textual inversion, takes ~40 mins

    export RUN_ID='default-a-full-body-ironman'
    export DATA_DIR='data/demo/a-full-body-ironman'
    export IMAGE_NAME='rgba.png'
    export FILENAME=$(basename $DATA_DIR)
    export dataset=$(basename $(dirname $DATA_DIR))
    CUDA_VISIBLE_DEVICES=0 python main.py -O \
    --text "A high-resolution DSLR image of a full body ironman" \
    --sd_version 1.5 \
    --image ${DATA_DIR}/${IMAGE_NAME} \
    --workspace out/magic123-${RUN_ID}-coarse/$dataset/magic123_${FILENAME}_${RUN_ID}_coarse \
    --optim adam \
    --iters 5000 \
    --guidance SD zero123 \
    --lambda_guidance 1.0 40 \
    --guidance_scale 100 5 \
    --latent_iter_ratio 0 \
    --normal_iter_ratio 0.2 \
    --t_range 0.2 0.6 \
    --bg_radius -1 \
    --save_mesh
    
  • Run Magic123 fine stage without textual inversion, takes around ~20 mins

    export RUN_ID='default-a-full-body-ironman'
    export RUN_ID2='dmtet'
    export DATA_DIR='data/demo/a-full-body-ironman'
    export IMAGE_NAME='rgba.png'
    export FILENAME=$(basename $DATA_DIR)
    export dataset=$(basename $(dirname $DATA_DIR))
    CUDA_VISIBLE_DEVICES=0 python main.py -O \
    --text "A high-resolution DSLR image of a full body ironman" \
    --sd_version 1.5 \
    --image ${DATA_DIR}/${IMAGE_NAME} \
    --workspace out/magic123-${RUN_ID}-${RUN_ID2}/$dataset/magic123_${FILENAME}_${RUN_ID}_${RUN_ID2} \
    --dmtet --init_ckpt out/magic123-${RUN_ID}-coarse/$dataset/magic123_${FILENAME}_${RUN_ID}_coarse/checkpoints/magic123_${FILENAME}_${RUN_ID}_coarse.pth \
    --iters 5000 \
    --optim adam \
    --known_view_interval 4 \
    --latent_iter_ratio 0 \
    --guidance SD zero123 \
    --lambda_guidance 1e-3 0.01 \
    --guidance_scale 100 5 \
    --rm_edge \
    --bg_radius -1 \
    --save_mesh 
    

Run ablation studies

  • Run Magic123 with only 2D prior with textual inversion (Like RealFusion but we achieve much better performance through training stragies and the coarse-to-fine pipeline)

    bash scripts/magic123/run_2dprior.sh 0 nerf dmtet data/realfusion15/metal_dragon_statue 1 1
    
  • Run Magic123 with only 2D prior without textual inversion (Like RealFusion but we achieve much better performance through training stragies and the coarse-to-fine pipeline)

    bash scripts/magic123/run_2dprior_notextinv_ironman.sh 0 default 1 1
    

    note: change the path and the text prompt inside the script if you wana test another example.

  • Run Magic123 with only 3D prior (Like Zero-1-to-3 but we achieve much better performance through training stragies and the coarse-to-fine pipeline)

    bash scripts/magic123/run_3dprior.sh 0 nerf dmtet data/demo/a-full-body-ironman 1 1
    

Tips and Tricks

  1. Fix camera distance (radius_range) and FOV (fovy_range) and tune the camera polar range (theta_range). Note it is better to keep camera jittering to reduce grid artifacts.
  2. Smaller range of time steps for the defusion noise (t_range). We find [0.2, 0.6] gives better performance for image-to-3D tasks.
  3. Using normals as latent in the first 2000 improves generated geometry a bit gernerally (but not always). We turn on this for Magic123 corase stage in the script --normal_iter_ratio 0.2
  4. We erode segmentation edges (makes the segmentation map 2 pixels shrinked towards internal side) to remove artifacts due to segmentation erros. This is turned on in the fine stage in magic123 in the script through --rm_edge
  5. Other general tricks such as improved textual inversion, advanced diffusion prior (DeepFloyd, SD-XL), stronger 3D prior (Zero123-XL), and larger batch size can be adopted as well but not studied in this work.
  6. textual inversion is not very necessary for well-known things (e.g. ironman) and easily described textures and geoemtries, since pure texts contains these texture information and will be understood by diffusion models. We use textual inversion by default in all experiments.

Some Projects that use Magic123

  1. Threestudio
  2. DreamCraft3D

Acknowledgement

This work is build upon Stable DreamFusion, many thanks to the author Kiui Jiaxiang Tang and many other contributors.

@misc{stable-dreamfusion,
    Author = {Jiaxiang Tang},
    Year = {2022},
    Note = {https://github.com/ashawkey/stable-dreamfusion},
    Title = {Stable-dreamfusion: Text-to-3D with Stable-diffusion}
}

We also get inspirations from a list of amazing research works and open-source projects, thanks a lot to all the authors for sharing!

  • DreamFusion: Text-to-3D using 2D Diffusion

    @article{poole2022dreamfusion,
        author = {Poole, Ben and Jain, Ajay and Barron, Jonathan T. and Mildenhall, Ben},
        title = {DreamFusion: Text-to-3D using 2D Diffusion},
        journal = {arXiv},
        year = {2022},
    }
    
  • Magic3D: High-Resolution Text-to-3D Content Creation

    @inproceedings{lin2023magic3d,
       title={Magic3D: High-Resolution Text-to-3D Content Creation},
       author={Lin, Chen-Hsuan and Gao, Jun and Tang, Luming and Takikawa, Towaki and Zeng, Xiaohui and Huang, Xun and Kreis, Karsten and Fidler, Sanja and Liu, Ming-Yu and Lin, Tsung-Yi},
       booktitle={IEEE Conference on Computer Vision and Pattern Recognition ({CVPR})},
       year={2023}
     }
    
  • Zero-1-to-3: Zero-shot One Image to 3D Object

    @misc{liu2023zero1to3,
        title={Zero-1-to-3: Zero-shot One Image to 3D Object},
        author={Ruoshi Liu and Rundi Wu and Basile Van Hoorick and Pavel Tokmakov and Sergey Zakharov and Carl Vondrick},
        year={2023},
        eprint={2303.11328},
        archivePrefix={arXiv},
        primaryClass={cs.CV}
    }
    
  • RealFusion: 360° Reconstruction of Any Object from a Single Image

    @inproceedings{melaskyriazi2023realfusion,
        author = {Melas-Kyriazi, Luke and Rupprecht, Christian and Laina, Iro and Vedaldi, Andrea},
        title = {RealFusion: 360 Reconstruction of Any Object from a Single Image},
        booktitle={CVPR}
        year = {2023},
        url = {https://arxiv.org/abs/2302.10663},
    }
    
  • Make-it-3d: High-fidelity 3d creation from a single image with diffusion prior

    @article{tang2023make-it-3d,
        title={Make-it-3d: High-fidelity 3d creation from a single image with diffusion prior},
        author={Tang, Junshu and Wang, Tengfei and Zhang, Bo and Zhang, Ting and Yi, Ran and Ma, Lizhuang and Chen, Dong},
        journal={arXiv preprint arXiv:2303.14184},
        year={2023}
    }
    
  • Stable Diffusion and the diffusers library.

    @misc{rombach2021highresolution,
        title={High-Resolution Image Synthesis with Latent Diffusion Models},
        author={Robin Rombach and Andreas Blattmann and Dominik Lorenz and Patrick Esser and Björn Ommer},
        year={2021},
        eprint={2112.10752},
        archivePrefix={arXiv},
        primaryClass={cs.CV}
    }
    
    @misc{von-platen-etal-2022-diffusers,
        author = {Patrick von Platen and Suraj Patil and Anton Lozhkov and Pedro Cuenca and Nathan Lambert and Kashif Rasul and Mishig Davaadorj and Thomas Wolf},
        title = {Diffusers: State-of-the-art diffusion models},
        year = {2022},
        publisher = {GitHub},
        journal = {GitHub repository},
        howpublished = {\url{https://github.com/huggingface/diffusers}}
    }
    

Cite

If you find this work useful, a citation will be appreciated via:

@inproceedings{
Magic123,
title={Magic123: One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors},
author={Qian, Guocheng and Mai, Jinjie and Hamdi, Abdullah and Ren, Jian and Siarohin, Aliaksandr and Li, Bing and Lee, Hsin-Ying and Skorokhodov, Ivan and Wonka, Peter and Tulyakov, Sergey and Ghanem, Bernard},
booktitle={The Twelfth International Conference on Learning Representations (ICLR)},
year={2024},
url={https://openreview.net/forum?id=0jHkUDyEO9}
}

magic123's People

Contributors

ajhamdi avatar guochengqian avatar royalvice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magic123's Issues

Textual inversion not working

I am unable to do textual inversion, so i tried the given example. even that does not work, plz help.
It says no CUDA GPU, but I have everything set, the model also works and generates obj output, why this is not working?

(magic123) wakeel_furqan@coeai-bahria:~/Magic123$ bash scripts/textual_inversion/textual_inversion.sh runwayml/stable-diffusion-v1-5 data/demo/a-full-body-ironman/rgba.png out/textual_inversion/ironman ironman ironman --max_train_steps 3000
scripts/textual_inversion/textual_inversion.sh: line 13: module: command not found
===> Anaconda env loaded
scripts/textual_inversion/textual_inversion.sh: line 18: magic123/bin/activate: No such file or directory
Sun Dec 3 23:55:25 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.147.05 Driver Version: 525.147.05 CUDA Version: 12.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA RTX A6000 Off | 00000000:2D:00.0 On | Off |
| 30% 29C P8 23W / 300W | 1143MiB / 49140MiB | 4% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 2837 C+G ...ome-remote-desktop-daemon 264MiB |
| 0 N/A N/A 95585 G /usr/lib/xorg/Xorg 695MiB |
| 0 N/A N/A 95751 G /usr/bin/gnome-shell 50MiB |
| 0 N/A N/A 153562 G ...8/usr/lib/firefox/firefox 23MiB |
+-----------------------------------------------------------------------------+
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
coeai-bahria
number of gpus: 1
usage: textual_inversion.py [-h] [--save_steps SAVE_STEPS] [--only_save_embeds] --pretrained_model_name_or_path PRETRAINED_MODEL_NAME_OR_PATH [--revision REVISION] [--tokenizer_name TOKENIZER_NAME]
--train_data_dir TRAIN_DATA_DIR --placeholder_token PLACEHOLDER_TOKEN --initializer_token INITIALIZER_TOKEN [--learnable_property LEARNABLE_PROPERTY] [--repeats REPEATS]
[--output_dir OUTPUT_DIR] [--seed SEED] [--resolution RESOLUTION] [--center_crop] [--train_batch_size TRAIN_BATCH_SIZE] [--num_train_epochs NUM_TRAIN_EPOCHS]
[--max_train_steps MAX_TRAIN_STEPS] [--gradient_accumulation_steps GRADIENT_ACCUMULATION_STEPS] [--gradient_checkpointing] [--learning_rate LEARNING_RATE] [--scale_lr]
[--lr_scheduler LR_SCHEDULER] [--lr_warmup_steps LR_WARMUP_STEPS] [--dataloader_num_workers DATALOADER_NUM_WORKERS] [--adam_beta1 ADAM_BETA1] [--adam_beta2 ADAM_BETA2]
[--adam_weight_decay ADAM_WEIGHT_DECAY] [--adam_epsilon ADAM_EPSILON] [--push_to_hub] [--hub_token HUB_TOKEN] [--hub_model_id HUB_MODEL_ID] [--logging_dir LOGGING_DIR]
[--mixed_precision {no,fp16,bf16}] [--allow_tf32] [--report_to REPORT_TO] [--validation_prompt VALIDATION_PROMPT] [--num_validation_images NUM_VALIDATION_IMAGES]
[--validation_steps VALIDATION_STEPS] [--validation_epochs VALIDATION_EPOCHS] [--local_rank LOCAL_RANK] [--checkpointing_steps CHECKPOINTING_STEPS]
[--checkpoints_total_limit CHECKPOINTS_TOTAL_LIMIT] [--resume_from_checkpoint RESUME_FROM_CHECKPOINT] [--enable_xformers_memory_efficient_attention] [--use_augmentations]
textual_inversion.py: error: unrecognized arguments: 3000
Loading pipeline components...: 57%|██████████████████████████████████████████████████████████████████████████████████▎ | 4/7 [00:00<00:00, 5.61it/s]text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["id2label"] will be overriden.
text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["bos_token_id"] will be overriden.
text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["eos_token_id"] will be overriden.
Loading pipeline components...: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:01<00:00, 6.49it/s]
learned_embeds_path ironman does not exist!
Traceback (most recent call last):
File "/home/wakeel_furqan/Magic123/guidance/sd_utils.py", line 682, in
sd = StableDiffusion(device, opt.fp16, opt.vram_O,
File "/home/wakeel_furqan/Magic123/guidance/sd_utils.py", line 189, in init
pipe.to(device)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py", line 852, in to
module.to(device, dtype)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/transformers/modeling_utils.py", line 2271, in to
return super().to(*args, **kwargs)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1145, in to
return self._apply(convert)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply
module._apply(fn)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply
module._apply(fn)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply
module._apply(fn)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/torch/nn/modules/module.py", line 820, in _apply
param_applied = fn(param)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1143, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
File "/home/wakeel_furqan/.conda/envs/magic123/lib/python3.10/site-packages/torch/cuda/init.py", line 247, in _lazy_init
torch._C._cuda_init()
RuntimeError: No CUDA GPUs are available

run_both_priors.sh: RuntimeError: instance mode - pos must have shape [>0, >0, 4]

Hi,

Thank you for your great research.

I had a few problems when I ran Magic123 for a single example.
Whe i ran "bash scripts/magic123/run_both_priors.sh 0 nerf dmtet data/realfusion15/metal_dragon_statue 1 1 ", the mash came out well. There was no error.
But, If i used other sample( my own sample ), there was error.

---------------- cmd --------------------------

[23/08/18 15:52:01 nerf.utils]: [INFO] #Scheduler:
<torch.optim.lr_scheduler.LambdaLR object at 0x7fc3c241bdc0>
[23/08/18 15:52:01 nerf.utils]: [INFO] Loading latest checkpoint ...
[23/08/18 15:52:01 nerf.utils]: [WARN] No checkpoint found, model randomly initialized.
[23/08/18 15:52:01 nerf.utils]: ==> [2023-08-18_15-52-01] Start Training out/magic123-nerf-coarse/demo1/magic123_stitch_nerf_coarse Epoch 1/50, lr=0.010000 ...
Traceback (most recent call last):
File "----/Magic123/main.py", line 622, in
trainer.train(train_loader, valid_loader, test_loader, max_epoch)
File "----/Magic123/nerf/utils.py", line 1049, in train
self.train_one_epoch(train_loader, max_epochs)
File "----/Magic123/nerf/utils.py", line 1263, in train_one_epoch
self.model.update_extra_state()
File "----/Magic123/venv_magic123/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "----/Magic123/nerf/renderer.py", line 1483, in update_extra_state
indices = raymarching.morton3D(coords).long() # [N]
RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

WARNING [23/08/18 15:54:02 main]: ckpt out/magic123-nerf-coarse/demo1/magic123_stitch_nerf_coarse/checkpoints/magic123_stitch_nerf_coarse.pth is not found
[23/08/18 15:54:02 main]: NeRFNetwork(
(dmtet): DMTetGeometry()
(encoder): GridEncoder: input_dim=3 num_levels=16 level_dim=2 resolution=16 -> 2048 per_level_scale=1.3819 params=(6098120, 2) gridtype=hash align_corners=False interpolation=smoothstep
(sigma_net): MLP(
(net): ModuleList(
(0): Linear(in_features=32, out_features=64, bias=True)
(1): Linear(in_features=64, out_features=64, bias=True)
(2): Linear(in_features=64, out_features=4, bias=True)
)
)
)
[23/08/18 15:54:03 guidance.sd_utils]: [INFO] loading stable diffusion...
Loading pipeline components...: 0%| | 0/7 [00:00<?, ?it/s]text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["id2label"] will be overriden.
text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["bos_token_id"] will be overriden.
text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["eos_token_id"] will be overriden.
Loading pipeline components...: 100%|█████████████████████████████████████████████████████████████████████████████| 7/7 [00:11<00:00, 1.70s/it]
WARNING [23/08/18 15:54:16 guidance.sd_utils]: learned_embeds_path data/demo1/stitch/learned_embeds.bin does not exist!
[23/08/18 15:54:17 guidance.sd_utils]: [INFO] loaded stable diffusion!
WARNING [23/08/18 15:54:17 main]: No learned_embeds_path provided, using the folowing pure text prompt with degraded performance: A high-resolution DSLR image of stitch
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.53 M params.
Keeping EMAs of 688.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
[23/08/18 15:54:28 main]: {'workspace': 'out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet', 'text': 'A high-resolution DSLR image of stitch', 'negative': '', 'dir_texts_neg': False, 'check_prompt': False, 'O': True, 'O2': False, 'test': False, 'six_views': False, 'eval_interval': 1, 'test_interval': 50, 'seed': 101, 'log_every': 20, 'use_wandb': False, 'guidance': ['SD', 'zero123'], 'guidance_scale': {'SD': 100.0, 'zero123': 5.0}, 'gudiance_spatial_weighting': False, 'save_train_every': -1, 'lambda_clip': 0, 'clip_version': 'large', 'clip_guidance': 0, 'clip_t': 0.4, 'clip_iterative': False, 'clip_image_loss': False, 'save_guidance_every': -1, 'use_shape': False, 'shape_guidance': 3, 'shape_radius': 4, 'shape_fovy': 40, 'shape_init_color': True, 'shape_rpst': 'sdf', 'image': 'data/demo1/stitch/rgba.png', 'image_config': None, 'learned_embeds_path': 'data/demo1/stitch/learned_embeds.bin', 'known_iters': 100, 'known_view_interval': 4, 'bg_color_known': None, 'known_shading': 'lambertian', 'save_mesh': True, 'mcubes_resolution': 256, 'decimate_target': 50000.0, 'dmtet': True, 'tet_mlp': False, 'base_mesh': None, 'tet_grid_size': 256, 'init_ckpt': 'out/magic123-nerf-coarse/demo1/magic123_stitch_nerf_coarse/checkpoints/magic123_stitch_nerf_coarse.pth', 'lock_geo': False, 'iters': 5000, 'lr': 0.001, 'lr_scale_nerf': 1, 'lr_scale_texture': 1, 'ckpt': 'latest', 'cuda_ray': True, 'taichi_ray': False, 'max_steps': 1024, 'num_steps': 64, 'upsample_steps': 32, 'update_extra_interval': 16, 'max_ray_batch': 4096, 'latent_iter_ratio': 0, 'normal_iter_ratio': 0, 'textureless_iter_ratio': 0, 'albedo_iter_ratio': 0, 'warmup_bg_color': None, 'bg_color': None, 'bg_color_test': 'white', 'ema_decay': 0.95, 'jitter_pose': False, 'jitter_center': 0.2, 'jitter_target': 0.2, 'jitter_up': 0.02, 'uniform_sphere_rate': 0.5, 'grad_clip': -1, 'grad_clip_rgb': -1, 'grid_levels_mask': -1, 'grid_levels_mask_iters': 3000, 'bg_radius': -1, 'density_activation': 'exp', 'density_thresh': 10, 'blob_density': 10, 'blob_radius': 0.2, 'backbone': 'grid', 'grid_type': 'hashgrid', 'hidden_dim_bg': 32, 'optim': 'adam', 'sd_version': '1.5', 'hf_key': None, 'fp16': True, 'vram_O': False, 'w': 1024, 'h': 1024, 'known_view_scale': 1, 'known_view_noise_scale': 0.001, 'noise_known_camera_annealing': False, 'dmtet_reso_scale': 8, 'rm_edge': True, 'edge_threshold': 0.1, 'edge_width': 5, 'batch_size': 1, 'bound': 1.0, 'dt_gamma': 0, 'min_near': 0.1, 'radius_range': [1.8, 1.8], 'theta_range': [45, 135], 'phi_range': [-180, 180], 'fovy_range': [40, 40], 'default_radius': 1.8, 'default_polar': 90, 'default_azimuth': 0, 'default_fovy': 40, 'progressive_view': False, 'progressive_level': False, 'angle_overhead': 30, 'angle_front': 60, 't_range': [0.02, 0.5], 'lambda_entropy': 0.001, 'lambda_opacity': 0.0, 'lambda_orient': 0.01, 'lambda_tv': 0, 'lambda_wd': 0, 'lambda_normal_smooth': 0.5, 'lambda_normal_smooth2d': 0.5, 'lambda_3d_normal_smooth': 0.0, 'lambda_guidance': {'SD': 0.001, 'zero123': 0.01}, 'lambda_rgb': 5, 'lambda_mask': 0.5, 'lambda_depth': 0, 'lambda_normal': 0, 'lambda_depth_mse': 0.0, 'normalize_depth': True, 'lambda_mesh_normal': 0.1, 'lambda_mesh_lap': 0.1, 'gui': False, 'W': 800, 'H': 800, 'radius': 1.8, 'fovy': 40, 'light_theta': 60, 'light_phi': 0, 'max_spp': 1, 'zero123_config': './pretrained/zero123/sd-objaverse-finetune-c_concat-256.yaml', 'zero123_ckpt': './pretrained/zero123/105000.ckpt', 'zero123_grad_scale': 'angle', 'dataset_size_train': 100, 'dataset_size_valid': 8, 'dataset_size_test': 100, 'images': ['data/demo1/stitch/rgba.png'], 'ref_radii': [1.8], 'ref_polars': [90], 'ref_azimuths': [0], 'zero123_ws': [1], 'default_zero123_w': 1, 'use_clip': False, 'runname': 'magic123_stitch_nerf_dmtet', 'log_path': 'out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet/log_magic123_stitch_nerf_dmtet.txt', 'ckpt_path': 'out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet/checkpoints', 'best_path': 'out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet/checkpoints/magic123_stitch_nerf_dmtet.pth', 'device': device(type='cuda')}
[INFO] dataset: load image prompt ['data/demo1/stitch/rgba.png'] torch.Size([1, 3, 1024, 1024])
[INFO] dataset: load depth prompt ['data/demo1/stitch/depth.png'] torch.Size([161997])
[23/08/18 15:54:28 nerf.utils]: [WARN] dataset: data/demo1/stitch/normal.png is not found
[23/08/18 15:54:29 nerf.utils]: [INFO] cmdline: main.py -O --text A high-resolution DSLR image of --sd_version 1.5 --image data/demo1/stitch/rgba.png --learned_embeds_path data/demo1/stitch/learned_embeds.bin --workspace out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet --dmtet --init_ckpt out/magic123-nerf-coarse/demo1/magic123_stitch_nerf_coarse/checkpoints/magic123_stitch_nerf_coarse.pth --iters 5000 --optim adam --latent_iter_ratio 0 --guidance SD zero123 --lambda_guidance 1e-3 0.01 --guidance_scale 100 5 --rm_edge --bg_radius -1 --save_mesh
[23/08/18 15:54:29 nerf.utils]: args:
{'workspace': 'out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet', 'text': 'A high-resolution DSLR image of stitch', 'negative': '', 'dir_texts_neg': False, 'check_prompt': False, 'O': True, 'O2': False, 'test': False, 'six_views': False, 'eval_interval': 1, 'test_interval': 50, 'seed': 101, 'log_every': 20, 'use_wandb': False, 'guidance': ['SD', 'zero123'], 'guidance_scale': {'SD': 100.0, 'zero123': 5.0}, 'gudiance_spatial_weighting': False, 'save_train_every': -1, 'lambda_clip': 0, 'clip_version': 'large', 'clip_guidance': 0, 'clip_t': 0.4, 'clip_iterative': False, 'clip_image_loss': False, 'save_guidance_every': -1, 'use_shape': False, 'shape_guidance': 3, 'shape_radius': 4, 'shape_fovy': 40, 'shape_init_color': True, 'shape_rpst': 'sdf', 'image': 'data/demo1/stitch/rgba.png', 'image_config': None, 'learned_embeds_path': 'data/demo1/stitch/learned_embeds.bin', 'known_iters': 100, 'known_view_interval': 4, 'bg_color_known': None, 'known_shading': 'lambertian', 'save_mesh': True, 'mcubes_resolution': 256, 'decimate_target': 50000.0, 'dmtet': True, 'tet_mlp': False, 'base_mesh': None, 'tet_grid_size': 256, 'init_ckpt': 'out/magic123-nerf-coarse/demo1/magic123_stitch_nerf_coarse/checkpoints/magic123_stitch_nerf_coarse.pth', 'lock_geo': False, 'iters': 5000, 'lr': 0.001, 'lr_scale_nerf': 1, 'lr_scale_texture': 1, 'ckpt': 'latest', 'cuda_ray': True, 'taichi_ray': False, 'max_steps': 1024, 'num_steps': 64, 'upsample_steps': 32, 'update_extra_interval': 16, 'max_ray_batch': 4096, 'latent_iter_ratio': 0, 'normal_iter_ratio': 0, 'textureless_iter_ratio': 0, 'albedo_iter_ratio': 0, 'warmup_bg_color': None, 'bg_color': None, 'bg_color_test': 'white', 'ema_decay': 0.95, 'jitter_pose': False, 'jitter_center': 0.2, 'jitter_target': 0.2, 'jitter_up': 0.02, 'uniform_sphere_rate': 0.5, 'grad_clip': -1, 'grad_clip_rgb': -1, 'grid_levels_mask': -1, 'grid_levels_mask_iters': 3000, 'bg_radius': -1, 'density_activation': 'exp', 'density_thresh': 10, 'blob_density': 10, 'blob_radius': 0.2, 'backbone': 'grid', 'grid_type': 'hashgrid', 'hidden_dim_bg': 32, 'optim': 'adam', 'sd_version': '1.5', 'hf_key': None, 'fp16': True, 'vram_O': False, 'w': 1024, 'h': 1024, 'known_view_scale': 1, 'known_view_noise_scale': 0.001, 'noise_known_camera_annealing': False, 'dmtet_reso_scale': 8, 'rm_edge': True, 'edge_threshold': 0.1, 'edge_width': 5, 'batch_size': 1, 'bound': 1.0, 'dt_gamma': 0, 'min_near': 0.1, 'radius_range': [1.8, 1.8], 'theta_range': [45, 135], 'phi_range': [-180, 180], 'fovy_range': [40, 40], 'default_radius': 1.8, 'default_polar': 90, 'default_azimuth': 0, 'default_fovy': 40, 'progressive_view': False, 'progressive_level': False, 'angle_overhead': 30, 'angle_front': 60, 't_range': [0.02, 0.5], 'lambda_entropy': 0.001, 'lambda_opacity': 0.0, 'lambda_orient': 0.01, 'lambda_tv': 0, 'lambda_wd': 0, 'lambda_normal_smooth': 0.5, 'lambda_normal_smooth2d': 0.5, 'lambda_3d_normal_smooth': 0.0, 'lambda_guidance': {'SD': 0.001, 'zero123': 0.01}, 'lambda_rgb': 5, 'lambda_mask': 0.5, 'lambda_depth': 0, 'lambda_normal': 0, 'lambda_depth_mse': 0.0, 'normalize_depth': True, 'lambda_mesh_normal': 0.1, 'lambda_mesh_lap': 0.1, 'gui': False, 'W': 800, 'H': 800, 'radius': 1.8, 'fovy': 40, 'light_theta': 60, 'light_phi': 0, 'max_spp': 1, 'zero123_config': './pretrained/zero123/sd-objaverse-finetune-c_concat-256.yaml', 'zero123_ckpt': './pretrained/zero123/105000.ckpt', 'zero123_grad_scale': 'angle', 'dataset_size_train': 100, 'dataset_size_valid': 8, 'dataset_size_test': 100, 'images': ['data/demo1/stitch/rgba.png'], 'ref_radii': [1.8], 'ref_polars': [90], 'ref_azimuths': [0], 'zero123_ws': [1], 'default_zero123_w': 1, 'use_clip': False, 'runname': 'magic123_stitch_nerf_dmtet', 'log_path': 'out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet/log_magic123_stitch_nerf_dmtet.txt', 'ckpt_path': 'out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet/checkpoints', 'best_path': 'out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet/checkpoints/magic123_stitch_nerf_dmtet.pth', 'device': device(type='cuda')}
[23/08/18 15:54:29 nerf.utils]: [INFO] Trainer: magic123_stitch_nerf_dmtet | 2023-08-18_15-54-28 | cuda | fp16 | out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet
[23/08/18 15:54:29 nerf.utils]: [INFO] #parameters: 20836380
[23/08/18 15:54:29 nerf.utils]: [INFO] #Optimizer:
Adam (
Parameter Group 0
amsgrad: False
betas: (0.9, 0.99)
capturable: False
differentiable: False
eps: 1e-15
foreach: None
fused: None
initial_lr: 0.01
lr: 0.01
maximize: False
weight_decay: 0

Parameter Group 1
amsgrad: False
betas: (0.9, 0.99)
capturable: False
differentiable: False
eps: 1e-15
foreach: None
fused: None
initial_lr: 0.001
lr: 0.001
maximize: False
weight_decay: 0

Parameter Group 2
amsgrad: False
betas: (0.9, 0.99)
capturable: False
differentiable: False
eps: 1e-15
foreach: None
fused: None
initial_lr: 0.001
lr: 0.001
maximize: False
weight_decay: 0
)
[23/08/18 15:54:29 nerf.utils]: [INFO] #Scheduler:
<torch.optim.lr_scheduler.LambdaLR object at 0x7f0f94207cd0>
[23/08/18 15:54:29 nerf.utils]: [INFO] Loading latest checkpoint ...
[23/08/18 15:54:29 nerf.utils]: [WARN] No checkpoint found, model randomly initialized.
[23/08/18 15:54:29 nerf.utils]: ==> [2023-08-18_15-54-29] Start Training out/magic123-nerf-dmtet/demo1/magic123_stitch_nerf_dmtet Epoch 1/50, lr=0.010000 ...
Traceback (most recent call last):
File "----/Magic123/main.py", line 622, in
trainer.train(train_loader, valid_loader, test_loader, max_epoch)
File "----/Magic123/nerf/utils.py", line 1049, in train
self.train_one_epoch(train_loader, max_epochs)
File "----/Magic123/nerf/utils.py", line 1278, in train_one_epoch
loss, losses_dict, outputs = self.train_step(data)
File "----/Magic123/nerf/utils.py", line 645, in train_step
outputs = self.model.render(rays_o, rays_d, mvp, H, W, staged=False, perturb=True, bg_color=bg_color, ambient_ratio=ambient_ratio, shading=shading, binarize=binarize)
File "----/Magic123/nerf/renderer.py", line 1521, in render
results = self.run_dmtet(rays_o, rays_d, mvp, h, w, **kwargs)
File "----/Magic123/nerf/renderer.py", line 1264, in run_dmtet
rast, rast_db = dr.rasterize(self.glctx, verts_clip, faces, (h, w))
File "----/Magic123/venv_magic123/lib/python3.10/site-packages/nvdiffrast/torch/ops.py", line 310, in rasterize
return _rasterize_func.apply(glctx, pos, tri, resolution, ranges, grad_db, -1)
File "----/Magic123/venv_magic123/lib/python3.10/site-packages/torch/autograd/function.py", line 506, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
File "----/Magic123/venv_magic123/lib/python3.10/site-packages/nvdiffrast/torch/ops.py", line 248, in forward
out, out_db = _get_plugin().rasterize_fwd_cuda(raster_ctx.cpp_wrapper, pos, tri, resolution, ranges, peeling_idx)
RuntimeError: instance mode - pos must have shape [>0, >0, 4]

Getting the foreground mask from each pixel

First, Thanks for your great work!

In paper page 4, "the M() is the foreground mask acquired by integrating the volume density along the ray of each pixel.", How could calulate the density in pixel?

For example, the naive NeRF gets density (sigma) from 3d coord query. Then just add them in all samples in ray and normalize?

Thanks.

multi gpu support

Hi, thanks for the great work.
I'm wondering is there any way to use multiple GPUs for training?

Dependency versions

Hello, great job!
May I ask for a list of dependencies that the model will definitely run with? Linux version, cuda and so on.

Gallery

Demo

A demo example using an ironman image from internet. We run Magic123 without textural inversion, taking 1 hour on a 32G V100 to finish.

Renderings:

magic123-results.mp4

Meshes:
ironman.zip

image
image

Command:

  • Run Magic123 coarse stage without textural inversion, takes ~40 mins

    export RUN_ID='default-a-full-body-ironman'
    export DATA_DIR='data/demo/ironman'
    export IMAGE_NAME='rgba.png'
    export FILENAME=$(basename $DATA_DIR)
    export dataset=$(basename $(dirname $DATA_DIR))
    CUDA_VISIBLE_DEVICES=0 python main.py -O \
    --text "A high-resolution DSLR image of a full body ironman" \
    --sd_version 1.5 \
    --image ${DATA_DIR}/${IMAGE_NAME} \
    --workspace out/magic123-${RUN_ID}-coarse/$dataset/magic123_${FILENAME}_${RUN_ID}_coarse \
    --optim adam \
    --iters 5000 \
    --guidance SD zero123 \
    --lambda_guidance 1.0 40 \
    --guidance_scale 100 5 \
    --latent_iter_ratio 0 \
    --normal_iter_ratio 0.2 \
    --t_range 0.2 0.6 \
    --bg_radius -1 \
    --save_mesh
    
  • Run Magic123 fine stage without textural inversion, takes around ~20 mins

    export RUN_ID='default-a-full-body-ironman'
    export RUN_ID2='dmtet'
    export DATA_DIR='data/demo/ironman'
    export IMAGE_NAME='rgba.png'
    export FILENAME=$(basename $DATA_DIR)
    export dataset=$(basename $(dirname $DATA_DIR))
    CUDA_VISIBLE_DEVICES=0 python main.py -O \
    --text "A high-resolution DSLR image of a full body ironman" \
    --sd_version 1.5 \
    --image ${DATA_DIR}/${IMAGE_NAME} \
    --workspace out/magic123-${RUN_ID}-${RUN_ID2}/$dataset/magic123_${FILENAME}_${RUN_ID}_${RUN_ID2} \
    --dmtet --init_ckpt out/magic123-${RUN_ID}-coarse/$dataset/magic123_${FILENAME}_${RUN_ID}_coarse/checkpoints/magic123_${FILENAME}_${RUN_ID}_coarse.pth \
    --iters 5000 \
    --optim adam \
    --known_view_interval 4 \
    --latent_iter_ratio 0 \
    --guidance SD zero123 \
    --lambda_guidance 1e-3 0.01 \
    --guidance_scale 100 5 \
    --rm_edge \
    --bg_radius -1 \
    --save_mesh 
    

version of CUDA used to compile it?

version of CUA used to compile it?

i7 11th Gen, Ubuntu 18, GTX 1650 (4 GB)
CUDA 11.7

The detected CUDA version (11.7) mismatches the version that was used to compile
PyTorch (10.2). Please make sure to use the same CUDA versions.

Out of Memory Error

Hi

I am trying to run the training on an A100 GPU with 40G memory, but I receive OOM error in the first stage (coare training). Here are the commands and the config I'm using to run the two stages:

# Run stage 1
!python main.py -O \
--text "A high-resolution DSLR image of a soccer ball"  \
--sd_version 1.5 \
--image "/content/input/rgba.png" \
--workspace out/magic123-${RUN_ID}-coarse/$dataset/magic123_${FILENAME}_${RUN_ID}_coarse \
--optim adam \
--iters 5000 \
--guidance SD zero123 \
--lambda_guidance 1.0 40 \
--guidance_scale 100 5 \
--latent_iter_ratio 0 \
--normal_iter_ratio 0.2 \
--t_range 0.2 0.6 \
--bg_radius -1 \
--save_mesh

# Run stage 2
!python main.py -O \
--text "A high-resolution DSLR image of a soccer ball"  \
--sd_version 1.5 \
--image "/content/input/rgba.png" \
--workspace out/magic123-${RUN_ID}-${RUN_ID2}/$dataset/magic123_${FILENAME}_${RUN_ID}_${RUN_ID2} \
--dmtet --init_ckpt out/magic123-${RUN_ID}-coarse/$dataset/magic123_${FILENAME}_${RUN_ID}_coarse/checkpoints/magic123_${FILENAME}_${RUN_ID}_coarse.pth \
--iters 5000 \
--optim adam \
--known_view_interval 4 \
--latent_iter_ratio 0 \
--guidance SD zero123 \
--lambda_guidance 1e-3 0.01 \
--guidance_scale 100 5 \
--rm_edge \
--bg_radius -1 \
--save_mesh

I would appreciate your help. In the README file, it is mentioned that the code should be able to run on a V100 32G GPU, which has less memory than what I am using.

Error Installing Dependencies for Magic123 on Google Colab

I am trying to run the Magic123 model in a Google Colab, but I am encountering installation errors for several packages (raymarching, shencoder, freqencoder, and gridencoder). The installation fails during the execution of install.sh, with the following error for each package

Installing collected packages: raymarching
error: subprocess-exited-with-error

× Running setup.py install for raymarching did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Running setup.py install for raymarching ... error
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> raymarching

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure."

And when tryingto install them with pip setup.py install i get this error:

install_log.log

Edit: I found someone's work on the Internet, trying Magic123 in GooleColab like me, but when I compile this notebook, I get the same error as well. They didnt seem to have this error when the notebook was created.

Any tips or advice on resolving this issue would be greatly appreciated. Thank you in advance for your help!

one Running error with bash scripts/magic123/run_both_priors.sh 0 default dmtet data/realfusion15/metal_dragon_statue rgba.png 1 1

(nerfart) root@interactive43861:/opt/data/private/image_to_3d/Magic123-main# bash scripts/magic123/run_both_priors.sh 0 default dmtet /opt/data/private/image_to_3d/Magic123-main/data/bird_sparrow rgba.png 1 1 --lambda
_guidance 1 40
scripts/magic123/run_both_priors.sh: line 13: module: command not found
scripts/magic123/run_both_priors.sh: line 18: venv_magic123/bin/activate: No such file or directory
/root/anaconda3/envs/nerfart/bin/python
Thu Aug 3 18:22:14 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.91.03 Driver Version: 460.91.03 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce RTX 3090 Off | 00000000:1B:00.0 Off | N/A |
| 30% 32C P8 28W / 350W | 0MiB / 24268MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 GeForce RTX 3090 Off | 00000000:3D:00.0 Off | N/A |
| 30% 28C P8 16W / 350W | 0MiB / 24268MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0
interactive43861
number of gpus: 2
reconstruct bird_sparrow under dataset data from folder /opt/data/private/image_to_3d/Magic123-main/data/bird_sparrow ...
[23/08/03 18:30:29 main]: NeRFNetwork(
(encoder): GridEncoder: input_dim=3 num_levels=16 level_dim=2 resolution=16 -> 2048 per_level_scale=1.3819 params=(6098120, 2) gridtype=hash align_corners=False interpolation=smoothstep
(sigma_net): MLP(
(net): ModuleList(
(0): Linear(in_features=32, out_features=64, bias=True)
(1): Linear(in_features=64, out_features=64, bias=True)
(2): Linear(in_features=64, out_features=4, bias=True)
)
)
)
WARNING [23/08/03 18:30:30 xformers]: WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
PyTorch 2.0.1+cu118 with CUDA 1108 (you have 1.13.1+cu117)
Python 3.8.16 (you have 3.8.16)
Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
Memory-efficient attention, SwiGLU, sparse and more won't be available.
Set XFORMERS_MORE_DETAILS=1 for more details
[23/08/03 18:30:32 guidance.sd_utils]: [INFO] loading stable diffusion...
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connectionpool.py:670 in │
│ urlopen │
│ │
│ 667 │ │ │ │ self._prepare_proxy(conn) │
│ 668 │ │ │ │
│ 669 │ │ │ # Make the request on the httplib connection object. │
│ ❱ 670 │ │ │ httplib_response = self._make_request( │
│ 671 │ │ │ │ conn, │
│ 672 │ │ │ │ method, │
│ 673 │ │ │ │ url, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connectionpool.py:381 in │
│ _make_request │
│ │
│ 378 │ │ │
│ 379 │ │ # Trigger any extra validation we need to do. │
│ 380 │ │ try: │
│ ❱ 381 │ │ │ self._validate_conn(conn) │
│ 382 │ │ except (SocketTimeout, BaseSSLError) as e: │
│ 383 │ │ │ # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout. │
│ 384 │ │ │ self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connectionpool.py:978 in │
validate_conn │
│ │
│ 975 │ │ │
│ 976 │ │ # Force connect early to allow us to validate the connection. │
│ 977 │ │ if not getattr(conn, "sock", None): # AppEngine might not have .sock
│ ❱ 978 │ │ │ conn.connect() │
│ 979 │ │ │
│ 980 │ │ if not conn.is_verified: │
│ 981 │ │ │ warnings.warn( │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connection.py:362 in connect │
│ │
│ 359 │ │ ): │
│ 360 │ │ │ context.load_default_certs() │
│ 361 │ │ │
│ ❱ 362 │ │ self.sock = ssl_wrap_socket( │
│ 363 │ │ │ sock=conn, │
│ 364 │ │ │ keyfile=self.key_file, │
│ 365 │ │ │ certfile=self.cert_file, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/util/ssl
.py:386 in │
│ ssl_wrap_socket │
│ │
│ 383 │ │ server_hostname is not None and not is_ipaddress(server_hostname) │
│ 384 │ ) or IS_SECURETRANSPORT: │
│ 385 │ │ if HAS_SNI and server_hostname is not None: │
│ ❱ 386 │ │ │ return context.wrap_socket(sock, server_hostname=server_hostname) │
│ 387 │ │ │
│ 388 │ │ warnings.warn( │
│ 389 │ │ │ "An HTTPS request has been made, but the SNI (Server Name " │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/ssl.py:500 in wrap_socket │
│ │
│ 497 │ │ │ │ │ server_hostname=None, session=None): │
│ 498 │ │ # SSLSocket class handles server_hostname encoding before it calls │
│ 499 │ │ # ctx._wrap_socket() │
│ ❱ 500 │ │ return self.sslsocket_class._create( │
│ 501 │ │ │ sock=sock, │
│ 502 │ │ │ server_side=server_side, │
│ 503 │ │ │ do_handshake_on_connect=do_handshake_on_connect, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/ssl.py:1040 in _create │
│ │
│ 1037 │ │ │ │ │ if timeout == 0.0: │
│ 1038 │ │ │ │ │ │ # non-blocking │
│ 1039 │ │ │ │ │ │ raise ValueError("do_handshake_on_connect should not be specifie │
│ ❱ 1040 │ │ │ │ │ self.do_handshake() │
│ 1041 │ │ │ except (OSError, ValueError): │
│ 1042 │ │ │ │ self.close() │
│ 1043 │ │ │ │ raise │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/ssl.py:1309 in do_handshake │
│ │
│ 1306 │ │ try: │
│ 1307 │ │ │ if timeout == 0.0 and block: │
│ 1308 │ │ │ │ self.settimeout(None) │
│ ❱ 1309 │ │ │ self._sslobj.do_handshake() │
│ 1310 │ │ finally: │
│ 1311 │ │ │ self.settimeout(timeout) │
│ 1312 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/requests/adapters.py:486 in send │
│ │
│ 483 │ │ │ timeout = TimeoutSauce(connect=timeout, read=timeout) │
│ 484 │ │ │
│ 485 │ │ try: │
│ ❱ 486 │ │ │ resp = conn.urlopen( │
│ 487 │ │ │ │ method=request.method, │
│ 488 │ │ │ │ url=url, │
│ 489 │ │ │ │ body=request.body, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connectionpool.py:726 in │
│ urlopen │
│ │
│ 723 │ │ │ elif isinstance(e, (SocketError, HTTPException)): │
│ 724 │ │ │ │ e = ProtocolError("Connection aborted.", e) │
│ 725 │ │ │ │
│ ❱ 726 │ │ │ retries = retries.increment( │
│ 727 │ │ │ │ method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] │
│ 728 │ │ │ ) │
│ 729 │ │ │ retries.sleep() │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/util/retry.py:410 in increment │
│ │
│ 407 │ │ elif error and self._is_read_error(error): │
│ 408 │ │ │ # Read retry? │
│ 409 │ │ │ if read is False or not self._is_method_retryable(method): │
│ ❱ 410 │ │ │ │ raise six.reraise(type(error), error, _stacktrace) │
│ 411 │ │ │ elif read is not None: │
│ 412 │ │ │ │ read -= 1 │
│ 413 │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/packages/six.py:734 in reraise │
│ │
│ 731 │ │ │ if value is None: │
│ 732 │ │ │ │ value = tp() │
│ 733 │ │ │ if value.traceback is not tb: │
│ ❱ 734 │ │ │ │ raise value.with_traceback(tb) │
│ 735 │ │ │ raise value │
│ 736 │ │ finally: │
│ 737 │ │ │ value = None │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connectionpool.py:670 in │
│ urlopen │
│ │
│ 667 │ │ │ │ self._prepare_proxy(conn) │
│ 668 │ │ │ │
│ 669 │ │ │ # Make the request on the httplib connection object. │
│ ❱ 670 │ │ │ httplib_response = self._make_request( │
│ 671 │ │ │ │ conn, │
│ 672 │ │ │ │ method, │
│ 673 │ │ │ │ url, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connectionpool.py:381 in │
│ _make_request │
│ │
│ 378 │ │ │
│ 379 │ │ # Trigger any extra validation we need to do. │
│ 380 │ │ try: │
│ ❱ 381 │ │ │ self._validate_conn(conn) │
│ 382 │ │ except (SocketTimeout, BaseSSLError) as e: │
│ 383 │ │ │ # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout. │
│ 384 │ │ │ self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connectionpool.py:978 in │
validate_conn │
│ │
│ 975 │ │ │
│ 976 │ │ # Force connect early to allow us to validate the connection. │
│ 977 │ │ if not getattr(conn, "sock", None): # AppEngine might not have .sock
│ ❱ 978 │ │ │ conn.connect() │
│ 979 │ │ │
│ 980 │ │ if not conn.is_verified: │
│ 981 │ │ │ warnings.warn( │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/connection.py:362 in connect │
│ │
│ 359 │ │ ): │
│ 360 │ │ │ context.load_default_certs() │
│ 361 │ │ │
│ ❱ 362 │ │ self.sock = ssl_wrap_socket( │
│ 363 │ │ │ sock=conn, │
│ 364 │ │ │ keyfile=self.key_file, │
│ 365 │ │ │ certfile=self.cert_file, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/urllib3/util/ssl
.py:386 in │
│ ssl_wrap_socket │
│ │
│ 383 │ │ server_hostname is not None and not is_ipaddress(server_hostname) │
│ 384 │ ) or IS_SECURETRANSPORT: │
│ 385 │ │ if HAS_SNI and server_hostname is not None: │
│ ❱ 386 │ │ │ return context.wrap_socket(sock, server_hostname=server_hostname) │
│ 387 │ │ │
│ 388 │ │ warnings.warn( │
│ 389 │ │ │ "An HTTPS request has been made, but the SNI (Server Name " │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/ssl.py:500 in wrap_socket │
│ │
│ 497 │ │ │ │ │ server_hostname=None, session=None): │
│ 498 │ │ # SSLSocket class handles server_hostname encoding before it calls │
│ 499 │ │ # ctx._wrap_socket() │
│ ❱ 500 │ │ return self.sslsocket_class._create( │
│ 501 │ │ │ sock=sock, │
│ 502 │ │ │ server_side=server_side, │
│ 503 │ │ │ do_handshake_on_connect=do_handshake_on_connect, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/ssl.py:1040 in _create │
│ │
│ 1037 │ │ │ │ │ if timeout == 0.0: │
│ 1038 │ │ │ │ │ │ # non-blocking │
│ 1039 │ │ │ │ │ │ raise ValueError("do_handshake_on_connect should not be specifie │
│ ❱ 1040 │ │ │ │ │ self.do_handshake() │
│ 1041 │ │ │ except (OSError, ValueError): │
│ 1042 │ │ │ │ self.close() │
│ 1043 │ │ │ │ raise │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/ssl.py:1309 in do_handshake │
│ │
│ 1306 │ │ try: │
│ 1307 │ │ │ if timeout == 0.0 and block: │
│ 1308 │ │ │ │ self.settimeout(None) │
│ ❱ 1309 │ │ │ self._sslobj.do_handshake() │
│ 1310 │ │ finally: │
│ 1311 │ │ │ self.settimeout(timeout) │
│ 1312 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /opt/data/private/image_to_3d/Magic123-main/main.py:573 in │
│ │
│ 570 │ │ │ │ opt.guidance_scale) else opt.guidance_scale[-1] │
│ 571 │ │ │ if 'SD' == guidance_type: │
│ 572 │ │ │ │ from guidance.sd_utils import StableDiffusion, token_replace │
│ ❱ 573 │ │ │ │ guidance['SD'] = StableDiffusion(device, opt.fp16, opt.vram_O, opt.sd_ve │
│ 574 │ │ │ │ │ │ │ │ │ │ │ │ learned_embeds_path=opt.learned_embeds_ │
│ 575 │ │ │ │ │ │ │ │ │ │ │ │ use_clip=opt.use_clip, clip_t=opt.clip_ │
│ 576 │ │ │ │ │ │ │ │ │ │ │ │ ) │
│ │
│ /opt/data/private/image_to_3d/Magic123-main/guidance/sd_utils.py:150 in init
│ │
│ 147 │ │ self.precision_t = torch.float16 if fp16 else torch.float32 │
│ 148 │ │ │
│ 149 │ │ # Create model │
│ ❱ 150 │ │ pipe = StableDiffusionPipeline.from_pretrained( │
│ 151 │ │ │ sd_path, torch_dtype=self.precision_t, local_files_only=False) │
│ 152 │ │ │
│ 153 │ │ if isfile('./unet_traced.pt'): │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/diffusers/pipelines/pipeline_utils.py:8 │
│ 84 in from_pretrained │
│ │
│ 881 │ │ # 1. Download the checkpoints and configs │
│ 882 │ │ # use snapshot download here to get it working from from_pretrained │
│ 883 │ │ if not os.path.isdir(pretrained_model_name_or_path): │
│ ❱ 884 │ │ │ cached_folder = cls.download( │
│ 885 │ │ │ │ pretrained_model_name_or_path, │
│ 886 │ │ │ │ cache_dir=cache_dir, │
│ 887 │ │ │ │ resume_download=resume_download, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/diffusers/pipelines/pipeline_utils.py:1 │
│ 218 in download │
│ │
│ 1215 │ │ │ │ resume_download=resume_download, │
│ 1216 │ │ │ │ use_auth_token=use_auth_token, │
│ 1217 │ │ │ ) │
│ ❱ 1218 │ │ │ info = model_info( │
│ 1219 │ │ │ │ pretrained_model_name, │
│ 1220 │ │ │ │ use_auth_token=use_auth_token, │
│ 1221 │ │ │ │ revision=revision, │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py:12 │
│ 0 in _inner_fn │
│ │
│ 117 │ │ if check_use_auth_token: │
│ 118 │ │ │ kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.name, has_token=ha │
│ 119 │ │ │
│ ❱ 120 │ │ return fn(*args, **kwargs) │
│ 121 │ │
│ 122 │ return _inner_fn # type: ignore │
│ 123 │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/huggingface_hub/hf_api.py:1603 in │
│ model_info │
│ │
│ 1600 │ │ │ params["securityStatus"] = True │
│ 1601 │ │ if files_metadata: │
│ 1602 │ │ │ params["blobs"] = True │
│ ❱ 1603 │ │ r = get_session().get(path, headers=headers, timeout=timeout, params=params) │
│ 1604 │ │ hf_raise_for_status(r) │
│ 1605 │ │ d = r.json() │
│ 1606 │ │ return ModelInfo(**d) │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/requests/sessions.py:600 in get │
│ │
│ 597 │ │ """ │
│ 598 │ │ │
│ 599 │ │ kwargs.setdefault("allow_redirects", True) │
│ ❱ 600 │ │ return self.request("GET", url, **kwargs) │
│ 601 │ │
│ 602 │ def options(self, url, **kwargs): │
│ 603 │ │ r"""Sends a OPTIONS request. Returns :class:Response object. │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/requests/sessions.py:587 in request │
│ │
│ 584 │ │ │ "allow_redirects": allow_redirects, │
│ 585 │ │ } │
│ 586 │ │ send_kwargs.update(settings) │
│ ❱ 587 │ │ resp = self.send(prep, **send_kwargs) │
│ 588 │ │ │
│ 589 │ │ return resp │
│ 590 │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/requests/sessions.py:701 in send │
│ │
│ 698 │ │ start = preferred_clock() │
│ 699 │ │ │
│ 700 │ │ # Send the request │
│ ❱ 701 │ │ r = adapter.send(request, **kwargs) │
│ 702 │ │ │
│ 703 │ │ # Total elapsed time of the request (approximately) │
│ 704 │ │ elapsed = preferred_clock() - start │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/requests/adapters.py:501 in send │
│ │
│ 498 │ │ │ ) │
│ 499 │ │ │
│ 500 │ │ except (ProtocolError, OSError) as err: │
│ ❱ 501 │ │ │ raise ConnectionError(err, request=request) │
│ 502 │ │ │
│ 503 │ │ except MaxRetryError as e: │
│ 504 │ │ │ if isinstance(e.reason, ConnectTimeoutError): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /opt/data/private/image_to_3d/Magic123-main/main.py:472 in │
│ │
│ 469 │ │
│ 470 │ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') │
│ 471 │ opt.device = device │
│ ❱ 472 │ model = NeRFNetwork(opt).to(device) │
│ 473 │ │
│ 474 │ if opt.init_ckpt != '': │
│ 475 │ │ if not os.path.exists(opt.init_ckpt): │
│ │
│ /opt/data/private/image_to_3d/Magic123-main/nerf/network_grid.py:29 in init
│ │
│ 26 │ │ │ │ level_dim=2 │
│ 27 │ │ │ │ ): │
│ 28 │ │ │
│ ❱ 29 │ │ super().init(opt) │
│ 30 │ │ │
│ 31 │ │ self.num_layers = opt.num_layers if hasattr(opt, 'num_layers') else num_layers │
│ 32 │ │ self.hidden_dim = opt.hidden_dim if hasattr(opt, 'hidden_dim') else hidden_dim │
│ │
│ /opt/data/private/image_to_3d/Magic123-main/nerf/renderer.py:668 in init
│ │
│ 665 │ │ │
│ 666 │ │ # load dmtet vertices │
│ 667 │ │ if self.opt.dmtet: │
│ ❱ 668 │ │ │ self.dmtet = DMTetGeometry(opt.tet_grid_size, opt.tet_mlp, opt).to(opt.devic │
│ 669 │ │ │ if self.opt.h <= 2048 and self.opt.w <= 2048: │
│ 670 │ │ │ │ self.glctx = dr.RasterizeCudaContext() │
│ 671 │ │ │ else: │
│ │
│ /opt/data/private/image_to_3d/Magic123-main/nerf/renderer.py:311 in init
│ │
│ 308 │ │ self.grid_res = grid_res │
│ 309 │ │ self.marching_tets = DMTet() │
│ 310 │ │ │
│ ❱ 311 │ │ tets = np.load('data/tets/{}_tets.npz'.format(self.grid_res)) │
│ 312 │ │ # for 64/128, [N=36562/277410, 3], in [-0.5, 0.5]^3 │
│ 313 │ │ self.verts = torch.tensor( │
│ 314 │ │ │ tets['vertices'], dtype=torch.float32, device=self.device) * 2 │
│ │
│ /root/anaconda3/envs/nerfart/lib/python3.8/site-packages/numpy/lib/npyio.py:407 in load │
│ │
│ 404 │ │ │ fid = file │
│ 405 │ │ │ own_fid = False │
│ 406 │ │ else: │
│ ❱ 407 │ │ │ fid = stack.enter_context(open(os_fspath(file), "rb")) │
│ 408 │ │ │ own_fid = True │
│ 409 │ │ │
│ 410 │ │ # Code to distinguish from NumPy binary files and pickles. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'data/tets/256_tets.npz
please tell me where i can find the 256_tets.npz,i will thank you very much

How to run only dmtet without initialization from nerf

giving error

Traceback (most recent call last):
File "/home/jupyter/Magic123/main.py", line 622, in
trainer.train(train_loader, valid_loader, test_loader, max_epoch)
File "/home/jupyter/Magic123/nerf/utils.py", line 1049, in train
self.train_one_epoch(train_loader, max_epochs)
File "/home/jupyter/Magic123/nerf/utils.py", line 1278, in train_one_epoch
loss, losses_dict, outputs = self.train_step(data)
File "/home/jupyter/Magic123/nerf/utils.py", line 645, in train_step
outputs = self.model.render(rays_o, rays_d, mvp, H, W, staged=False, perturb=True, bg_color=bg_color, ambient_ratio=ambient_ratio, shading=shading, binarize=binarize)
File "/home/jupyter/Magic123/nerf/renderer.py", line 1521, in render
results = self.run_dmtet(rays_o, rays_d, mvp, h, w, **kwargs)
File "/home/jupyter/Magic123/nerf/renderer.py", line 1264, in run_dmtet
rast, rast_db = dr.rasterize(self.glctx, verts_clip, faces, (h, w))
File "/home/jupyter/Magic123/venv_magic123/lib/python3.10/site-packages/nvdiffrast/torch/ops.py", line 310, in rasterize
return _rasterize_func.apply(glctx, pos, tri, resolution, ranges, grad_db, -1)
File "/home/jupyter/Magic123/venv_magic123/lib/python3.10/site-packages/torch/autograd/function.py", line 506, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
File "/home/jupyter/Magic123/venv_magic123/lib/python3.10/site-packages/nvdiffrast/torch/ops.py", line 248, in forward
out, out_db = _get_plugin().rasterize_fwd_cuda(raster_ctx.cpp_wrapper, pos, tri, resolution, ranges, peeling_idx)
RuntimeError: instance mode - pos must have shape [>0, >0, 4]

Issue with Figure 5 in Results

Hi @guochengqian,

I want to express my gratitude for sharing this outstanding work. The results are truly impressive!

However, I noticed a potential issue with Figure 5. It seems that the results of RealFusion are swapped between the Reference and Novel at the bottom of the figure. This discrepancy initially caused confusion for me.

I kindly request you to review and fix this aspect of Figure 5 to ensure the accurate representation of the results.

Thank you.

incorrect normal

I think in the dmtet part, the output obj file have incorrect normal.

Not able to install grid encoder.

Hello authors.

I tried to install the gridencoders from install_ext.sh file you mentioned. While downloading, it says that there is a problem with the package and not with pip.
The problem I can see from the logs is that there is not a definite PyTorch version to install. gridencoder needs a different torch version other than what is present in the environment and that's why it cannot be downloaded.

Here are the logs while downloading grid encoder.
Building wheel for gridencoder (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [40 lines of output]
running bdist_wheel
running build
running build_ext
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/gridencoder/setup.py", line 33, in
setup(
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 364, in run
self.run_command("build")
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 499, in build_extensions
_check_cuda_version(compiler_name, compiler_version)
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 387, in _check_cuda_version
raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda))
RuntimeError:
The detected CUDA version (12.1) mismatches the version that was used to compile
PyTorch (11.7). Please make sure to use the same CUDA versions.

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for gridencoder
Running setup.py clean for gridencoder
Failed to build gridencoder
Installing collected packages: gridencoder
Running setup.py install for gridencoder ... error
error: subprocess-exited-with-error

× Running setup.py install for gridencoder did not run successfully.
│ exit code: 1
╰─> [42 lines of output]
running install
running build
running build_ext
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/gridencoder/setup.py", line 33, in
setup(
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/command/install.py", line 546, in run
self.run_command('build')
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/apps/anaconda3-2022.05/lib/python3.9/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 499, in build_extensions
_check_cuda_version(compiler_name, compiler_version)
File "/home/ukhalid/hasan_work/Bhavay_work/Magic123/venv_magic123/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 387, in _check_cuda_version
raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda))
RuntimeError:
The detected CUDA version (12.1) mismatches the version that was used to compile
PyTorch (11.7). Please make sure to use the same CUDA versions.

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> gridencoder

note: This is an issue with the package mentioned above, not pip.

How to reproduce issue -
I just ran source install.sh and it produced the same issue.

run_both_priors.sh: RuntimeError: instance mode - pos much have shape [>0, >0, 4]

Hi,

Thanks for the great work!

I am trying to run your method through run_both_prior.sh, through the example command you provided:
bash scripts/magic123/run_both_priors.sh 0 default dmtet data/realfusion15/metal_dragon_statue rgba.png 1 1

However, I met an issue soon after training, which I will attached below.

I looked into the issue a little bit and found that it is because in renderer.py, when we call run_dmtet function, the self.dmtet.get_verts_face() function will give us verts with shape [1, 0, 4]

It is a bit surprised that dmtet is called so early as it seems to be used for fine-tuning only. Would you please let me know what may cause this issue? Thanks a lot and looking forward to hearing from you!

[23/08/15 00:06:42 nerf.utils]: ==> [2023-08-15_00-06-42] Start Training out/magic123-default-dmtet/realfusion15/magic123_metal_dragon_statue_default_dmtet Epoch 1/50, lr=0.010000 ...
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\zhl\Documents\Code\Magic123\main.py:622 in │
│ │
│ 619 │ │ │ │ opt, device=device, type='test', H=opt.H, W=opt.W, size=opt.dataset_size │
│ 620 │ │ │ max_epoch = np.ceil(opt.iters / len(train_loader)).astype(np.int32) │
│ 621 │ │ │ │
│ ❱ 622 │ │ │ trainer.train(train_loader, valid_loader, test_loader, max_epoch) │
│ 623 │ │ │ │
│ 624 │ │ │ trainer.test(test_loader) │
│ 625 │ │ │ trainer.test(test_loader, shading='normal') # save normal │
│ │
│ C:\Users\zhl\Documents\Code\Magic123\nerf\utils.py:1049 in train │
│ │
│ 1046 │ │ for epoch in range(self.epoch + 1, max_epochs + 1): │
│ 1047 │ │ │ self.epoch = epoch │
│ 1048 │ │ │ │
│ ❱ 1049 │ │ │ self.train_one_epoch(train_loader, max_epochs) │
│ 1050 │ │ │ │
│ 1051 │ │ │ if self.workspace is not None and self.local_rank == 0: │
│ 1052 │ │ │ │ self.save_checkpoint(full=True, best=False) │
│ │
│ C:\Users\zhl\Documents\Code\Magic123\nerf\utils.py:1278 in train_one_epoch │
│ │
│ 1275 │ │ │ self.optimizer.zero_grad() │
│ 1276 │ │ │ │
│ 1277 │ │ │ with torch.cuda.amp.autocast(enabled=self.fp16): │
│ ❱ 1278 │ │ │ │ loss, losses_dict, outputs = self.train_step(data) │
│ 1279 │ │ │ │
│ 1280 │ │ │ # hooked grad clipping for RGB space │
│ 1281 │ │ │ if self.opt.grad_clip_rgb >= 0: │
│ │
│ C:\Users\zhl\Documents\Code\Magic123\nerf\utils.py:645 in train_step │
│ │
│ 642 │ │ │ else: │
│ 643 │ │ │ │ bg_color = torch.rand(3).to(self.device) # single color random bg │
│ 644 │ │ │
│ ❱ 645 │ │ outputs = self.model.render(rays_o, rays_d, mvp, H, W, staged=False, perturb=Tru │
│ 646 │ │ pred_depth = outputs['depth'].reshape(B, 1, H, W) │
│ 647 │ │ if self.opt.normalize_depth: │
│ 648 │ │ │ pred_depth = nonzero_normalize_depth(pred_depth) │
│ │
│ C:\Users\zhl\Documents\Code\Magic123\nerf\renderer.py:1522 in render │
│ │
│ 1519 │ │ device = rays_o.device │
│ 1520 │ │ │
│ 1521 │ │ if self.dmtet: │
│ ❱ 1522 │ │ │ results = self.run_dmtet(rays_o, rays_d, mvp, h, w, **kwargs) │
│ 1523 │ │ elif self.cuda_ray: │
│ 1524 │ │ │ results = self.run_cuda(rays_o, rays_d, **kwargs) │
│ 1525 │ │ elif self.taichi_ray: │
│ │
│ C:\Users\zhl\Documents\Code\Magic123\nerf\renderer.py:1265 in run_dmtet │
│ │
│ 1262 │ │ # rasterization │
│ 1263 │ │ verts_clip = torch.bmm(F.pad(verts, pad=(0, 1), mode='constant', value=1.0).unsq │
│ 1264 │ │ │ │ │ │ │ mvp.permute(0,2,1)).float() # [B, N, 4] │
│ ❱ 1265 │ │ rast, rast_db = dr.rasterize(self.glctx, verts_clip, faces, (h, w)) │
│ 1266 │ │ │
│ 1267 │ │ alpha, _ = dr.interpolate(torch.ones_like(verts[:, :1]).unsqueeze(0), rast, face │
│ 1268 │ │ xyzs, _ = dr.interpolate(verts.unsqueeze(0), rast, faces) # [B, H, W, 3] │
│ │
│ C:\Users\zhl\Anaconda3\lib\site-packages\nvdiffrast\torch\ops.py:310 in rasterize │
│ │
│ 307 │ │ return RuntimeError("Cannot call rasterize() during depth peeling operation, use │
│ 308 │ │
│ 309 │ # Instantiate the function. │
│ ❱ 310 │ return _rasterize_func.apply(glctx, pos, tri, resolution, ranges, grad_db, -1) │
│ 311 │
│ 312 #---------------------------------------------------------------------------- │
│ 313 # Depth peeler context manager for rasterizing multiple depth layers. │
│ │
│ C:\Users\zhl\Anaconda3\lib\site-packages\torch\autograd\function.py:506 in apply │
│ │
│ 503 │ │ if not torch._C._are_functorch_transforms_active(): │
│ 504 │ │ │ # See NOTE: [functorch vjp and autograd interaction] │
│ 505 │ │ │ args = _functorch.utils.unwrap_dead_wrappers(args) │
│ ❱ 506 │ │ │ return super().apply(*args, **kwargs) # type: ignore[misc] │
│ 507 │ │ │
│ 508 │ │ if cls.setup_context == _SingleLevelFunction.setup_context: │
│ 509 │ │ │ raise RuntimeError( │
│ │
│ C:\Users\zhl\Anaconda3\lib\site-packages\nvdiffrast\torch\ops.py:248 in forward │
│ │
│ 245 │ │ if isinstance(raster_ctx, RasterizeGLContext): │
│ 246 │ │ │ out, out_db = _get_plugin(gl=True).rasterize_fwd_gl(raster_ctx.cpp_wrapper, │
│ 247 │ │ else: │
│ ❱ 248 │ │ │ out, out_db = _get_plugin().rasterize_fwd_cuda(raster_ctx.cpp_wrapper, pos, │
│ 249 │ │ ctx.save_for_backward(pos, tri, out) │
│ 250 │ │ ctx.saved_grad_db = grad_db │
│ 251 │ │ return out, out_db │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: instance mode - pos must have shape [>0, >0, 4]

Unexpected key(s) in state_dict

Hello, many thanks for your wonderful work, when I load the pretrained/midas/dpt_beit_large_512.pt, I meet a RuntimeError as follows:
RuntimeError: Error(s) in loading state_dict for DPTDepthModel:
Unexpected key(s) in state_dict: "pretrained.model.blocks.0.attn.relative_position_index", "pretrained.model.blocks.1.attn.relative_position_index", "pretrained.model.blocks.2.attn.relative_position_index", "pretrained.model.blocks.3.attn.relative_position_index", "pretrained.model.blocks.4.attn.relative_position_index", "pretrained.model.blocks.5.attn.relative_position_index", "pretrained.model.blocks.6.attn.relative_position_index", "pretrained.model.blocks.7.attn.relative_position_index", "pretrained.model.blocks.8.attn.relative_position_index", "pretrained.model.blocks.9.attn.relative_position_index", "pretrained.model.blocks.10.attn.relative_position_index", "pretrained.model.blocks.11.attn.relative_position_index", "pretrained.model.blocks.12.attn.relative_position_index", "pretrained.model.blocks.13.attn.relative_position_index", "pretrained.model.blocks.14.attn.relative_position_index", "pretrained.model.blocks.15.attn.relative_position_index", "pretrained.model.blocks.16.attn.relative_position_index", "pretrained.model.blocks.17.attn.relative_position_index", "pretrained.model.blocks.18.attn.relative_position_index", "pretrained.model.blocks.19.attn.relative_position_index", "pretrained.model.blocks.20.attn.relative_position_index", "pretrained.model.blocks.21.attn.relative_position_index", "pretrained.model.blocks.22.attn.relative_position_index", "pretrained.model.blocks.23.attn.relative_position_index".

Habibi, You change the name of a-fullbody-ironman folder from 'ironman' to in data folder

Habibi, You change the name of a-fullbody-ironman folder from 'ironman' to in data folder, but didn't change the example in readme file in Step 2: textual inversion [Optional]

bash scripts/textual_inversion/textual_inversion.sh runwayml/stable-diffusion-v1-5 data/demo/ironman/rgba.png out/textual_inversion/ironman _ironman_ ironman --max_train_steps 3000

change ironman to a-fullbody-ironman please

data folder

Hi, where is the data folder? It would be helpful to have the examples referenced in the docs

Error installing with sh with macOS Sonoma

I kept getting error when installing into macOS Sonoma. Can this work without NVidia?

source install.sh
install.sh:3: command not found: module
install.sh:4: command not found: module
install.sh:5: command not found: module
Requirement already satisfied: torch in ./venv_magic123/lib/python3.10/site-packages (2.0.1)
Requirement already satisfied: torchvision in ./venv_magic123/lib/python3.10/site-packages (0.15.2)
Requirement already satisfied: filelock in ./venv_magic123/lib/python3.10/site-packages (from torch) (3.12.2)
Requirement already satisfied: typing-extensions in ./venv_magic123/lib/python3.10/site-packages (from torch) (4.7.1)
Requirement already satisfied: sympy in ./venv_magic123/lib/python3.10/site-packages (from torch) (1.12)
Requirement already satisfied: networkx in ./venv_magic123/lib/python3.10/site-packages (from torch) (3.1)
Requirement already satisfied: jinja2 in ./venv_magic123/lib/python3.10/site-packages (from torch) (3.1.2)
Requirement already satisfied: numpy in ./venv_magic123/lib/python3.10/site-packages (from torchvision) (1.25.2)
Requirement already satisfied: requests in ./venv_magic123/lib/python3.10/site-packages (from torchvision) (2.31.0)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in ./venv_magic123/lib/python3.10/site-packages (from torchvision) (10.0.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./venv_magic123/lib/python3.10/site-packages (from jinja2->torch) (2.1.3)
Requirement already satisfied: charset-normalizer<4,>=2 in ./venv_magic123/lib/python3.10/site-packages (from requests->torchvision) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in ./venv_magic123/lib/python3.10/site-packages (from requests->torchvision) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./venv_magic123/lib/python3.10/site-packages (from requests->torchvision) (2.0.4)
Requirement already satisfied: certifi>=2017.4.17 in ./venv_magic123/lib/python3.10/site-packages (from requests->torchvision) (2023.7.22)
Requirement already satisfied: mpmath>=0.19 in ./venv_magic123/lib/python3.10/site-packages (from sympy->torch) (1.3.0)
Collecting git+https://github.com/NVlabs/nvdiffrast/ (from -r requirements.txt (line 35))
  Cloning https://github.com/NVlabs/nvdiffrast/ to /private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-req-build-n620rpyy
  Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/nvdiffrast/ /private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-req-build-n620rpyy
  Resolved https://github.com/NVlabs/nvdiffrast/ to commit c5caf7bdb8a2448acc491a9faa47753972edd380
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting git+https://github.com/openai/CLIP.git (from -r requirements.txt (line 45))
  Cloning https://github.com/openai/CLIP.git to /private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-req-build-nuhso61n
  Running command git clone --filter=blob:none --quiet https://github.com/openai/CLIP.git /private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-req-build-nuhso61n
  Resolved https://github.com/openai/CLIP.git to commit a1d071733d7111c9c014f024669f959182114e33
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting git+https://github.com/ashawkey/cubvh (from -r requirements.txt (line 55))
  Cloning https://github.com/ashawkey/cubvh to /private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-req-build-mv3wxooq
  Running command git clone --filter=blob:none --quiet https://github.com/ashawkey/cubvh /private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-req-build-mv3wxooq
  Resolved https://github.com/ashawkey/cubvh to commit d3e923c90e56974d39f57c2e2b9bf372d2e45870
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-1age28hp/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-1age28hp/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-1age28hp/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-1age28hp/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 3, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Processing ./raymarching
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-82p7d66s/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-82p7d66s/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-82p7d66s/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-82p7d66s/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 3, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Processing ./shencoder
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-na2dcujd/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-na2dcujd/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-na2dcujd/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-na2dcujd/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 3, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Processing ./freqencoder
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-0eb_k0w3/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-0eb_k0w3/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-0eb_k0w3/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-0eb_k0w3/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 3, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Processing ./gridencoder
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/jimmygunawan/Magic123/venv_magic123/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-l43uv26q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-l43uv26q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-l43uv26q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/dd/6tfdfc6x5pz37mrm2msqyc9r0000gn/T/pip-build-env-l43uv26q/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 3, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

If i have multi-view images,..

Hi,

Thank you for your excellent investigation. Also, thank you for answering many questions every time...
If i have multi-view images like back and side of the object, can I replace some view's images?

[issue in step 1] Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

[23/08/10 19:40:31 nerf.utils]: ==> [2023-08-10_19-40-31] Start Training out/magic123-default-coarse/realfusion15/magic123_metal_dragon_statue_default_coarse Epoch 1/50, lr=0.010000 ...

/data1/akai/coser/image_generate/Magic123/nerf/renderer.py(1493)update_extra_state()
-> xx, yy, zz = custom_meshgrid(xs, ys, zs)
(Pdb) c
../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [213,0,0], thread: [32,0,0] Assertion index >= -sizes[i] && index < sizes[i] && "index out of bounds" failed.
../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [213,0,0], thread: [33,0,0] Assertion index >= -sizes[i] && index < sizes[i] && "index out of bounds" failed.
...
...
../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [298,0,0], thread: [62,0,0] Assertion index >= -sizes[i] && index < sizes[i] && "index out of bounds" failed.
../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [298,0,0], thread: [63,0,0] Assertion index >= -sizes[i] && index < sizes[i] && "index out of bounds" failed.
Traceback (most recent call last):
File "main.py", line 594, in
if opt.learned_embeds_path is not None and os.path.exists(opt.learned_embeds_path): # add textual inversion tokens to model
File "/data1/Magic123/nerf/utils.py", line 1049, in train
self.train_one_epoch(train_loader, max_epochs)
File "/data1/Magic123/nerf/utils.py", line 1263, in train_one_epoch
self.model.update_extra_state()
File "/home/groot/apps/miniconda/envs/e3/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/data1/Magic123/nerf/renderer.py", line 1493, in update_extra_state
xx, yy, zz = custom_meshgrid(xs, ys, zs)
RuntimeError: CUDA error: device-side assert triggered
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

please tell me how to fix it,thank you.

😘😍😀「𝕙𝕒𝕓𝕚𝕓𝕚 𝕗𝕚𝕣𝕤𝕥 𝕤𝕠𝕗𝕒 𝕡𝕠𝕤𝕥」𝕎𝕒𝕚𝕥𝕚𝕟𝕘 𝕗𝕠𝕣 𝕪𝕠𝕦𝕣 𝕖𝕩𝕔𝕖𝕝𝕝𝕖𝕟𝕥 𝕨𝕠𝕣𝕜 𝕒𝕤 𝕞𝕪 𝕗𝕚𝕣𝕤𝕥 𝕡𝕣𝕠𝕛𝕖𝕔𝕥 𝕒𝕗𝕥𝕖𝕣 𝕒 𝕪𝕖𝕒𝕣. 👨‍💻🧕🏻🧑🏻‍⚕️

「͟h͟a͟b͟i͟b͟i͟ ͟f͟i͟r͟s͟t͟ ͟s͟o͟f͟a͟ ͟p͟o͟s͟t͟」͟W͟a͟i͟t͟i͟n͟g͟ ͟f͟o͟r͟ ͟y͟o͟u͟r͟ ͟e͟x͟c͟e͟l͟l͟e͟n͟t͟ ͟w͟o͟r͟k͟ ͟a͟s͟ ͟m͟y͟ ͟f͟i͟r͟s͟t͟ ͟p͟r͟o͟j͟e͟c͟t͟ ͟a͟f͟t͟e͟r͟ ͟a͟ ͟y͟e͟a͟r͟.͟

From Dubai

Unexpected key(s) in state_dict

(pytorch_wsh) D:\迅雷下载\Magic123-main>python preprocess_image.py --path data/demo/a-full-body-ironman/image.png
Traceback (most recent call last):
File "D:\迅雷下载\Magic123-main\preprocess_image.py", line 266, in
depth_estimator = DepthEstimator()
File "D:\迅雷下载\Magic123-main\preprocess_image.py", line 158, in init
model, transform, net_w, net_h = load_model(f"cuda:{self.config.device}", self.config.model_weights, self.config.model_type,
File "D:\迅雷下载\Magic123-main\midas\model_loader.py", line 50, in load_model
model = DPTDepthModel(
File "D:\迅雷下载\Magic123-main\midas\dpt_depth.py", line 163, in init
self.load(path)
File "D:\迅雷下载\Magic123-main\midas\base_model.py", line 16, in load
self.load_state_dict(parameters)
File "E:\anaconda\envs\pytorch_wsh\lib\site-packages\torch\nn\modules\module.py", line 1223, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DPTDepthModel:
Unexpected key(s) in state_dict: "pretrained.model.blocks.0.attn.relative_position_index", "pretrained.model.blocks.1.attn.relative_position_index", "pretrained.mo
del.blocks.2.attn.relative_position_index", "pretrained.model.blocks.3.attn.relative_position_index", "pretrained.model.blocks.4.attn.relative_position_index", "pretrained
.model.blocks.5.attn.relative_position_index", "pretrained.model.blocks.6.attn.relative_position_index", "pretrained.model.blocks.7.attn.relative_position_index", "pretrai
ned.model.blocks.8.attn.relative_position_index", "pretrained.model.blocks.9.attn.relative_position_index", "pretrained.model.blocks.10.attn.relative_position_index", "pre
trained.model.blocks.11.attn.relative_position_index", "pretrained.model.blocks.12.attn.relative_position_index", "pretrained.model.blocks.13.attn.relative_position_index"
, "pretrained.model.blocks.14.attn.relative_position_index", "pretrained.model.blocks.15.attn.relative_position_index", "pretrained.model.blocks.16.attn.relative_position_
index", "pretrained.model.blocks.17.attn.relative_position_index", "pretrained.model.blocks.18.attn.relative_position_index", "pretrained.model.blocks.19.attn.relative_pos
ition_index", "pretrained.model.blocks.20.attn.relative_position_index", "pretrained.model.blocks.21.attn.relative_position_index", "pretrained.model.blocks.22.attn.relative_position_index", "pretrained.model.blocks.23.attn.relative_position_index".

I'm currently experiencing a token-related issue

(venv_magic123) (base) root@36d231460096:~/Magic123# bash scripts/textual_inversion/textual_inversion.sh runwayml/stable-diffusion-v1-5 data/nerf4/chair chair chair --max_train_steps=3000
===> Anaconda env loaded
36d231460096
number of gpus: 4
09/08/2023 05:00:40 - INFO - main - Namespace(adam_beta1=0.9, adam_beta2=0.999, adam_epsilon=1e-08, adam_weight_decay=0.01, allow_tf32=False, center_crop=False, checkpointing_steps=500, checkpoints_total_limit=None, dataloader_num_workers=0, enable_xformers_memory_efficient_attention=False, gradient_accumulation_steps=1, gradient_checkpointing=False, hub_model_id=None, hub_token=None, initializer_token='', learnable_property='object', learning_rate=0.0001, local_rank=-1, logging_dir='logs', lr_scheduler='constant', lr_warmup_steps=0, max_train_steps=3000, mixed_precision='no', num_train_epochs=100, num_validation_images=4, only_save_embeds=False, output_dir='chair', placeholder_token='--max_train_steps=3000', pretrained_model_name_or_path='data/nerf4/chair', push_to_hub=False, repeats=100, report_to='tensorboard', resolution=512, resume_from_checkpoint=None, revision=None, save_steps=500, scale_lr=False, seed=None, tokenizer_name=None, train_batch_size=16, train_data_dir='chair', use_augmentations=True, validation_epochs=None, validation_prompt=None, validation_steps=100)
09/08/2023 05:00:40 - INFO - main - Distributed environment: NO
Num processes: 1
Process index: 0
Local process index: 0
Device: cpu

Mixed precision type: no

Traceback (most recent call last):
File "textual-inversion/textual_inversion.py", line 927, in
main()
File "textual-inversion/textual_inversion.py", line 628, in main
tokenizer = CLIPTokenizer.from_pretrained(args.pretrained_model_name_or_path, subfolder="tokenizer")
File "/root/Magic123/venv_magic123/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1838, in from_pretrained
raise EnvironmentError(
OSError: Can't load tokenizer for 'data/nerf4/chair'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'data/nerf4/chair' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.

I'm currently experiencing a token-related issue as shown above. Could you please assist me in resolving this? Thank you

Issue in step2

I run this command :
bash scripts/texural_inversion/textural_inversion.sh runwayml/stable-diffusion-v1-5 data/demo/ironman/rgba.png out/textual_inversion/ironman ironman ironman --max_train_steps 3000

but got this error :
textual_inversion.py: error: unrecognized arguments: 3000

what's the problem?!

Installation Errors

Hey @guochengqian,
I was waiting for your code to release for so long and finally it is released. The demos look really impressive.

  1. I am trying to implement your code on my system. I have an Intel(R) Xeon(R) CPU E5-2680 0, NVIDIA GeForce GTX 1660 Ti GPU.
    On PyCharm venv, when I tried installing requirements.txt file, it started giving me errors saying 'ModuleNotFoundError: No module named 'torch'. I then manually installed all the packages. When I displayed 'pip list', I can see torch 1.13.1+cu117, torch-vision 0.1.6.dev0, torchaudio 0.13.1, torchvision 0.14.1.

Then I proceeded ahead to download the 2 pre-trained models manually and kept them in their respective folders.

I then created my own folder under data/demos and uploaded a .png file of 1002 x 1002 pixels.

I ran the preprocess_image.py file by giving an absolute path. Here, it again gave me an error saying the following:

UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten
src\ATen\native\TensorShape.cpp:3191.)
return VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Model loaded, number of parameters = 345M
[INFO] loading image /E:/User/Magic123
/Magic123/data/demo/imagefolder/image.png...
[ WARN:[email protected]] global loadsave.cpp:248 cv::findDecoder imread_('/E:/User/Magic123_/Magic123/data/demo/imagefolder/image.png'): can't open/read file: check file path/integrity
Traceback (most recent call last):
File "preprocess_image.py", line 277, in
process_single_image(path, depth_estimator,
File "preprocess_image.py", line 209, in process_single_image
if image.shape[-1] == 4:
AttributeError: 'NoneType' object has no attribute 'shape'

I thought all requirements were not fulfilled, so I again ran 'pip install -r requirements.txt'. It gave me the following error:

Collecting git+https://github.com/NVlabs/nvdiffrast/ (from -r requirements.txt (line 35))
Cloning https://github.com/NVlabs/nvdiffrast/ to c:\users\umesh\appdata\local\temp\pip-req-build-46u0wfek
Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/nvdiffrast/ 'C:\Users\user\AppData\Local\Temp\pip-req-build-46u0wfek'
Resolved https://github.com/NVlabs/nvdiffrast/ to commit c5caf7bdb8a2448acc491a9faa47753972edd380
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting git+https://github.com/openai/CLIP.git (from -r requirements.txt (line 45))
Cloning https://github.com/openai/CLIP.git to c:\users\umesh\appdata\local\temp\pip-req-build-278rxy5f
Running command git clone --filter=blob:none --quiet https://github.com/openai/CLIP.git 'C:\Users\user\AppData\Local\Temp\pip-req-build-278rxy5f'
Resolved https://github.com/openai/CLIP.git to commit a1d071733d7111c9c014f024669f959182114e33
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting git+https://github.com/ashawkey/cubvh (from -r requirements.txt (line 55))
Cloning https://github.com/ashawkey/cubvh to c:\users\umesh\appdata\local\temp\pip-req-build-_xosaue2
Running command git clone --filter=blob:none --quiet https://github.com/ashawkey/cubvh 'C:\Users\user\AppData\Local\Temp\pip-req-build-_xosaue2'
Resolved https://github.com/ashawkey/cubvh to commit d3e923c90e56974d39f57c2e2b9bf372d2e45870
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
Traceback (most recent call last):
File "e:\user\magic123_\m123env\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
main()
File "e:\user\magic123_\m123env\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "e:\user\magic123_\m123env\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\user\AppData\Local\Temp\pip-build-env-y9hro2_3\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "C:\Users\user\AppData\Local\Temp\pip-build-env-y9hro2_3\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
self.run_setup()
File "C:\Users\user\AppData\Local\Temp\pip-build-env-y9hro2_3\overlay\Lib\site-packages\setuptools\build_meta.py", line 488, in run_setup
self).run_setup(setup_script=setup_script)
File "C:\Users\user\AppData\Local\Temp\pip-build-env-y9hro2_3\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
exec(code, locals())
File "", line 3, in
ModuleNotFoundError: No module named 'torch'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I am unsure what the problem is exactly because, I even tried creating a new virtual env and redoing the same steps but in no vain.
Could you guide what can be exactly done to resolve this issue?

Thank you!

Code Release

Thanks for your great job and fantastic idea! By the way, may I ask when will the code be released?

about improvement over previous methods

Hi! Thanks for your awesome work!
I noticed that:

  1. the clarity of your 3D reconstruction is very high, which shows a significant improvement compared to the previous method. I really want to know the improvements you made to the code(stable-dreamfusion codebase)? Thank you very much!
  2. In the first few epochs of training, the results of front perspective are already very good. The examples of epoch 3:
    magic123_metal_dragon_statue_nerf_coarse_ep0003_lambertian

The results of previous method:
stable-dreamfusion
The results of magic123:
magic123

Hyperparameter of the each mesh

Hi,

Thank you for your great research.
Using Magic 123, I drew mash as a picture of a person. However, the result of the mesh wasn't good..
The distinction between the ends of the pants and the legs is not clear. And, back of the mesh was strange

So, I want to know the hyperparameter's of the Lisa's mesh and Taylor swift's mesh.
how to make a clear mesh like Lisa and Taylor swift?

Generation time

Hi, I couldn't see the generation time for your method. Could you please give some estimates / bounds?

Having issues installing cubvh on windows machine

Currently trying to install magic123, I build a .bat installer to get everything under control, as install.sh in my mamba environment doesn't work (it is a "windows" thing).
So currently getting the error:
...\mambaforge\envs\magic123\lib\site-packages\torch\include\pybind11/eigen.h(35): fatal error C1083: File cannot be opened: "Eigen/Core": No such file or directory
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "...\mambaforge\envs\magic123\lib\site-packages\torch\utils\cpp_extension.py", line 1893, in _run_ninja_build
subprocess.run(
File "...\mambaforge\envs\magic123\lib\subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,

Going down the rabbid hole I am currently in the pybind11/eigen.h and there it tries to load Eigen but no folder is in the pybind11
From eigen.h (extracted)

/*
    pybind11/eigen.h: Transparent conversion for dense and sparse Eigen matrices

    Copyright (c) 2016 Wenzel Jakob <[email protected]>

    All rights reserved. Use of this source code is governed by a
    BSD-style license that can be found in the LICENSE file.
*/

#pragma once

/* HINT: To suppress warnings originating from the Eigen headers, use -isystem.
   See also:
       https://stackoverflow.com/questions/2579576/i-dir-vs-isystem-dir
       https://stackoverflow.com/questions/1741816/isystem-for-ms-visual-studio-c-compiler
*/

#include "numpy.h"

// The C4127 suppression was introduced for Eigen 3.4.0. In theory we could
// make it version specific, or even remove it later, but considering that
// 1. C4127 is generally far more distracting than useful for modern template code, and
// 2. we definitely want to ignore any MSVC warnings originating from Eigen code,
//    it is probably best to keep this around indefinitely.
#if defined(_MSC_VER)
#    pragma warning(push)
#    pragma warning(disable : 4127) // C4127: conditional expression is constant
#    pragma warning(disable : 5054) // https://github.com/pybind/pybind11/pull/3741
//       C5054: operator '&': deprecated between enumerations of different types
#elif defined(__MINGW32__)
#    pragma GCC diagnostic push
#    pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif

#include <Eigen/Core>
#include <Eigen/SparseCore>

...

Maybe someone has the same issue and could help?

I have pytorch 2.0.1 installed for python 3.10 and CUDA 11.8 with cuDNN 8.0

Things done so far:

  1. pip install eigen (0.0.1 from 2022) didn't help (uninstalled)
  2. mamba install eigenpy (3.1.0 from July 2023) (gives latest Eigen 3.4.0 (2021)) but didn't help

Environment Setting problem

Hi, thanks for your great work.
By the way, I'm getting the environment setting problem.
When I tried to install cubvh, I got some errors.
How can I fix it?

# cubvh
git+https://github.com/ashawkey/cubvh
Collecting git+https://github.com/ashawkey/cubvh
  Cloning https://github.com/ashawkey/cubvh to /tmp/pip-req-build-bvbrm4_f
  Running command git clone --filter=blob:none --quiet https://github.com/ashawkey/cubvh /tmp/pip-req-build-bvbrm4_f
  Resolved https://github.com/ashawkey/cubvh to commit d44ba080983c8d84eaf7578ed2b96944746b798a
  Preparing metadata (setup.py) ... done
Requirement already satisfied: ninja in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from cubvh==0.1.0) (1.11.1.1)
Collecting pybind11 (from cubvh==0.1.0)
  Using cached pybind11-2.11.1-py3-none-any.whl.metadata (9.5 kB)
Requirement already satisfied: trimesh in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from cubvh==0.1.0) (4.0.10)
Requirement already satisfied: opencv-python in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from cubvh==0.1.0) (4.9.0.80)
Requirement already satisfied: torch in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from cubvh==0.1.0) (1.12.1)
Requirement already satisfied: numpy in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from cubvh==0.1.0) (1.26.3)
Requirement already satisfied: tqdm in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from cubvh==0.1.0) (4.66.1)
Requirement already satisfied: matplotlib in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from cubvh==0.1.0) (3.8.2)
Requirement already satisfied: contourpy>=1.0.1 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from matplotlib->cubvh==0.1.0) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from matplotlib->cubvh==0.1.0) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from matplotlib->cubvh==0.1.0) (4.47.2)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from matplotlib->cubvh==0.1.0) (1.4.5)
Requirement already satisfied: packaging>=20.0 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from matplotlib->cubvh==0.1.0) (23.2)
Requirement already satisfied: pillow>=8 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from matplotlib->cubvh==0.1.0) (10.0.1)
Requirement already satisfied: pyparsing>=2.3.1 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from matplotlib->cubvh==0.1.0) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from matplotlib->cubvh==0.1.0) (2.8.2)
Requirement already satisfied: typing_extensions in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from torch->cubvh==0.1.0) (4.9.0)
Requirement already satisfied: six>=1.5 in /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->cubvh==0.1.0) (1.16.0)
Using cached pybind11-2.11.1-py3-none-any.whl (227 kB)
Building wheels for collected packages: cubvh
  Building wheel for cubvh (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [114 lines of output]
      /tmp/pip-req-build-bvbrm4_f/setup.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
        from pkg_resources import parse_version
      sh: 1: nvcc: not found
      Targeting C++ standard 14
      Couldn't find Eigen locally, downloading...
      Found eigen at ./eigen-3.3.7
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/cubvh
      copying cubvh/api.py -> build/lib.linux-x86_64-cpython-310/cubvh
      copying cubvh/__init__.py -> build/lib.linux-x86_64-cpython-310/cubvh
      running build_ext
      building '_cubvh' extension
      creating /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310
      creating /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp
      creating /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f
      creating /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src
      Emitting ninja build file /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/build.ninja...
      Compiling objects...
      Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
      [1/3] /usr/local/cuda/bin/nvcc  -I/tmp/pip-req-build-bvbrm4_f/include -I./eigen-3.3.7 -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/TH -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/cvlab15/anaconda3/envs/magic123/include/python3.10 -c -c /tmp/pip-req-build-bvbrm4_f/src/api.cu -o /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/api.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -std=c++14 --extended-lambda --expt-relaxed-constexpr -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -Xcompiler=-Wno-float-conversion -Xcompiler=-fno-strict-aliasing -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_cubvh -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86
      FAILED: /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/api.o
      /usr/local/cuda/bin/nvcc  -I/tmp/pip-req-build-bvbrm4_f/include -I./eigen-3.3.7 -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/TH -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/cvlab15/anaconda3/envs/magic123/include/python3.10 -c -c /tmp/pip-req-build-bvbrm4_f/src/api.cu -o /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/api.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -std=c++14 --extended-lambda --expt-relaxed-constexpr -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -Xcompiler=-Wno-float-conversion -Xcompiler=-fno-strict-aliasing -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_cubvh -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86
      /tmp/pip-req-build-bvbrm4_f/src/api.cu:1:9: warning: #pragma once in main file
          1 | #pragma once
            |         ^~~~
      In file included from /tmp/pip-req-build-bvbrm4_f/src/api.cu:3:
      /tmp/pip-req-build-bvbrm4_f/include/cubvh/api.h:3:10: fatal error: Eigen/Dense: No such file or directory
          3 | #include <Eigen/Dense>
            |          ^~~~~~~~~~~~~
      compilation terminated.
      [2/3] /usr/local/cuda/bin/nvcc  -I/tmp/pip-req-build-bvbrm4_f/include -I./eigen-3.3.7 -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/TH -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/cvlab15/anaconda3/envs/magic123/include/python3.10 -c -c /tmp/pip-req-build-bvbrm4_f/src/bvh.cu -o /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/bvh.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -std=c++14 --extended-lambda --expt-relaxed-constexpr -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -Xcompiler=-Wno-float-conversion -Xcompiler=-fno-strict-aliasing -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_cubvh -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86
      FAILED: /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/bvh.o
      /usr/local/cuda/bin/nvcc  -I/tmp/pip-req-build-bvbrm4_f/include -I./eigen-3.3.7 -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/TH -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/cvlab15/anaconda3/envs/magic123/include/python3.10 -c -c /tmp/pip-req-build-bvbrm4_f/src/bvh.cu -o /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/bvh.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -std=c++14 --extended-lambda --expt-relaxed-constexpr -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -Xcompiler=-Wno-float-conversion -Xcompiler=-fno-strict-aliasing -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_cubvh -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86
      In file included from /tmp/pip-req-build-bvbrm4_f/src/bvh.cu:2:
      /tmp/pip-req-build-bvbrm4_f/include/cubvh/common.h:14:10: fatal error: Eigen/Dense: No such file or directory
         14 | #include <Eigen/Dense>
            |          ^~~~~~~~~~~~~
      compilation terminated.
      [3/3] c++ -MMD -MF /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/bindings.o.d -pthread -B /home/cvlab15/anaconda3/envs/magic123/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/cvlab15/anaconda3/envs/magic123/include -fPIC -O2 -isystem /home/cvlab15/anaconda3/envs/magic123/include -fPIC -I/tmp/pip-req-build-bvbrm4_f/include -I./eigen-3.3.7 -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/TH -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/cvlab15/anaconda3/envs/magic123/include/python3.10 -c -c /tmp/pip-req-build-bvbrm4_f/src/bindings.cpp -o /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/bindings.o -std=c++14 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_cubvh -D_GLIBCXX_USE_CXX11_ABI=0
      FAILED: /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/bindings.o
      c++ -MMD -MF /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/bindings.o.d -pthread -B /home/cvlab15/anaconda3/envs/magic123/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/cvlab15/anaconda3/envs/magic123/include -fPIC -O2 -isystem /home/cvlab15/anaconda3/envs/magic123/include -fPIC -I/tmp/pip-req-build-bvbrm4_f/include -I./eigen-3.3.7 -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/TH -I/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/cvlab15/anaconda3/envs/magic123/include/python3.10 -c -c /tmp/pip-req-build-bvbrm4_f/src/bindings.cpp -o /tmp/pip-req-build-bvbrm4_f/build/temp.linux-x86_64-cpython-310/tmp/pip-req-build-bvbrm4_f/src/bindings.o -std=c++14 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_cubvh -D_GLIBCXX_USE_CXX11_ABI=0
      In file included from /tmp/pip-req-build-bvbrm4_f/src/bindings.cpp:5:
      /home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/include/pybind11/eigen.h:36:10: fatal error: Eigen/Core: No such file or directory
         36 | #include <Eigen/Core>
            |          ^~~~~~~~~~~~
      compilation terminated.
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1808, in _run_ninja_build
          subprocess.run(
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-bvbrm4_f/setup.py", line 154, in <module>
          setup(
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 765, in build_extensions
          build_ext.build_extensions(self)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 249, in build_extension
          _build_ext.build_extension(self, ext)
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
          objects = self.compiler.compile(
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 586, in unix_wrap_ninja_compile
          _write_ninja_file_and_compile_objects(
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1487, in _write_ninja_file_and_compile_objects
          _run_ninja_build(
        File "/home/cvlab15/anaconda3/envs/magic123/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1824, 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 cubvh
  Running setup.py clean for cubvh
Failed to build cubvh
ERROR: Could not build wheels for cubvh, which is required to install pyproject.toml-based projects

ask for help

thanks for your great work!
When I run gradio_app.py, I received the following error report
image

May I ask how to solve this problem,thanks again

Why include CLS token in the text embedding

Thanks for your great work!

I notice that you include both hidden state and CLS token in stable diffusion text embeddings here. However, in stable diffusion 1.5, the text embedding does not include the CLS token.

I also checked stable dreamfusion. It also not use CLS token here.

May I know why you include CLS token here?

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.