Spaces:
Running
on
Zero
Running
on
Zero
Delete folder .ipynb_checkpoints/ with huggingface_hub
Browse files
.ipynb_checkpoints/README-checkpoint.md
DELETED
@@ -1,231 +0,0 @@
|
|
1 |
-
<!-- ## **Hunyuan3D-1.0** -->
|
2 |
-
|
3 |
-
<p align="center">
|
4 |
-
<img src="./assets/logo.png" height=200>
|
5 |
-
</p>
|
6 |
-
|
7 |
-
# Tencent Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D Generation
|
8 |
-
|
9 |
-
<div align="center">
|
10 |
-
<a href="https://github.com/tencent/Hunyuan3D-1"><img src="https://img.shields.io/static/v1?label=Code&message=Github&color=blue&logo=github-pages"></a>  
|
11 |
-
<a href="https://3d.hunyuan.tencent.com"><img src="https://img.shields.io/static/v1?label=Homepage&message=Tencent Hunyuan3D&color=blue&logo=github-pages"></a>  
|
12 |
-
<a href="https://arxiv.org/pdf/2411.02293"><img src="https://img.shields.io/static/v1?label=Tech Report&message=Arxiv&color=red&logo=arxiv"></a>  
|
13 |
-
<a href="https://huggingface.co/Tencent/Hunyuan3D-1"><img src="https://img.shields.io/static/v1?label=Checkpoints&message=HuggingFace&color=yellow"></a>  
|
14 |
-
<a href="https://huggingface.co/spaces/Tencent/Hunyuan3D-1"><img src="https://img.shields.io/static/v1?label=Demo&message=HuggingFace&color=yellow"></a>  
|
15 |
-
</div>
|
16 |
-
|
17 |
-
|
18 |
-
## π₯π₯π₯ News!!
|
19 |
-
|
20 |
-
* Nov 5, 2024: π¬ We support demo running image_to_3d generation now. Please check the [script](#using-gradio) below.
|
21 |
-
* Nov 5, 2024: π¬ We support demo running text_to_3d generation now. Please check the [script](#using-gradio) below.
|
22 |
-
|
23 |
-
|
24 |
-
## π Open-source Plan
|
25 |
-
|
26 |
-
- [x] Inference
|
27 |
-
- [x] Checkpoints
|
28 |
-
- [ ] Baking related
|
29 |
-
- [ ] Training
|
30 |
-
- [ ] ComfyUI
|
31 |
-
- [ ] Distillation Version
|
32 |
-
- [ ] TensorRT Version
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
## **Abstract**
|
37 |
-
<p align="center">
|
38 |
-
<img src="./assets/teaser.png" height=450>
|
39 |
-
</p>
|
40 |
-
|
41 |
-
While 3D generative models have greatly improved artists' workflows, the existing diffusion models for 3D generation suffer from slow generation and poor generalization. To address this issue, we propose a two-stage approach named Hunyuan3D-1.0 including a lite version and a standard version, that both support text- and image-conditioned generation.
|
42 |
-
|
43 |
-
In the first stage, we employ a multi-view diffusion model that efficiently generates multi-view RGB in approximately 4 seconds. These multi-view images capture rich details of the 3D asset from different viewpoints, relaxing the tasks from single-view to multi-view reconstruction. In the second stage, we introduce a feed-forward reconstruction model that rapidly and faithfully reconstructs the 3D asset given the generated multi-view images in approximately 7 seconds. The reconstruction network learns to handle noises and in-consistency introduced by the multi-view diffusion and leverages the available information from the condition image to efficiently recover the 3D structure.
|
44 |
-
|
45 |
-
Our framework involves the text-to-image model, i.e., Hunyuan-DiT, making it a unified framework to support both text- and image-conditioned 3D generation. Our standard version has 3x more parameters than our lite and other existing model. Our Hunyuan3D-1.0 achieves an impressive balance between speed and quality, significantly reducing generation time while maintaining the quality and diversity of the produced assets.
|
46 |
-
|
47 |
-
|
48 |
-
## π **Hunyuan3D-1 Architecture**
|
49 |
-
|
50 |
-
<p align="center">
|
51 |
-
<img src="./assets/overview_3.png" height=400>
|
52 |
-
</p>
|
53 |
-
|
54 |
-
|
55 |
-
## π Comparisons
|
56 |
-
|
57 |
-
We have evaluated Hunyuan3D-1.0 with other open-source 3d-generation methods, our Hunyuan3D-1.0 received the highest user preference across 5 metrics. Details in the picture on the lower left.
|
58 |
-
|
59 |
-
The lite model takes around 10 seconds to produce a 3D mesh from a single image on an NVIDIA A100 GPU, while the standard model takes roughly 25 seconds. The plot laid out in the lower right demonstrates that Hunyuan3D-1.0 achieves an optimal balance between quality and efficiency.
|
60 |
-
|
61 |
-
<p align="center">
|
62 |
-
<img src="./assets/radar.png" height=300>
|
63 |
-
<img src="./assets/runtime.png" height=300>
|
64 |
-
</p>
|
65 |
-
|
66 |
-
## Get Started
|
67 |
-
|
68 |
-
#### Begin by cloning the repository:
|
69 |
-
|
70 |
-
```shell
|
71 |
-
git clone https://github.com/tencent/Hunyuan3D-1
|
72 |
-
cd Hunyuan3D-1
|
73 |
-
```
|
74 |
-
|
75 |
-
#### Installation Guide for Linux
|
76 |
-
|
77 |
-
We provide an env_install.sh script file for setting up environment.
|
78 |
-
|
79 |
-
```
|
80 |
-
# step 1, create conda env
|
81 |
-
conda create -n hunyuan3d-1 python=3.9 or 3.10 or 3.11 or 3.12
|
82 |
-
conda activate hunyuan3d-1
|
83 |
-
|
84 |
-
# step 2. install torch realated package
|
85 |
-
which pip # check pip corresponds to python
|
86 |
-
|
87 |
-
# modify the cuda version according to your machine (recommended)
|
88 |
-
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
|
89 |
-
|
90 |
-
# step 3. install other packages
|
91 |
-
bash env_install.sh
|
92 |
-
```
|
93 |
-
<details>
|
94 |
-
<summary>π‘Other tips for envrionment installation</summary>
|
95 |
-
|
96 |
-
Optionally, you can install xformers or flash_attn to acclerate computation:
|
97 |
-
|
98 |
-
```
|
99 |
-
pip install xformers --index-url https://download.pytorch.org/whl/cu121
|
100 |
-
```
|
101 |
-
```
|
102 |
-
pip install flash_attn
|
103 |
-
```
|
104 |
-
|
105 |
-
Most environment errors are caused by a mismatch between machine and packages. You can try manually specifying the version, as shown in the following successful cases:
|
106 |
-
```
|
107 |
-
# python3.9
|
108 |
-
pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118
|
109 |
-
```
|
110 |
-
|
111 |
-
when install pytorch3d, the gcc version is preferably greater than 9, and the gpu driver should not be too old.
|
112 |
-
|
113 |
-
</details>
|
114 |
-
|
115 |
-
#### Download Pretrained Models
|
116 |
-
|
117 |
-
The models are available at [https://huggingface.co/tencent/Hunyuan3D-1](https://huggingface.co/tencent/Hunyuan3D-1):
|
118 |
-
|
119 |
-
+ `Hunyuan3D-1/lite`, lite model for multi-view generation.
|
120 |
-
+ `Hunyuan3D-1/std`, standard model for multi-view generation.
|
121 |
-
+ `Hunyuan3D-1/svrm`, sparse-view reconstruction model.
|
122 |
-
|
123 |
-
|
124 |
-
To download the model, first install the huggingface-cli. (Detailed instructions are available [here](https://huggingface.co/docs/huggingface_hub/guides/cli).)
|
125 |
-
|
126 |
-
```shell
|
127 |
-
python3 -m pip install "huggingface_hub[cli]"
|
128 |
-
```
|
129 |
-
|
130 |
-
Then download the model using the following commands:
|
131 |
-
|
132 |
-
```shell
|
133 |
-
mkdir weights
|
134 |
-
huggingface-cli download tencent/Hunyuan3D-1 --local-dir ./weights
|
135 |
-
|
136 |
-
mkdir weights/hunyuanDiT
|
137 |
-
huggingface-cli download Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers-Distilled --local-dir ./weights/hunyuanDiT
|
138 |
-
```
|
139 |
-
|
140 |
-
#### Inference
|
141 |
-
For text to 3d generation, we supports bilingual Chinese and English, you can use the following command to inference.
|
142 |
-
```python
|
143 |
-
python3 main.py \
|
144 |
-
--text_prompt "a lovely rabbit" \
|
145 |
-
--save_folder ./outputs/test/ \
|
146 |
-
--max_faces_num 90000 \
|
147 |
-
--do_texture_mapping \
|
148 |
-
--do_render
|
149 |
-
```
|
150 |
-
|
151 |
-
For image to 3d generation, you can use the following command to inference.
|
152 |
-
```python
|
153 |
-
python3 main.py \
|
154 |
-
--image_prompt "/path/to/your/image" \
|
155 |
-
--save_folder ./outputs/test/ \
|
156 |
-
--max_faces_num 90000 \
|
157 |
-
--do_texture_mapping \
|
158 |
-
--do_render
|
159 |
-
```
|
160 |
-
We list some more useful configurations for easy usage:
|
161 |
-
|
162 |
-
| Argument | Default | Description |
|
163 |
-
|:------------------:|:---------:|:---------------------------------------------------:|
|
164 |
-
|`--text_prompt` | None |The text prompt for 3D generation |
|
165 |
-
|`--image_prompt` | None |The image prompt for 3D generation |
|
166 |
-
|`--t2i_seed` | 0 |The random seed for generating images |
|
167 |
-
|`--t2i_steps` | 25 |The number of steps for sampling of text to image |
|
168 |
-
|`--gen_seed` | 0 |The random seed for generating 3d generation |
|
169 |
-
|`--gen_steps` | 50 |The number of steps for sampling of 3d generation |
|
170 |
-
|`--max_faces_numm` | 90000 |The limit number of faces of 3d mesh |
|
171 |
-
|`--save_memory` | False |module will move to cpu automatically|
|
172 |
-
|`--do_texture_mapping` | False |Change vertex shadding to texture shading |
|
173 |
-
|`--do_render` | False |render gif |
|
174 |
-
|
175 |
-
|
176 |
-
We have also prepared scripts with different configurations for reference
|
177 |
-
- Inference Std-pipeline requires 30GB VRAM (24G VRAM with --save_memory).
|
178 |
-
- Inference Lite-pipeline requires 22GB VRAM (18G VRAM with --save_memory).
|
179 |
-
- Note: --save_memory will increase inference time
|
180 |
-
|
181 |
-
```bash
|
182 |
-
bash scripts/text_to_3d_std.sh
|
183 |
-
bash scripts/text_to_3d_lite.sh
|
184 |
-
bash scripts/image_to_3d_std.sh
|
185 |
-
bash scripts/image_to_3d_lite.sh
|
186 |
-
```
|
187 |
-
|
188 |
-
If your gpu memory is 16G, you can try to run modules in pipeline seperately:
|
189 |
-
```bash
|
190 |
-
bash scripts/text_to_3d_std_separately.sh 'a lovely rabbit' ./outputs/test # >= 16G
|
191 |
-
bash scripts/text_to_3d_lite_separately.sh 'a lovely rabbit' ./outputs/test # >= 14G
|
192 |
-
bash scripts/image_to_3d_std_separately.sh ./demos/example_000.png ./outputs/test # >= 16G
|
193 |
-
bash scripts/image_to_3d_lite_separately.sh ./demos/example_000.png ./outputs/test # >= 10G
|
194 |
-
```
|
195 |
-
|
196 |
-
#### Using Gradio
|
197 |
-
|
198 |
-
We have prepared two versions of multi-view generation, std and lite.
|
199 |
-
|
200 |
-
```shell
|
201 |
-
# std
|
202 |
-
python3 app.py
|
203 |
-
python3 app.py --save_memory
|
204 |
-
|
205 |
-
# lite
|
206 |
-
python3 app.py --use_lite
|
207 |
-
python3 app.py --use_lite --save_memory
|
208 |
-
```
|
209 |
-
|
210 |
-
Then the demo can be accessed through http://0.0.0.0:8080. It should be noted that the 0.0.0.0 here needs to be X.X.X.X with your server IP.
|
211 |
-
|
212 |
-
## Camera Parameters
|
213 |
-
|
214 |
-
Output views are a fixed set of camera poses:
|
215 |
-
|
216 |
-
+ Azimuth (relative to input view): `+0, +60, +120, +180, +240, +300`.
|
217 |
-
|
218 |
-
|
219 |
-
## Citation
|
220 |
-
|
221 |
-
If you found this repository helpful, please cite our report:
|
222 |
-
```bibtex
|
223 |
-
@misc{yang2024tencent,
|
224 |
-
title={Tencent Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D Generation},
|
225 |
-
author={Xianghui Yang and Huiwen Shi and Bowen Zhang and Fan Yang and Jiacheng Wang and Hongxu Zhao and Xinhai Liu and Xinzhou Wang and Qingxiang Lin and Jiaao Yu and Lifu Wang and Zhuo Chen and Sicong Liu and Yuhong Liu and Yong Yang and Di Wang and Jie Jiang and Chunchao Guo},
|
226 |
-
year={2024},
|
227 |
-
eprint={2411.02293},
|
228 |
-
archivePrefix={arXiv},
|
229 |
-
primaryClass={cs.CV}
|
230 |
-
}
|
231 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ipynb_checkpoints/app-checkpoint.py
DELETED
@@ -1,343 +0,0 @@
|
|
1 |
-
# Open Source Model Licensed under the Apache License Version 2.0
|
2 |
-
# and Other Licenses of the Third-Party Components therein:
|
3 |
-
# The below Model in this distribution may have been modified by THL A29 Limited
|
4 |
-
# ("Tencent Modifications"). All Tencent Modifications are Copyright (C) 2024 THL A29 Limited.
|
5 |
-
|
6 |
-
# Copyright (C) 2024 THL A29 Limited, a Tencent company. All rights reserved.
|
7 |
-
# The below software and/or models in this distribution may have been
|
8 |
-
# modified by THL A29 Limited ("Tencent Modifications").
|
9 |
-
# All Tencent Modifications are Copyright (C) THL A29 Limited.
|
10 |
-
|
11 |
-
# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT
|
12 |
-
# except for the third-party components listed below.
|
13 |
-
# Hunyuan 3D does not impose any additional limitations beyond what is outlined
|
14 |
-
# in the repsective licenses of these third-party components.
|
15 |
-
# Users must comply with all terms and conditions of original licenses of these third-party
|
16 |
-
# components and must ensure that the usage of the third party components adheres to
|
17 |
-
# all relevant laws and regulations.
|
18 |
-
|
19 |
-
# For avoidance of doubts, Hunyuan 3D means the large language models and
|
20 |
-
# their software and algorithms, including trained model weights, parameters (including
|
21 |
-
# optimizer states), machine-learning model code, inference-enabling code, training-enabling code,
|
22 |
-
# fine-tuning enabling code and other elements of the foregoing made publicly available
|
23 |
-
# by Tencent in accordance with TENCENT HUNYUAN COMMUNITY LICENSE AGREEMENT.
|
24 |
-
|
25 |
-
import os
|
26 |
-
import warnings
|
27 |
-
import argparse
|
28 |
-
import gradio as gr
|
29 |
-
from glob import glob
|
30 |
-
import shutil
|
31 |
-
import torch
|
32 |
-
import numpy as np
|
33 |
-
from PIL import Image
|
34 |
-
from einops import rearrange
|
35 |
-
|
36 |
-
from infer import seed_everything, save_gif
|
37 |
-
from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer
|
38 |
-
|
39 |
-
warnings.simplefilter('ignore', category=UserWarning)
|
40 |
-
warnings.simplefilter('ignore', category=FutureWarning)
|
41 |
-
warnings.simplefilter('ignore', category=DeprecationWarning)
|
42 |
-
|
43 |
-
parser = argparse.ArgumentParser()
|
44 |
-
parser.add_argument("--use_lite", default=False, action="store_true")
|
45 |
-
parser.add_argument("--mv23d_cfg_path", default="./svrm/configs/svrm.yaml", type=str)
|
46 |
-
parser.add_argument("--mv23d_ckt_path", default="weights/svrm/svrm.safetensors", type=str)
|
47 |
-
parser.add_argument("--text2image_path", default="weights/hunyuanDiT", type=str)
|
48 |
-
parser.add_argument("--save_memory", default=False, action="store_true")
|
49 |
-
parser.add_argument("--device", default="cuda:0", type=str)
|
50 |
-
args = parser.parse_args()
|
51 |
-
|
52 |
-
################################################################
|
53 |
-
# initial setting
|
54 |
-
################################################################
|
55 |
-
|
56 |
-
CONST_PORT = 8080
|
57 |
-
CONST_MAX_QUEUE = 1
|
58 |
-
CONST_SERVER = '0.0.0.0'
|
59 |
-
|
60 |
-
CONST_HEADER = '''
|
61 |
-
<h2><b>Official π€ Gradio Demo</b></h2><h2><a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'><b>Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D
|
62 |
-
Generationr</b></a></h2>
|
63 |
-
Code: <a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'>GitHub</a>. Techenical report: <a href='https://arxiv.org/abs/placeholder' target='_blank'>ArXiv</a>.
|
64 |
-
|
65 |
-
βοΈβοΈβοΈ**Important Notes:**
|
66 |
-
- By default, our demo can export a .obj mesh with vertex colors or a .glb mesh.
|
67 |
-
- If you select "texture mapping," it will export a .obj mesh with a texture map or a .glb mesh.
|
68 |
-
- If you select "render GIF," it will export a GIF image rendering of the .glb file.
|
69 |
-
- If the result is unsatisfactory, please try a different seed value (Default: 0).
|
70 |
-
'''
|
71 |
-
|
72 |
-
CONST_CITATION = r"""
|
73 |
-
If HunYuan3D-1 is helpful, please help to β the <a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'>Github Repo</a>. Thanks! [![GitHub Stars](https://img.shields.io/github/stars/tencent/Hunyuan3D-1?style=social)](https://github.com/tencent/Hunyuan3D-1)
|
74 |
-
---
|
75 |
-
π **Citation**
|
76 |
-
If you find our work useful for your research or applications, please cite using this bibtex:
|
77 |
-
```bibtex
|
78 |
-
@misc{yang2024tencent,
|
79 |
-
title={Tencent Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D Generation},
|
80 |
-
author={Xianghui Yang and Huiwen Shi and Bowen Zhang and Fan Yang and Jiacheng Wang and Hongxu Zhao and Xinhai Liu and Xinzhou Wang and Qingxiang Lin and Jiaao Yu and Lifu Wang and Zhuo Chen and Sicong Liu and Yuhong Liu and Yong Yang and Di Wang and Jie Jiang and Chunchao Guo},
|
81 |
-
year={2024},
|
82 |
-
eprint={2411.02293},
|
83 |
-
archivePrefix={arXiv},
|
84 |
-
primaryClass={cs.CV}
|
85 |
-
}
|
86 |
-
```
|
87 |
-
"""
|
88 |
-
|
89 |
-
################################################################
|
90 |
-
# prepare text examples and image examples
|
91 |
-
################################################################
|
92 |
-
|
93 |
-
def get_example_img_list():
|
94 |
-
print('Loading example img list ...')
|
95 |
-
return sorted(glob('./demos/example_*.png'))
|
96 |
-
|
97 |
-
def get_example_txt_list():
|
98 |
-
print('Loading example txt list ...')
|
99 |
-
txt_list = list()
|
100 |
-
for line in open('./demos/example_list.txt'):
|
101 |
-
txt_list.append(line.strip())
|
102 |
-
return txt_list
|
103 |
-
|
104 |
-
example_is = get_example_img_list()
|
105 |
-
example_ts = get_example_txt_list()
|
106 |
-
|
107 |
-
################################################################
|
108 |
-
# initial models
|
109 |
-
################################################################
|
110 |
-
|
111 |
-
worker_xbg = Removebg()
|
112 |
-
print(f"loading {args.text2image_path}")
|
113 |
-
worker_t2i = Text2Image(
|
114 |
-
pretrain = args.text2image_path,
|
115 |
-
device = args.device,
|
116 |
-
save_memory = args.save_memory
|
117 |
-
)
|
118 |
-
worker_i2v = Image2Views(
|
119 |
-
use_lite = args.use_lite,
|
120 |
-
device = args.device,
|
121 |
-
save_memory = args.save_memory
|
122 |
-
)
|
123 |
-
worker_v23 = Views2Mesh(
|
124 |
-
args.mv23d_cfg_path,
|
125 |
-
args.mv23d_ckt_path,
|
126 |
-
use_lite = args.use_lite,
|
127 |
-
device = args.device,
|
128 |
-
save_memory = args.save_memory
|
129 |
-
)
|
130 |
-
worker_gif = GifRenderer(args.device)
|
131 |
-
|
132 |
-
def stage_0_t2i(text, image, seed, step):
|
133 |
-
os.makedirs('./outputs/app_output', exist_ok=True)
|
134 |
-
exists = set(int(_) for _ in os.listdir('./outputs/app_output') if not _.startswith("."))
|
135 |
-
if len(exists) == 30: shutil.rmtree(f"./outputs/app_output/0");cur_id = 0
|
136 |
-
else: cur_id = min(set(range(30)) - exists)
|
137 |
-
if os.path.exists(f"./outputs/app_output/{(cur_id + 1) % 30}"):
|
138 |
-
shutil.rmtree(f"./outputs/app_output/{(cur_id + 1) % 30}")
|
139 |
-
save_folder = f'./outputs/app_output/{cur_id}'
|
140 |
-
os.makedirs(save_folder, exist_ok=True)
|
141 |
-
|
142 |
-
dst = save_folder + '/img.png'
|
143 |
-
|
144 |
-
if not text:
|
145 |
-
if image is None:
|
146 |
-
return dst, save_folder
|
147 |
-
raise gr.Error("Upload image or provide text ...")
|
148 |
-
image.save(dst)
|
149 |
-
return dst, save_folder
|
150 |
-
|
151 |
-
image = worker_t2i(text, seed, step)
|
152 |
-
image.save(dst)
|
153 |
-
dst = worker_xbg(image, save_folder)
|
154 |
-
return dst, save_folder
|
155 |
-
|
156 |
-
def stage_1_xbg(image, save_folder):
|
157 |
-
if isinstance(image, str):
|
158 |
-
image = Image.open(image)
|
159 |
-
dst = save_folder + '/img_nobg.png'
|
160 |
-
rgba = worker_xbg(image)
|
161 |
-
rgba.save(dst)
|
162 |
-
return dst
|
163 |
-
|
164 |
-
def stage_2_i2v(image, seed, step, save_folder):
|
165 |
-
if isinstance(image, str):
|
166 |
-
image = Image.open(image)
|
167 |
-
gif_dst = save_folder + '/views.gif'
|
168 |
-
res_img, pils = worker_i2v(image, seed, step)
|
169 |
-
save_gif(pils, gif_dst)
|
170 |
-
views_img, cond_img = res_img[0], res_img[1]
|
171 |
-
img_array = np.asarray(views_img, dtype=np.uint8)
|
172 |
-
show_img = rearrange(img_array, '(n h) (m w) c -> (n m) h w c', n=3, m=2)
|
173 |
-
show_img = show_img[worker_i2v.order, ...]
|
174 |
-
show_img = rearrange(show_img, '(n m) h w c -> (n h) (m w) c', n=2, m=3)
|
175 |
-
show_img = Image.fromarray(show_img)
|
176 |
-
return views_img, cond_img, show_img
|
177 |
-
|
178 |
-
def stage_3_v23(
|
179 |
-
views_pil,
|
180 |
-
cond_pil,
|
181 |
-
seed,
|
182 |
-
save_folder,
|
183 |
-
target_face_count = 30000,
|
184 |
-
do_texture_mapping = True,
|
185 |
-
do_render =True
|
186 |
-
):
|
187 |
-
do_texture_mapping = do_texture_mapping or do_render
|
188 |
-
obj_dst = save_folder + '/mesh_with_colors.obj'
|
189 |
-
glb_dst = save_folder + '/mesh.glb'
|
190 |
-
worker_v23(
|
191 |
-
views_pil,
|
192 |
-
cond_pil,
|
193 |
-
seed = seed,
|
194 |
-
save_folder = save_folder,
|
195 |
-
target_face_count = target_face_count,
|
196 |
-
do_texture_mapping = do_texture_mapping
|
197 |
-
)
|
198 |
-
return obj_dst, glb_dst
|
199 |
-
|
200 |
-
def stage_4_gif(obj_dst, save_folder, do_render_gif=True):
|
201 |
-
if not do_render_gif: return None
|
202 |
-
gif_dst = save_folder + '/output.gif'
|
203 |
-
worker_gif(
|
204 |
-
save_folder + '/mesh.obj',
|
205 |
-
gif_dst_path = gif_dst
|
206 |
-
)
|
207 |
-
return gif_dst
|
208 |
-
# ===============================================================
|
209 |
-
# gradio display
|
210 |
-
# ===============================================================
|
211 |
-
with gr.Blocks() as demo:
|
212 |
-
gr.Markdown(CONST_HEADER)
|
213 |
-
with gr.Row(variant="panel"):
|
214 |
-
with gr.Column(scale=2):
|
215 |
-
with gr.Tab("Text to 3D"):
|
216 |
-
with gr.Column():
|
217 |
-
text = gr.TextArea('δΈεͺι»η½ηΈι΄ηηη«ε¨η½θ²θζ―δΈε±
δΈεηοΌεη°εΊε‘ιι£ζ Όεε―η±ζ°ε΄γ', lines=1, max_lines=10, label='Input text')
|
218 |
-
with gr.Row():
|
219 |
-
textgen_seed = gr.Number(value=0, label="T2I seed", precision=0)
|
220 |
-
textgen_step = gr.Number(value=25, label="T2I step", precision=0)
|
221 |
-
textgen_SEED = gr.Number(value=0, label="Gen seed", precision=0)
|
222 |
-
textgen_STEP = gr.Number(value=50, label="Gen step", precision=0)
|
223 |
-
textgen_max_faces = gr.Number(value=90000, label="max number of faces", precision=0)
|
224 |
-
|
225 |
-
with gr.Row():
|
226 |
-
textgen_do_texture_mapping = gr.Checkbox(label="texture mapping", value=False, interactive=True)
|
227 |
-
textgen_do_render_gif = gr.Checkbox(label="Render gif", value=False, interactive=True)
|
228 |
-
textgen_submit = gr.Button("Generate", variant="primary")
|
229 |
-
|
230 |
-
with gr.Row():
|
231 |
-
gr.Examples(examples=example_ts, inputs=[text], label="Txt examples", examples_per_page=10)
|
232 |
-
|
233 |
-
with gr.Tab("Image to 3D"):
|
234 |
-
with gr.Column():
|
235 |
-
input_image = gr.Image(label="Input image",
|
236 |
-
width=256, height=256, type="pil",
|
237 |
-
image_mode="RGBA", sources="upload",
|
238 |
-
interactive=True)
|
239 |
-
with gr.Row():
|
240 |
-
imggen_SEED = gr.Number(value=0, label="Gen seed", precision=0)
|
241 |
-
imggen_STEP = gr.Number(value=50, label="Gen step", precision=0)
|
242 |
-
imggen_max_faces = gr.Number(value=90000, label="max number of faces", precision=0)
|
243 |
-
|
244 |
-
with gr.Row():
|
245 |
-
imggen_do_texture_mapping = gr.Checkbox(label="texture mapping", value=False, interactive=True)
|
246 |
-
imggen_do_render_gif = gr.Checkbox(label="Render gif", value=False, interactive=True)
|
247 |
-
imggen_submit = gr.Button("Generate", variant="primary")
|
248 |
-
with gr.Row():
|
249 |
-
gr.Examples(
|
250 |
-
examples=example_is,
|
251 |
-
inputs=[input_image],
|
252 |
-
label="Img examples",
|
253 |
-
examples_per_page=10
|
254 |
-
)
|
255 |
-
|
256 |
-
with gr.Column(scale=3):
|
257 |
-
with gr.Row():
|
258 |
-
with gr.Column(scale=2):
|
259 |
-
rem_bg_image = gr.Image(label="No backgraound image", type="pil",
|
260 |
-
image_mode="RGBA", interactive=False)
|
261 |
-
with gr.Column(scale=3):
|
262 |
-
result_image = gr.Image(label="Multi views", type="pil", interactive=False)
|
263 |
-
|
264 |
-
with gr.Row():
|
265 |
-
result_3dobj = gr.Model3D(
|
266 |
-
clear_color=[0.0, 0.0, 0.0, 0.0],
|
267 |
-
label="Output Obj",
|
268 |
-
show_label=True,
|
269 |
-
visible=True,
|
270 |
-
camera_position=[90, 90, None],
|
271 |
-
interactive=False
|
272 |
-
)
|
273 |
-
|
274 |
-
result_3dglb = gr.Model3D(
|
275 |
-
clear_color=[0.0, 0.0, 0.0, 0.0],
|
276 |
-
label="Output Glb",
|
277 |
-
show_label=True,
|
278 |
-
visible=True,
|
279 |
-
camera_position=[90, 90, None],
|
280 |
-
interactive=False
|
281 |
-
)
|
282 |
-
result_gif = gr.Image(label="Rendered GIF", interactive=False)
|
283 |
-
|
284 |
-
with gr.Row():
|
285 |
-
gr.Markdown("""
|
286 |
-
We recommend downloading and opening Glb with 3D software, such as Blender, MeshLab, etc.
|
287 |
-
|
288 |
-
Limited by gradio, Obj file here only be shown as vertex shading, but Glb can be texture shading.
|
289 |
-
""")
|
290 |
-
|
291 |
-
#===============================================================
|
292 |
-
# gradio running code
|
293 |
-
#===============================================================
|
294 |
-
|
295 |
-
none = gr.State(None)
|
296 |
-
save_folder = gr.State()
|
297 |
-
cond_image = gr.State()
|
298 |
-
views_image = gr.State()
|
299 |
-
text_image = gr.State()
|
300 |
-
|
301 |
-
textgen_submit.click(
|
302 |
-
fn=stage_0_t2i, inputs=[text, none, textgen_seed, textgen_step],
|
303 |
-
outputs=[rem_bg_image, save_folder],
|
304 |
-
).success(
|
305 |
-
fn=stage_2_i2v, inputs=[rem_bg_image, textgen_SEED, textgen_STEP, save_folder],
|
306 |
-
outputs=[views_image, cond_image, result_image],
|
307 |
-
).success(
|
308 |
-
fn=stage_3_v23, inputs=[views_image, cond_image, textgen_SEED, save_folder,
|
309 |
-
textgen_max_faces, textgen_do_texture_mapping,
|
310 |
-
textgen_do_render_gif],
|
311 |
-
outputs=[result_3dobj, result_3dglb],
|
312 |
-
).success(
|
313 |
-
fn=stage_4_gif, inputs=[result_3dglb, save_folder, textgen_do_render_gif],
|
314 |
-
outputs=[result_gif],
|
315 |
-
).success(lambda: print('Text_to_3D Done ...'))
|
316 |
-
|
317 |
-
imggen_submit.click(
|
318 |
-
fn=stage_0_t2i, inputs=[none, input_image, textgen_seed, textgen_step],
|
319 |
-
outputs=[text_image, save_folder],
|
320 |
-
).success(
|
321 |
-
fn=stage_1_xbg, inputs=[text_image, save_folder],
|
322 |
-
outputs=[rem_bg_image],
|
323 |
-
).success(
|
324 |
-
fn=stage_2_i2v, inputs=[rem_bg_image, imggen_SEED, imggen_STEP, save_folder],
|
325 |
-
outputs=[views_image, cond_image, result_image],
|
326 |
-
).success(
|
327 |
-
fn=stage_3_v23, inputs=[views_image, cond_image, imggen_SEED, save_folder,
|
328 |
-
imggen_max_faces, imggen_do_texture_mapping,
|
329 |
-
imggen_do_render_gif],
|
330 |
-
outputs=[result_3dobj, result_3dglb],
|
331 |
-
).success(
|
332 |
-
fn=stage_4_gif, inputs=[result_3dglb, save_folder, imggen_do_render_gif],
|
333 |
-
outputs=[result_gif],
|
334 |
-
).success(lambda: print('Image_to_3D Done ...'))
|
335 |
-
|
336 |
-
#===============================================================
|
337 |
-
# start gradio server
|
338 |
-
#===============================================================
|
339 |
-
|
340 |
-
gr.Markdown(CONST_CITATION)
|
341 |
-
demo.queue(max_size=CONST_MAX_QUEUE)
|
342 |
-
demo.launch(server_name=CONST_SERVER, server_port=CONST_PORT)
|
343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ipynb_checkpoints/app_hg-checkpoint.py
DELETED
@@ -1,384 +0,0 @@
|
|
1 |
-
# Open Source Model Licensed under the Apache License Version 2.0
|
2 |
-
# and Other Licenses of the Third-Party Components therein:
|
3 |
-
# The below Model in this distribution may have been modified by THL A29 Limited
|
4 |
-
# ("Tencent Modifications"). All Tencent Modifications are Copyright (C) 2024 THL A29 Limited.
|
5 |
-
|
6 |
-
# Copyright (C) 2024 THL A29 Limited, a Tencent company. All rights reserved.
|
7 |
-
# The below software and/or models in this distribution may have been
|
8 |
-
# modified by THL A29 Limited ("Tencent Modifications").
|
9 |
-
# All Tencent Modifications are Copyright (C) THL A29 Limited.
|
10 |
-
|
11 |
-
# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT
|
12 |
-
# except for the third-party components listed below.
|
13 |
-
# Hunyuan 3D does not impose any additional limitations beyond what is outlined
|
14 |
-
# in the repsective licenses of these third-party components.
|
15 |
-
# Users must comply with all terms and conditions of original licenses of these third-party
|
16 |
-
# components and must ensure that the usage of the third party components adheres to
|
17 |
-
# all relevant laws and regulations.
|
18 |
-
|
19 |
-
# For avoidance of doubts, Hunyuan 3D means the large language models and
|
20 |
-
# their software and algorithms, including trained model weights, parameters (including
|
21 |
-
# optimizer states), machine-learning model code, inference-enabling code, training-enabling code,
|
22 |
-
# fine-tuning enabling code and other elements of the foregoing made publicly available
|
23 |
-
# by Tencent in accordance with TENCENT HUNYUAN COMMUNITY LICENSE AGREEMENT.
|
24 |
-
import spaces
|
25 |
-
import os
|
26 |
-
os.environ['CUDA_HOME'] = '/usr/local/cuda-11*'
|
27 |
-
import warnings
|
28 |
-
import argparse
|
29 |
-
import gradio as gr
|
30 |
-
from glob import glob
|
31 |
-
import shutil
|
32 |
-
import torch
|
33 |
-
import numpy as np
|
34 |
-
from PIL import Image
|
35 |
-
from einops import rearrange
|
36 |
-
from huggingface_hub import snapshot_download
|
37 |
-
|
38 |
-
from infer import seed_everything, save_gif
|
39 |
-
from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer
|
40 |
-
|
41 |
-
warnings.simplefilter('ignore', category=UserWarning)
|
42 |
-
warnings.simplefilter('ignore', category=FutureWarning)
|
43 |
-
warnings.simplefilter('ignore', category=DeprecationWarning)
|
44 |
-
|
45 |
-
parser = argparse.ArgumentParser()
|
46 |
-
parser.add_argument("--use_lite", default=False, action="store_true")
|
47 |
-
parser.add_argument("--mv23d_cfg_path", default="./svrm/configs/svrm.yaml", type=str)
|
48 |
-
parser.add_argument("--mv23d_ckt_path", default="weights/svrm/svrm.safetensors", type=str)
|
49 |
-
parser.add_argument("--text2image_path", default="weights/hunyuanDiT", type=str)
|
50 |
-
parser.add_argument("--save_memory", default=True) # , action="store_true")
|
51 |
-
parser.add_argument("--device", default="cuda:0", type=str)
|
52 |
-
args = parser.parse_args()
|
53 |
-
|
54 |
-
def find_cuda():
|
55 |
-
# Check if CUDA_HOME or CUDA_PATH environment variables are set
|
56 |
-
cuda_home = os.environ.get('CUDA_HOME') or os.environ.get('CUDA_PATH')
|
57 |
-
|
58 |
-
if cuda_home and os.path.exists(cuda_home):
|
59 |
-
return cuda_home
|
60 |
-
|
61 |
-
# Search for the nvcc executable in the system's PATH
|
62 |
-
nvcc_path = shutil.which('nvcc')
|
63 |
-
|
64 |
-
if nvcc_path:
|
65 |
-
# Remove the 'bin/nvcc' part to get the CUDA installation path
|
66 |
-
cuda_path = os.path.dirname(os.path.dirname(nvcc_path))
|
67 |
-
return cuda_path
|
68 |
-
|
69 |
-
return None
|
70 |
-
|
71 |
-
cuda_path = find_cuda()
|
72 |
-
|
73 |
-
if cuda_path:
|
74 |
-
print(f"CUDA installation found at: {cuda_path}")
|
75 |
-
else:
|
76 |
-
print("CUDA installation not found")
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
def download_models():
|
81 |
-
# Create weights directory if it doesn't exist
|
82 |
-
os.makedirs("weights", exist_ok=True)
|
83 |
-
os.makedirs("weights/hunyuanDiT", exist_ok=True)
|
84 |
-
|
85 |
-
# Download Hunyuan3D-1 model
|
86 |
-
try:
|
87 |
-
snapshot_download(
|
88 |
-
repo_id="tencent/Hunyuan3D-1",
|
89 |
-
local_dir="./weights",
|
90 |
-
resume_download=True
|
91 |
-
)
|
92 |
-
print("Successfully downloaded Hunyuan3D-1 model")
|
93 |
-
except Exception as e:
|
94 |
-
print(f"Error downloading Hunyuan3D-1: {e}")
|
95 |
-
|
96 |
-
# Download HunyuanDiT model
|
97 |
-
try:
|
98 |
-
snapshot_download(
|
99 |
-
repo_id="Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers-Distilled",
|
100 |
-
local_dir="./weights/hunyuanDiT",
|
101 |
-
resume_download=True
|
102 |
-
)
|
103 |
-
print("Successfully downloaded HunyuanDiT model")
|
104 |
-
except Exception as e:
|
105 |
-
print(f"Error downloading HunyuanDiT: {e}")
|
106 |
-
|
107 |
-
# Download models before starting the app
|
108 |
-
download_models()
|
109 |
-
|
110 |
-
################################################################
|
111 |
-
|
112 |
-
CONST_PORT = 8080
|
113 |
-
CONST_MAX_QUEUE = 1
|
114 |
-
CONST_SERVER = '0.0.0.0'
|
115 |
-
|
116 |
-
CONST_HEADER = '''
|
117 |
-
<h2><b>Official π€ Gradio Demo</b></h2><h2><a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'><b>Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D
|
118 |
-
Generationr</b></a></h2>
|
119 |
-
Code: <a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'>GitHub</a>. Techenical report: <a href='https://arxiv.org/abs/placeholder' target='_blank'>ArXiv</a>.
|
120 |
-
|
121 |
-
βοΈβοΈβοΈ**Important Notes:**
|
122 |
-
- By default, our demo can export a .obj mesh with vertex colors or a .glb mesh.
|
123 |
-
- If you select "texture mapping," it will export a .obj mesh with a texture map or a .glb mesh.
|
124 |
-
- If you select "render GIF," it will export a GIF image rendering of the .glb file.
|
125 |
-
- If the result is unsatisfactory, please try a different seed value (Default: 0).
|
126 |
-
'''
|
127 |
-
|
128 |
-
CONST_CITATION = r"""
|
129 |
-
If HunYuan3D-1 is helpful, please help to β the <a href='https://github.com/tencent/Hunyuan3D-1' target='_blank'>Github Repo</a>. Thanks! [![GitHub Stars](https://img.shields.io/github/stars/tencent/Hunyuan3D-1?style=social)](https://github.com/tencent/Hunyuan3D-1)
|
130 |
-
---
|
131 |
-
π **Citation**
|
132 |
-
If you find our work useful for your research or applications, please cite using this bibtex:
|
133 |
-
```bibtex
|
134 |
-
@misc{yang2024tencent,
|
135 |
-
title={Tencent Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D Generation},
|
136 |
-
author={Xianghui Yang and Huiwen Shi and Bowen Zhang and Fan Yang and Jiacheng Wang and Hongxu Zhao and Xinhai Liu and Xinzhou Wang and Qingxiang Lin and Jiaao Yu and Lifu Wang and Zhuo Chen and Sicong Liu and Yuhong Liu and Yong Yang and Di Wang and Jie Jiang and Chunchao Guo},
|
137 |
-
year={2024},
|
138 |
-
eprint={2411.02293},
|
139 |
-
archivePrefix={arXiv},
|
140 |
-
primaryClass={cs.CV}
|
141 |
-
}
|
142 |
-
```
|
143 |
-
"""
|
144 |
-
|
145 |
-
################################################################
|
146 |
-
|
147 |
-
def get_example_img_list():
|
148 |
-
print('Loading example img list ...')
|
149 |
-
return sorted(glob('./demos/example_*.png'))
|
150 |
-
|
151 |
-
def get_example_txt_list():
|
152 |
-
print('Loading example txt list ...')
|
153 |
-
txt_list = list()
|
154 |
-
for line in open('./demos/example_list.txt'):
|
155 |
-
txt_list.append(line.strip())
|
156 |
-
return txt_list
|
157 |
-
|
158 |
-
example_is = get_example_img_list()
|
159 |
-
example_ts = get_example_txt_list()
|
160 |
-
################################################################
|
161 |
-
|
162 |
-
worker_xbg = Removebg()
|
163 |
-
print(f"loading {args.text2image_path}")
|
164 |
-
worker_t2i = Text2Image(
|
165 |
-
pretrain = args.text2image_path,
|
166 |
-
device = args.device,
|
167 |
-
save_memory = args.save_memory
|
168 |
-
)
|
169 |
-
worker_i2v = Image2Views(
|
170 |
-
use_lite = args.use_lite,
|
171 |
-
device = args.device,
|
172 |
-
save_memory = args.save_memory
|
173 |
-
)
|
174 |
-
worker_v23 = Views2Mesh(
|
175 |
-
args.mv23d_cfg_path,
|
176 |
-
args.mv23d_ckt_path,
|
177 |
-
use_lite = args.use_lite,
|
178 |
-
device = args.device,
|
179 |
-
save_memory = args.save_memory
|
180 |
-
)
|
181 |
-
worker_gif = GifRenderer(args.device)
|
182 |
-
|
183 |
-
@spaces.GPU
|
184 |
-
def stage_0_t2i(text, image, seed, step):
|
185 |
-
os.makedirs('./outputs/app_output', exist_ok=True)
|
186 |
-
exists = set(int(_) for _ in os.listdir('./outputs/app_output') if not _.startswith("."))
|
187 |
-
if len(exists) == 30: shutil.rmtree(f"./outputs/app_output/0");cur_id = 0
|
188 |
-
else: cur_id = min(set(range(30)) - exists)
|
189 |
-
if os.path.exists(f"./outputs/app_output/{(cur_id + 1) % 30}"):
|
190 |
-
shutil.rmtree(f"./outputs/app_output/{(cur_id + 1) % 30}")
|
191 |
-
save_folder = f'./outputs/app_output/{cur_id}'
|
192 |
-
os.makedirs(save_folder, exist_ok=True)
|
193 |
-
|
194 |
-
dst = os.path.join(save_folder, 'img.png')
|
195 |
-
|
196 |
-
if not text:
|
197 |
-
if image is None:
|
198 |
-
return dst, save_folder
|
199 |
-
raise gr.Error("Upload image or provide text ...")
|
200 |
-
image.save(dst)
|
201 |
-
return dst, save_folder
|
202 |
-
|
203 |
-
image = worker_t2i(text, seed, step)
|
204 |
-
image.save(dst)
|
205 |
-
dst = worker_xbg(image, save_folder)
|
206 |
-
return dst, save_folder
|
207 |
-
|
208 |
-
@spaces.GPU
|
209 |
-
def stage_1_xbg(image, save_folder):
|
210 |
-
if isinstance(image, str):
|
211 |
-
image = Image.open(image)
|
212 |
-
dst = save_folder + '/img_nobg.png'
|
213 |
-
rgba = worker_xbg(image)
|
214 |
-
rgba.save(dst)
|
215 |
-
return dst
|
216 |
-
|
217 |
-
@spaces.GPU
|
218 |
-
def stage_2_i2v(image, seed, step, save_folder):
|
219 |
-
if isinstance(image, str):
|
220 |
-
image = Image.open(image)
|
221 |
-
gif_dst = save_folder + '/views.gif'
|
222 |
-
res_img, pils = worker_i2v(image, seed, step)
|
223 |
-
save_gif(pils, gif_dst)
|
224 |
-
views_img, cond_img = res_img[0], res_img[1]
|
225 |
-
img_array = np.asarray(views_img, dtype=np.uint8)
|
226 |
-
show_img = rearrange(img_array, '(n h) (m w) c -> (n m) h w c', n=3, m=2)
|
227 |
-
show_img = show_img[worker_i2v.order, ...]
|
228 |
-
show_img = rearrange(show_img, '(n m) h w c -> (n h) (m w) c', n=2, m=3)
|
229 |
-
show_img = Image.fromarray(show_img)
|
230 |
-
return views_img, cond_img, show_img
|
231 |
-
|
232 |
-
@spaces.GPU
|
233 |
-
def stage_3_v23(
|
234 |
-
views_pil,
|
235 |
-
cond_pil,
|
236 |
-
seed,
|
237 |
-
save_folder,
|
238 |
-
target_face_count = 30000,
|
239 |
-
do_texture_mapping = True,
|
240 |
-
do_render =True
|
241 |
-
):
|
242 |
-
do_texture_mapping = do_texture_mapping or do_render
|
243 |
-
obj_dst = save_folder + '/mesh_with_colors.obj'
|
244 |
-
glb_dst = save_folder + '/mesh.glb'
|
245 |
-
worker_v23(
|
246 |
-
views_pil,
|
247 |
-
cond_pil,
|
248 |
-
seed = seed,
|
249 |
-
save_folder = save_folder,
|
250 |
-
target_face_count = target_face_count,
|
251 |
-
do_texture_mapping = do_texture_mapping
|
252 |
-
)
|
253 |
-
return obj_dst, glb_dst
|
254 |
-
|
255 |
-
@spaces.GPU
|
256 |
-
def stage_4_gif(obj_dst, save_folder, do_render_gif=True):
|
257 |
-
if not do_render_gif: return None
|
258 |
-
gif_dst = save_folder + '/output.gif'
|
259 |
-
worker_gif(
|
260 |
-
save_folder + '/mesh.obj',
|
261 |
-
gif_dst_path = gif_dst
|
262 |
-
)
|
263 |
-
return gif_dst
|
264 |
-
|
265 |
-
#===============================================================
|
266 |
-
with gr.Blocks() as demo:
|
267 |
-
gr.Markdown(CONST_HEADER)
|
268 |
-
with gr.Row(variant="panel"):
|
269 |
-
with gr.Column(scale=2):
|
270 |
-
with gr.Tab("Text to 3D"):
|
271 |
-
with gr.Column():
|
272 |
-
text = gr.TextArea('δΈεͺι»η½ηΈι΄ηηη«ε¨η½θ²θζ―δΈε±
δΈεηοΌεη°εΊε‘ιι£ζ Όεε―η±ζ°ε΄γ', lines=1, max_lines=10, label='Input text')
|
273 |
-
with gr.Row():
|
274 |
-
textgen_seed = gr.Number(value=0, label="T2I seed", precision=0)
|
275 |
-
textgen_step = gr.Number(value=25, label="T2I step", precision=0)
|
276 |
-
textgen_SEED = gr.Number(value=0, label="Gen seed", precision=0)
|
277 |
-
textgen_STEP = gr.Number(value=50, label="Gen step", precision=0)
|
278 |
-
textgen_max_faces = gr.Number(value=90000, label="max number of faces", precision=0)
|
279 |
-
|
280 |
-
with gr.Row():
|
281 |
-
textgen_do_texture_mapping = gr.Checkbox(label="texture mapping", value=False, interactive=True)
|
282 |
-
textgen_do_render_gif = gr.Checkbox(label="Render gif", value=False, interactive=True)
|
283 |
-
textgen_submit = gr.Button("Generate", variant="primary")
|
284 |
-
|
285 |
-
with gr.Row():
|
286 |
-
gr.Examples(examples=example_ts, inputs=[text], label="Txt examples", examples_per_page=10)
|
287 |
-
|
288 |
-
with gr.Tab("Image to 3D"):
|
289 |
-
with gr.Column():
|
290 |
-
input_image = gr.Image(label="Input image",
|
291 |
-
width=256, height=256, type="pil",
|
292 |
-
image_mode="RGBA", sources="upload",
|
293 |
-
interactive=True)
|
294 |
-
with gr.Row():
|
295 |
-
imggen_SEED = gr.Number(value=0, label="Gen seed", precision=0)
|
296 |
-
imggen_STEP = gr.Number(value=50, label="Gen step", precision=0)
|
297 |
-
imggen_max_faces = gr.Number(value=90000, label="max number of faces", precision=0)
|
298 |
-
|
299 |
-
with gr.Row():
|
300 |
-
imggen_do_texture_mapping = gr.Checkbox(label="texture mapping", value=False, interactive=True)
|
301 |
-
imggen_do_render_gif = gr.Checkbox(label="Render gif", value=False, interactive=True)
|
302 |
-
imggen_submit = gr.Button("Generate", variant="primary")
|
303 |
-
with gr.Row():
|
304 |
-
gr.Examples(examples=example_is, inputs=[input_image], label="Img examples", examples_per_page=10)
|
305 |
-
|
306 |
-
with gr.Column(scale=3):
|
307 |
-
with gr.Row():
|
308 |
-
with gr.Column(scale=2):
|
309 |
-
rem_bg_image = gr.Image(label="No backgraound image", type="pil",
|
310 |
-
image_mode="RGBA", interactive=False)
|
311 |
-
with gr.Column(scale=3):
|
312 |
-
result_image = gr.Image(label="Multi views", type="pil", interactive=False)
|
313 |
-
|
314 |
-
with gr.Row():
|
315 |
-
result_3dobj = gr.Model3D(
|
316 |
-
clear_color=[0.0, 0.0, 0.0, 0.0],
|
317 |
-
label="Output Obj",
|
318 |
-
show_label=True,
|
319 |
-
visible=True,
|
320 |
-
camera_position=[90, 90, None],
|
321 |
-
interactive=False
|
322 |
-
)
|
323 |
-
|
324 |
-
result_3dglb = gr.Model3D(
|
325 |
-
clear_color=[0.0, 0.0, 0.0, 0.0],
|
326 |
-
label="Output Glb",
|
327 |
-
show_label=True,
|
328 |
-
visible=True,
|
329 |
-
camera_position=[90, 90, None],
|
330 |
-
interactive=False
|
331 |
-
)
|
332 |
-
result_gif = gr.Image(label="Rendered GIF", interactive=False)
|
333 |
-
|
334 |
-
with gr.Row():
|
335 |
-
gr.Markdown("""
|
336 |
-
We recommend download and open Glb using 3D software, such as Blender, MeshLab, etc.
|
337 |
-
Limited by gradio, Obj file here only be shown as vertex shading, but Glb can be texture shading.
|
338 |
-
""")
|
339 |
-
|
340 |
-
#===============================================================
|
341 |
-
|
342 |
-
none = gr.State(None)
|
343 |
-
save_folder = gr.State()
|
344 |
-
cond_image = gr.State()
|
345 |
-
views_image = gr.State()
|
346 |
-
text_image = gr.State()
|
347 |
-
|
348 |
-
textgen_submit.click(
|
349 |
-
fn=stage_0_t2i, inputs=[text, none, textgen_seed, textgen_step],
|
350 |
-
outputs=[rem_bg_image, save_folder],
|
351 |
-
).success(
|
352 |
-
fn=stage_2_i2v, inputs=[rem_bg_image, textgen_SEED, textgen_STEP, save_folder],
|
353 |
-
outputs=[views_image, cond_image, result_image],
|
354 |
-
).success(
|
355 |
-
fn=stage_3_v23, inputs=[views_image, cond_image, textgen_SEED, save_folder, textgen_max_faces, textgen_do_texture_mapping, textgen_do_render_gif],
|
356 |
-
outputs=[result_3dobj, result_3dglb],
|
357 |
-
).success(
|
358 |
-
fn=stage_4_gif, inputs=[result_3dglb, save_folder, textgen_do_render_gif],
|
359 |
-
outputs=[result_gif],
|
360 |
-
).success(lambda: print('Text_to_3D Done ...'))
|
361 |
-
|
362 |
-
imggen_submit.click(
|
363 |
-
fn=stage_0_t2i, inputs=[none, input_image, textgen_seed, textgen_step],
|
364 |
-
outputs=[text_image, save_folder],
|
365 |
-
).success(
|
366 |
-
fn=stage_1_xbg, inputs=[text_image, save_folder],
|
367 |
-
outputs=[rem_bg_image],
|
368 |
-
).success(
|
369 |
-
fn=stage_2_i2v, inputs=[rem_bg_image, imggen_SEED, imggen_STEP, save_folder],
|
370 |
-
outputs=[views_image, cond_image, result_image],
|
371 |
-
).success(
|
372 |
-
fn=stage_3_v23, inputs=[views_image, cond_image, imggen_SEED, save_folder, imggen_max_faces, imggen_do_texture_mapping, imggen_do_render_gif],
|
373 |
-
outputs=[result_3dobj, result_3dglb],
|
374 |
-
).success(
|
375 |
-
fn=stage_4_gif, inputs=[result_3dglb, save_folder, imggen_do_render_gif],
|
376 |
-
outputs=[result_gif],
|
377 |
-
).success(lambda: print('Image_to_3D Done ...'))
|
378 |
-
|
379 |
-
#===============================================================
|
380 |
-
|
381 |
-
gr.Markdown(CONST_CITATION)
|
382 |
-
demo.queue(max_size=CONST_MAX_QUEUE)
|
383 |
-
demo.launch()
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ipynb_checkpoints/main-checkpoint.py
DELETED
@@ -1,164 +0,0 @@
|
|
1 |
-
# Open Source Model Licensed under the Apache License Version 2.0
|
2 |
-
# and Other Licenses of the Third-Party Components therein:
|
3 |
-
# The below Model in this distribution may have been modified by THL A29 Limited
|
4 |
-
# ("Tencent Modifications"). All Tencent Modifications are Copyright (C) 2024 THL A29 Limited.
|
5 |
-
|
6 |
-
# Copyright (C) 2024 THL A29 Limited, a Tencent company. All rights reserved.
|
7 |
-
# The below software and/or models in this distribution may have been
|
8 |
-
# modified by THL A29 Limited ("Tencent Modifications").
|
9 |
-
# All Tencent Modifications are Copyright (C) THL A29 Limited.
|
10 |
-
|
11 |
-
# Hunyuan 3D is licensed under the TENCENT HUNYUAN NON-COMMERCIAL LICENSE AGREEMENT
|
12 |
-
# except for the third-party components listed below.
|
13 |
-
# Hunyuan 3D does not impose any additional limitations beyond what is outlined
|
14 |
-
# in the repsective licenses of these third-party components.
|
15 |
-
# Users must comply with all terms and conditions of original licenses of these third-party
|
16 |
-
# components and must ensure that the usage of the third party components adheres to
|
17 |
-
# all relevant laws and regulations.
|
18 |
-
|
19 |
-
# For avoidance of doubts, Hunyuan 3D means the large language models and
|
20 |
-
# their software and algorithms, including trained model weights, parameters (including
|
21 |
-
# optimizer states), machine-learning model code, inference-enabling code, training-enabling code,
|
22 |
-
# fine-tuning enabling code and other elements of the foregoing made publicly available
|
23 |
-
# by Tencent in accordance with TENCENT HUNYUAN COMMUNITY LICENSE AGREEMENT.l
|
24 |
-
|
25 |
-
import os
|
26 |
-
import warnings
|
27 |
-
import torch
|
28 |
-
from PIL import Image
|
29 |
-
import argparse
|
30 |
-
|
31 |
-
from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer
|
32 |
-
|
33 |
-
warnings.simplefilter('ignore', category=UserWarning)
|
34 |
-
warnings.simplefilter('ignore', category=FutureWarning)
|
35 |
-
warnings.simplefilter('ignore', category=DeprecationWarning)
|
36 |
-
|
37 |
-
def get_args():
|
38 |
-
parser = argparse.ArgumentParser()
|
39 |
-
parser.add_argument(
|
40 |
-
"--use_lite", default=False, action="store_true"
|
41 |
-
)
|
42 |
-
parser.add_argument(
|
43 |
-
"--mv23d_cfg_path", default="./svrm/configs/svrm.yaml", type=str
|
44 |
-
)
|
45 |
-
parser.add_argument(
|
46 |
-
"--mv23d_ckt_path", default="weights/svrm/svrm.safetensors", type=str
|
47 |
-
)
|
48 |
-
parser.add_argument(
|
49 |
-
"--text2image_path", default="weights/hunyuanDiT", type=str
|
50 |
-
)
|
51 |
-
parser.add_argument(
|
52 |
-
"--save_folder", default="./outputs/test/", type=str
|
53 |
-
)
|
54 |
-
parser.add_argument(
|
55 |
-
"--text_prompt", default="", type=str,
|
56 |
-
)
|
57 |
-
parser.add_argument(
|
58 |
-
"--image_prompt", default="", type=str
|
59 |
-
)
|
60 |
-
parser.add_argument(
|
61 |
-
"--device", default="cuda:0", type=str
|
62 |
-
)
|
63 |
-
parser.add_argument(
|
64 |
-
"--t2i_seed", default=0, type=int
|
65 |
-
)
|
66 |
-
parser.add_argument(
|
67 |
-
"--t2i_steps", default=25, type=int
|
68 |
-
)
|
69 |
-
parser.add_argument(
|
70 |
-
"--gen_seed", default=0, type=int
|
71 |
-
)
|
72 |
-
parser.add_argument(
|
73 |
-
"--gen_steps", default=50, type=int
|
74 |
-
)
|
75 |
-
parser.add_argument(
|
76 |
-
"--max_faces_num", default=80000, type=int,
|
77 |
-
help="max num of face, suggest 80000 for effect, 10000 for speed"
|
78 |
-
)
|
79 |
-
parser.add_argument(
|
80 |
-
"--save_memory", default=False, action="store_true"
|
81 |
-
)
|
82 |
-
parser.add_argument(
|
83 |
-
"--do_texture_mapping", default=False, action="store_true"
|
84 |
-
)
|
85 |
-
parser.add_argument(
|
86 |
-
"--do_render", default=False, action="store_true"
|
87 |
-
)
|
88 |
-
return parser.parse_args()
|
89 |
-
|
90 |
-
|
91 |
-
if __name__ == "__main__":
|
92 |
-
args = get_args()
|
93 |
-
|
94 |
-
assert not (args.text_prompt and args.image_prompt), "Text and image can only be given to one"
|
95 |
-
assert args.text_prompt or args.image_prompt, "Text and image can only be given to one"
|
96 |
-
|
97 |
-
# init model
|
98 |
-
rembg_model = Removebg()
|
99 |
-
image_to_views_model = Image2Views(
|
100 |
-
device=args.device,
|
101 |
-
use_lite=args.use_lite,
|
102 |
-
save_memory=args.save_memory
|
103 |
-
)
|
104 |
-
|
105 |
-
views_to_mesh_model = Views2Mesh(
|
106 |
-
args.mv23d_cfg_path,
|
107 |
-
args.mv23d_ckt_path,
|
108 |
-
args.device,
|
109 |
-
use_lite=args.use_lite,
|
110 |
-
save_memory=args.save_memory
|
111 |
-
)
|
112 |
-
|
113 |
-
if args.text_prompt:
|
114 |
-
text_to_image_model = Text2Image(
|
115 |
-
pretrain = args.text2image_path,
|
116 |
-
device = args.device,
|
117 |
-
save_memory = args.save_memory
|
118 |
-
)
|
119 |
-
if args.do_render:
|
120 |
-
gif_renderer = GifRenderer(device=args.device)
|
121 |
-
|
122 |
-
# ---- ----- ---- ---- ---- ----
|
123 |
-
|
124 |
-
os.makedirs(args.save_folder, exist_ok=True)
|
125 |
-
|
126 |
-
# stage 1, text to image
|
127 |
-
if args.text_prompt:
|
128 |
-
res_rgb_pil = text_to_image_model(
|
129 |
-
args.text_prompt,
|
130 |
-
seed=args.t2i_seed,
|
131 |
-
steps=args.t2i_steps
|
132 |
-
)
|
133 |
-
res_rgb_pil.save(os.path.join(args.save_folder, "img.jpg"))
|
134 |
-
elif args.image_prompt:
|
135 |
-
res_rgb_pil = Image.open(args.image_prompt)
|
136 |
-
|
137 |
-
# stage 2, remove back ground
|
138 |
-
res_rgba_pil = rembg_model(res_rgb_pil)
|
139 |
-
res_rgb_pil.save(os.path.join(args.save_folder, "img_nobg.png"))
|
140 |
-
|
141 |
-
# stage 3, image to views
|
142 |
-
(views_grid_pil, cond_img), view_pil_list = image_to_views_model(
|
143 |
-
res_rgba_pil,
|
144 |
-
seed = args.gen_seed,
|
145 |
-
steps = args.gen_steps
|
146 |
-
)
|
147 |
-
views_grid_pil.save(os.path.join(args.save_folder, "views.jpg"))
|
148 |
-
|
149 |
-
# stage 4, views to mesh
|
150 |
-
views_to_mesh_model(
|
151 |
-
views_grid_pil,
|
152 |
-
cond_img,
|
153 |
-
seed = args.gen_seed,
|
154 |
-
target_face_count = args.max_faces_num,
|
155 |
-
save_folder = args.save_folder,
|
156 |
-
do_texture_mapping = args.do_texture_mapping
|
157 |
-
)
|
158 |
-
|
159 |
-
# stage 5, render gif
|
160 |
-
if args.do_render:
|
161 |
-
gif_renderer(
|
162 |
-
os.path.join(args.save_folder, 'mesh.obj'),
|
163 |
-
gif_dst_path = os.path.join(args.save_folder, 'output.gif'),
|
164 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ipynb_checkpoints/requirements-checkpoint.txt
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
--find-links https://download.pytorch.org/whl/cu118
|
2 |
-
torch==2.2.0
|
3 |
-
torchvision==0.17.0
|
4 |
-
diffusers
|
5 |
-
numpy==1.26.4
|
6 |
-
transformers
|
7 |
-
rembg
|
8 |
-
tqdm
|
9 |
-
omegaconf
|
10 |
-
matplotlib
|
11 |
-
opencv-python
|
12 |
-
imageio
|
13 |
-
jaxtyping
|
14 |
-
einops
|
15 |
-
SentencePiece
|
16 |
-
accelerate
|
17 |
-
trimesh
|
18 |
-
PyMCubes
|
19 |
-
xatlas
|
20 |
-
libigl
|
21 |
-
git+https://github.com/facebookresearch/pytorch3d@stable
|
22 |
-
git+https://github.com/NVlabs/nvdiffrast
|
23 |
-
open3d
|
24 |
-
ninja
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|