Spaces:
Running
on
Zero
Running
on
Zero
着手修改依赖版本
Browse files- gradio_app.py +6 -2
- gradio_cache/env_maps/gradient.jpg +0 -0
- gradio_cache/env_maps/white.jpg +0 -0
- hy3dgen/__pycache__/__init__.cpython-310.pyc +0 -0
- hy3dgen/__pycache__/rembg.cpython-310.pyc +0 -0
- hy3dgen/shapegen/__pycache__/__init__.cpython-310.pyc +0 -0
- hy3dgen/shapegen/__pycache__/pipelines.cpython-310.pyc +0 -0
- hy3dgen/shapegen/__pycache__/postprocessors.cpython-310.pyc +0 -0
- hy3dgen/shapegen/__pycache__/preprocessors.cpython-310.pyc +0 -0
- hy3dgen/shapegen/__pycache__/schedulers.cpython-310.pyc +0 -0
- hy3dgen/shapegen/__pycache__/utils.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/__pycache__/__init__.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/__pycache__/conditioner.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/autoencoders/__pycache__/__init__.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/autoencoders/__pycache__/attention_blocks.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/autoencoders/__pycache__/attention_processors.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/autoencoders/__pycache__/model.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/autoencoders/__pycache__/surface_extractors.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/autoencoders/__pycache__/volume_decoders.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/denoisers/__pycache__/__init__.cpython-310.pyc +0 -0
- hy3dgen/shapegen/models/denoisers/__pycache__/hunyuan3ddit.cpython-310.pyc +0 -0
- hy3dgen/texgen/__pycache__/__init__.cpython-310.pyc +0 -0
- hy3dgen/texgen/__pycache__/pipelines.cpython-310.pyc +0 -0
- hy3dgen/texgen/differentiable_renderer/__pycache__/__init__.cpython-310.pyc +0 -0
- hy3dgen/texgen/differentiable_renderer/__pycache__/camera_utils.cpython-310.pyc +0 -0
- hy3dgen/texgen/differentiable_renderer/__pycache__/mesh_processor.cpython-310.pyc +0 -0
- hy3dgen/texgen/differentiable_renderer/__pycache__/mesh_render.cpython-310.pyc +0 -0
- hy3dgen/texgen/differentiable_renderer/__pycache__/mesh_utils.cpython-310.pyc +0 -0
- hy3dgen/texgen/pipelines.py +36 -6
- hy3dgen/texgen/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- hy3dgen/texgen/utils/__pycache__/dehighlight_utils.cpython-310.pyc +0 -0
- hy3dgen/texgen/utils/__pycache__/imagesuper_utils.cpython-310.pyc +0 -0
- hy3dgen/texgen/utils/__pycache__/multiview_utils.cpython-310.pyc +0 -0
- hy3dgen/texgen/utils/__pycache__/uv_warp_utils.cpython-310.pyc +0 -0
- requirements.txt +2 -3
gradio_app.py
CHANGED
|
@@ -683,7 +683,8 @@ if __name__ == '__main__':
|
|
| 683 |
if not args.disable_tex:
|
| 684 |
try:
|
| 685 |
from hy3dgen.texgen import Hunyuan3DPaintPipeline
|
| 686 |
-
|
|
|
|
| 687 |
texgen_worker = Hunyuan3DPaintPipeline.from_pretrained(args.texgen_model_path)
|
| 688 |
if args.low_vram_mode:
|
| 689 |
texgen_worker.enable_model_cpu_offload()
|
|
@@ -713,6 +714,9 @@ if __name__ == '__main__':
|
|
| 713 |
from hy3dgen.rembg import BackgroundRemover
|
| 714 |
|
| 715 |
rmbg_worker = BackgroundRemover()
|
|
|
|
|
|
|
|
|
|
| 716 |
i23d_worker = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained(
|
| 717 |
args.model_path,
|
| 718 |
subfolder=args.subfolder,
|
|
@@ -742,4 +746,4 @@ if __name__ == '__main__':
|
|
| 742 |
torch.cuda.empty_cache()
|
| 743 |
demo = build_app()
|
| 744 |
app = gr.mount_gradio_app(app, demo, path="/")
|
| 745 |
-
uvicorn.run(app, host=args.host, port=args.port)
|
|
|
|
| 683 |
if not args.disable_tex:
|
| 684 |
try:
|
| 685 |
from hy3dgen.texgen import Hunyuan3DPaintPipeline
|
| 686 |
+
print("着手加载贴图Pipeline")
|
| 687 |
+
print(args.texgen_model_path)
|
| 688 |
texgen_worker = Hunyuan3DPaintPipeline.from_pretrained(args.texgen_model_path)
|
| 689 |
if args.low_vram_mode:
|
| 690 |
texgen_worker.enable_model_cpu_offload()
|
|
|
|
| 714 |
from hy3dgen.rembg import BackgroundRemover
|
| 715 |
|
| 716 |
rmbg_worker = BackgroundRemover()
|
| 717 |
+
print("着手加载模型Pipeline")
|
| 718 |
+
print(args.model_path)
|
| 719 |
+
print(args.subfolder)
|
| 720 |
i23d_worker = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained(
|
| 721 |
args.model_path,
|
| 722 |
subfolder=args.subfolder,
|
|
|
|
| 746 |
torch.cuda.empty_cache()
|
| 747 |
demo = build_app()
|
| 748 |
app = gr.mount_gradio_app(app, demo, path="/")
|
| 749 |
+
uvicorn.run(app, host=args.host, port=args.port)
|
gradio_cache/env_maps/gradient.jpg
ADDED
|
gradio_cache/env_maps/white.jpg
ADDED
|
hy3dgen/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/hy3dgen/__pycache__/__init__.cpython-310.pyc and b/hy3dgen/__pycache__/__init__.cpython-310.pyc differ
|
|
|
hy3dgen/__pycache__/rembg.cpython-310.pyc
CHANGED
|
Binary files a/hy3dgen/__pycache__/rembg.cpython-310.pyc and b/hy3dgen/__pycache__/rembg.cpython-310.pyc differ
|
|
|
hy3dgen/shapegen/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (479 Bytes). View file
|
|
|
hy3dgen/shapegen/__pycache__/pipelines.cpython-310.pyc
ADDED
|
Binary file (20.6 kB). View file
|
|
|
hy3dgen/shapegen/__pycache__/postprocessors.cpython-310.pyc
ADDED
|
Binary file (5.8 kB). View file
|
|
|
hy3dgen/shapegen/__pycache__/preprocessors.cpython-310.pyc
ADDED
|
Binary file (4.5 kB). View file
|
|
|
hy3dgen/shapegen/__pycache__/schedulers.cpython-310.pyc
ADDED
|
Binary file (13.2 kB). View file
|
|
|
hy3dgen/shapegen/__pycache__/utils.cpython-310.pyc
ADDED
|
Binary file (3.81 kB). View file
|
|
|
hy3dgen/shapegen/models/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (369 Bytes). View file
|
|
|
hy3dgen/shapegen/models/__pycache__/conditioner.cpython-310.pyc
ADDED
|
Binary file (6.49 kB). View file
|
|
|
hy3dgen/shapegen/models/autoencoders/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (710 Bytes). View file
|
|
|
hy3dgen/shapegen/models/autoencoders/__pycache__/attention_blocks.cpython-310.pyc
ADDED
|
Binary file (15.6 kB). View file
|
|
|
hy3dgen/shapegen/models/autoencoders/__pycache__/attention_processors.cpython-310.pyc
ADDED
|
Binary file (3.18 kB). View file
|
|
|
hy3dgen/shapegen/models/autoencoders/__pycache__/model.cpython-310.pyc
ADDED
|
Binary file (4.69 kB). View file
|
|
|
hy3dgen/shapegen/models/autoencoders/__pycache__/surface_extractors.cpython-310.pyc
ADDED
|
Binary file (3.37 kB). View file
|
|
|
hy3dgen/shapegen/models/autoencoders/__pycache__/volume_decoders.cpython-310.pyc
ADDED
|
Binary file (10.2 kB). View file
|
|
|
hy3dgen/shapegen/models/denoisers/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (202 Bytes). View file
|
|
|
hy3dgen/shapegen/models/denoisers/__pycache__/hunyuan3ddit.cpython-310.pyc
ADDED
|
Binary file (13.2 kB). View file
|
|
|
hy3dgen/texgen/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/hy3dgen/texgen/__pycache__/__init__.cpython-310.pyc and b/hy3dgen/texgen/__pycache__/__init__.cpython-310.pyc differ
|
|
|
hy3dgen/texgen/__pycache__/pipelines.cpython-310.pyc
CHANGED
|
Binary files a/hy3dgen/texgen/__pycache__/pipelines.cpython-310.pyc and b/hy3dgen/texgen/__pycache__/pipelines.cpython-310.pyc differ
|
|
|
hy3dgen/texgen/differentiable_renderer/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/hy3dgen/texgen/differentiable_renderer/__pycache__/__init__.cpython-310.pyc and b/hy3dgen/texgen/differentiable_renderer/__pycache__/__init__.cpython-310.pyc differ
|
|
|
hy3dgen/texgen/differentiable_renderer/__pycache__/camera_utils.cpython-310.pyc
CHANGED
|
Binary files a/hy3dgen/texgen/differentiable_renderer/__pycache__/camera_utils.cpython-310.pyc and b/hy3dgen/texgen/differentiable_renderer/__pycache__/camera_utils.cpython-310.pyc differ
|
|
|
hy3dgen/texgen/differentiable_renderer/__pycache__/mesh_processor.cpython-310.pyc
ADDED
|
Binary file (2.14 kB). View file
|
|
|
hy3dgen/texgen/differentiable_renderer/__pycache__/mesh_render.cpython-310.pyc
CHANGED
|
Binary files a/hy3dgen/texgen/differentiable_renderer/__pycache__/mesh_render.cpython-310.pyc and b/hy3dgen/texgen/differentiable_renderer/__pycache__/mesh_render.cpython-310.pyc differ
|
|
|
hy3dgen/texgen/differentiable_renderer/__pycache__/mesh_utils.cpython-310.pyc
ADDED
|
Binary file (787 Bytes). View file
|
|
|
hy3dgen/texgen/pipelines.py
CHANGED
|
@@ -19,6 +19,7 @@ import os
|
|
| 19 |
import torch
|
| 20 |
from PIL import Image
|
| 21 |
from typing import Union, Optional
|
|
|
|
| 22 |
|
| 23 |
from .differentiable_renderer.mesh_render import MeshRender
|
| 24 |
from .utils.dehighlight_utils import Light_Shadow_Remover
|
|
@@ -50,30 +51,59 @@ class Hunyuan3DPaintPipeline:
|
|
| 50 |
@classmethod
|
| 51 |
def from_pretrained(cls, model_path):
|
| 52 |
original_model_path = model_path
|
|
|
|
| 53 |
if not os.path.exists(model_path):
|
|
|
|
| 54 |
# try local path
|
| 55 |
base_dir = os.environ.get('HY3DGEN_MODELS', '~/.cache/hy3dgen')
|
| 56 |
model_path = os.path.expanduser(os.path.join(base_dir, model_path))
|
| 57 |
|
|
|
|
|
|
|
|
|
|
| 58 |
delight_model_path = os.path.join(model_path, 'hunyuan3d-delight-v2-0')
|
| 59 |
multiview_model_path = os.path.join(model_path, 'hunyuan3d-paint-v2-0')
|
| 60 |
|
|
|
|
|
|
|
|
|
|
| 61 |
if not os.path.exists(delight_model_path) or not os.path.exists(multiview_model_path):
|
| 62 |
try:
|
| 63 |
import huggingface_hub
|
| 64 |
# download from huggingface
|
| 65 |
model_path = huggingface_hub.snapshot_download(repo_id=original_model_path,
|
| 66 |
allow_patterns=["hunyuan3d-delight-v2-0/*"])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
model_path = huggingface_hub.snapshot_download(repo_id=original_model_path,
|
| 68 |
allow_patterns=["hunyuan3d-paint-v2-0/*"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
delight_model_path = os.path.join(model_path, 'hunyuan3d-delight-v2-0')
|
| 70 |
multiview_model_path = os.path.join(model_path, 'hunyuan3d-paint-v2-0')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
return cls(Hunyuan3DTexGenConfig(delight_model_path, multiview_model_path))
|
| 72 |
-
except
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
)
|
| 76 |
-
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
else:
|
| 78 |
return cls(Hunyuan3DTexGenConfig(delight_model_path, multiview_model_path))
|
| 79 |
|
|
@@ -224,4 +254,4 @@ class Hunyuan3DPaintPipeline:
|
|
| 224 |
self.render.set_texture(texture)
|
| 225 |
textured_mesh = self.render.save_mesh()
|
| 226 |
|
| 227 |
-
return textured_mesh
|
|
|
|
| 19 |
import torch
|
| 20 |
from PIL import Image
|
| 21 |
from typing import Union, Optional
|
| 22 |
+
from pathlib import Path
|
| 23 |
|
| 24 |
from .differentiable_renderer.mesh_render import MeshRender
|
| 25 |
from .utils.dehighlight_utils import Light_Shadow_Remover
|
|
|
|
| 51 |
@classmethod
|
| 52 |
def from_pretrained(cls, model_path):
|
| 53 |
original_model_path = model_path
|
| 54 |
+
print(f"原始路径 original_model_path: {model_path}")
|
| 55 |
if not os.path.exists(model_path):
|
| 56 |
+
print(f"存在原始路径: {model_path}")
|
| 57 |
# try local path
|
| 58 |
base_dir = os.environ.get('HY3DGEN_MODELS', '~/.cache/hy3dgen')
|
| 59 |
model_path = os.path.expanduser(os.path.join(base_dir, model_path))
|
| 60 |
|
| 61 |
+
print(f"基础路径 base_dir: {base_dir}")
|
| 62 |
+
print(f"模型路径 model_path: {model_path}")
|
| 63 |
+
|
| 64 |
delight_model_path = os.path.join(model_path, 'hunyuan3d-delight-v2-0')
|
| 65 |
multiview_model_path = os.path.join(model_path, 'hunyuan3d-paint-v2-0')
|
| 66 |
|
| 67 |
+
print(f"路径 delight_model_path: {delight_model_path}")
|
| 68 |
+
print(f"路径 multiview_model_path: {multiview_model_path}")
|
| 69 |
+
|
| 70 |
if not os.path.exists(delight_model_path) or not os.path.exists(multiview_model_path):
|
| 71 |
try:
|
| 72 |
import huggingface_hub
|
| 73 |
# download from huggingface
|
| 74 |
model_path = huggingface_hub.snapshot_download(repo_id=original_model_path,
|
| 75 |
allow_patterns=["hunyuan3d-delight-v2-0/*"])
|
| 76 |
+
print(f"下载的 model_path 1 : {model_path}")
|
| 77 |
+
snapshot_path = Path(model_path)
|
| 78 |
+
for path in snapshot_path.rglob("*"):
|
| 79 |
+
print(path.relative_to(snapshot_path))
|
| 80 |
model_path = huggingface_hub.snapshot_download(repo_id=original_model_path,
|
| 81 |
allow_patterns=["hunyuan3d-paint-v2-0/*"])
|
| 82 |
+
print(f"下载的 model_path 2 : {model_path}")
|
| 83 |
+
snapshot_path = Path(model_path)
|
| 84 |
+
for path in snapshot_path.rglob("*"):
|
| 85 |
+
print(path.relative_to(snapshot_path))
|
| 86 |
+
|
| 87 |
+
|
| 88 |
delight_model_path = os.path.join(model_path, 'hunyuan3d-delight-v2-0')
|
| 89 |
multiview_model_path = os.path.join(model_path, 'hunyuan3d-paint-v2-0')
|
| 90 |
+
|
| 91 |
+
print(f"路径 delight_model_path : {delight_model_path}")
|
| 92 |
+
print(f"路径 multiview_model_path : {multiview_model_path}")
|
| 93 |
+
print(f"路径 delight_model_path 是否存在: {os.path.exists(delight_model_path)}")
|
| 94 |
+
print(f"路径 multiview_model_path 是否存在: {os.path.exists(multiview_model_path)}")
|
| 95 |
+
|
| 96 |
return cls(Hunyuan3DTexGenConfig(delight_model_path, multiview_model_path))
|
| 97 |
+
except Exception as e:
|
| 98 |
+
print("构造 Hunyuan3DPaintPipeline 实例时出错:", e)
|
| 99 |
+
import traceback
|
| 100 |
+
traceback.print_exc()
|
| 101 |
+
raise
|
| 102 |
+
# except ImportError:
|
| 103 |
+
# logger.warning(
|
| 104 |
+
# "You need to install HuggingFace Hub to load models from the hub."
|
| 105 |
+
# )
|
| 106 |
+
# raise RuntimeError(f"Model path {model_path} not found")
|
| 107 |
else:
|
| 108 |
return cls(Hunyuan3DTexGenConfig(delight_model_path, multiview_model_path))
|
| 109 |
|
|
|
|
| 254 |
self.render.set_texture(texture)
|
| 255 |
textured_mesh = self.render.save_mesh()
|
| 256 |
|
| 257 |
+
return textured_mesh
|
hy3dgen/texgen/utils/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (140 Bytes). View file
|
|
|
hy3dgen/texgen/utils/__pycache__/dehighlight_utils.cpython-310.pyc
ADDED
|
Binary file (3.26 kB). View file
|
|
|
hy3dgen/texgen/utils/__pycache__/imagesuper_utils.cpython-310.pyc
ADDED
|
Binary file (1.06 kB). View file
|
|
|
hy3dgen/texgen/utils/__pycache__/multiview_utils.cpython-310.pyc
ADDED
|
Binary file (2.67 kB). View file
|
|
|
hy3dgen/texgen/utils/__pycache__/uv_warp_utils.cpython-310.pyc
ADDED
|
Binary file (605 Bytes). View file
|
|
|
requirements.txt
CHANGED
|
@@ -6,9 +6,9 @@ diffusers
|
|
| 6 |
einops
|
| 7 |
opencv-python
|
| 8 |
numpy
|
| 9 |
-
torch
|
| 10 |
transformers
|
| 11 |
-
torchvision
|
| 12 |
#taming-transformers-rom1504
|
| 13 |
#ConfigArgParse
|
| 14 |
#ipdb
|
|
@@ -39,4 +39,3 @@ rembg
|
|
| 39 |
onnxruntime
|
| 40 |
#gevent
|
| 41 |
#geventhttpclient
|
| 42 |
-
|
|
|
|
| 6 |
einops
|
| 7 |
opencv-python
|
| 8 |
numpy
|
| 9 |
+
torch==2.4.0
|
| 10 |
transformers
|
| 11 |
+
torchvision==0.19.0
|
| 12 |
#taming-transformers-rom1504
|
| 13 |
#ConfigArgParse
|
| 14 |
#ipdb
|
|
|
|
| 39 |
onnxruntime
|
| 40 |
#gevent
|
| 41 |
#geventhttpclient
|
|
|