fix some
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -181,3 +181,5 @@ demo_textured_metallic.jpg
|
||||
demo_textured_roughness.jpg
|
||||
demo_untextured.glb
|
||||
white_mesh_remesh.obj
|
||||
hy3dpaint/ckpt/
|
||||
|
||||
|
||||
23
demo.py
23
demo.py
@@ -18,22 +18,25 @@ except Exception as e:
|
||||
print(f"Warning: Failed to apply torchvision fix: {e}")
|
||||
|
||||
# shape
|
||||
model_path = 'tencent/Hunyuan3D-2.1'
|
||||
pipeline_shapegen = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained(model_path)
|
||||
#model_path = 'tencent/Hunyuan3D-2.1'
|
||||
#pipeline_shapegen = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained(model_path)
|
||||
##
|
||||
#image_path = 'assets/demo.png'
|
||||
#image = Image.open(image_path).convert("RGBA")
|
||||
#if image.mode == 'RGB':
|
||||
# rembg = BackgroundRemover()
|
||||
# image = rembg(image)
|
||||
#
|
||||
image_path = 'assets/demo.png'
|
||||
image = Image.open(image_path).convert("RGBA")
|
||||
if image.mode == 'RGB':
|
||||
rembg = BackgroundRemover()
|
||||
image = rembg(image)
|
||||
|
||||
mesh = pipeline_shapegen(image=image)[0]
|
||||
mesh.export('demo.glb')
|
||||
#mesh = pipeline_shapegen(image=image)[0]
|
||||
#mesh.export('demo.glb')
|
||||
|
||||
# paint
|
||||
max_num_view = 6 # can be 6 to 9
|
||||
resolution = 512 # can be 768 or 512
|
||||
conf = Hunyuan3DPaintConfig(max_num_view, resolution)
|
||||
conf.realesrgan_ckpt_path = "hy3dpaint/ckpt/RealESRGAN_x4plus.pth"
|
||||
conf.multiview_cfg_path = "hy3dpaint/cfgs/hunyuan-paint-pbr.yaml"
|
||||
conf.custom_pipeline = "hy3dpaint/hunyuanpaintpbr"
|
||||
paint_pipeline = Hunyuan3DPaintPipeline(conf)
|
||||
|
||||
output_mesh_path = 'demo_textured.glb'
|
||||
|
||||
@@ -734,9 +734,9 @@ if __name__ == '__main__':
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--model_path", type=str, default='tencent/Hunyuan3D-2')
|
||||
parser.add_argument("--subfolder", type=str, default='hunyuan3d-dit-v2-0')
|
||||
parser.add_argument("--texgen_model_path", type=str, default='tencent/Hunyuan3D-2')
|
||||
parser.add_argument("--model_path", type=str, default='tencent/Hunyuan3D-2.1')
|
||||
parser.add_argument("--subfolder", type=str, default='hunyuan3d-dit-v2-1')
|
||||
parser.add_argument("--texgen_model_path", type=str, default='tencent/Hunyuan3D-2.1')
|
||||
parser.add_argument('--port', type=int, default=443)
|
||||
parser.add_argument('--host', type=str, default='0.0.0.0')
|
||||
parser.add_argument('--device', type=str, default='cuda')
|
||||
@@ -798,6 +798,9 @@ if __name__ == '__main__':
|
||||
|
||||
from hy3dpaint.textureGenPipeline import Hunyuan3DPaintPipeline, Hunyuan3DPaintConfig
|
||||
conf = Hunyuan3DPaintConfig(max_num_view=8, resolution=768)
|
||||
conf.realesrgan_ckpt_path = "hy3dpaint/ckpt/RealESRGAN_x4plus.pth"
|
||||
conf.multiview_cfg_path = "hy3dpaint/cfgs/hunyuan-paint-pbr.yaml"
|
||||
conf.custom_pipeline = "hy3dpaint/hunyuanpaintpbr"
|
||||
tex_pipeline = Hunyuan3DPaintPipeline(conf)
|
||||
|
||||
# Not help much, ignore for now.
|
||||
@@ -831,7 +834,7 @@ if __name__ == '__main__':
|
||||
i23d_worker = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained(
|
||||
args.model_path,
|
||||
subfolder=args.subfolder,
|
||||
use_safetensors=True,
|
||||
use_safetensors=False,
|
||||
device=args.device,
|
||||
)
|
||||
if args.enable_flashvdm:
|
||||
|
||||
@@ -38,8 +38,8 @@ class Hunyuan3DPaintConfig:
|
||||
def __init__(self, max_num_view, resolution):
|
||||
self.device = "cuda"
|
||||
|
||||
self.multiview_cfg_path = "hy3dpaint/cfgs/hunyuan-paint-pbr.yaml"
|
||||
|
||||
self.multiview_cfg_path = "cfgs/hunyuan-paint-pbr.yaml"
|
||||
self.custom_pipeline = "hunyuanpaintpbr"
|
||||
self.multiview_pretrained_path = "tencent/Hunyuan3D-2.1"
|
||||
self.dino_ckpt_path = "facebook/dinov2-giant"
|
||||
self.realesrgan_ckpt_path = "ckpt/RealESRGAN_x4plus.pth"
|
||||
|
||||
@@ -29,6 +29,7 @@ class multiviewDiffusionNet:
|
||||
self.device = config.device
|
||||
|
||||
cfg_path = config.multiview_cfg_path
|
||||
custom_pipeline = config.custom_pipeline
|
||||
cfg = OmegaConf.load(cfg_path)
|
||||
self.cfg = cfg
|
||||
self.mode = self.cfg.model.params.stable_diffusion_config.custom_pipeline[2:]
|
||||
@@ -41,7 +42,7 @@ class multiviewDiffusionNet:
|
||||
model_path = os.path.join(model_path, "hunyuan3d-paintpbr-v2-1")
|
||||
pipeline = DiffusionPipeline.from_pretrained(
|
||||
model_path,
|
||||
custom_pipeline="hunyuanpaintpbr",
|
||||
custom_pipeline=custom_pipeline,
|
||||
torch_dtype=torch.float16
|
||||
)
|
||||
|
||||
@@ -52,7 +53,7 @@ class multiviewDiffusionNet:
|
||||
self.pipeline = pipeline.to(self.device)
|
||||
|
||||
if hasattr(self.pipeline.unet, "use_dino") and self.pipeline.unet.use_dino:
|
||||
from hunyuanpaintpbr.modules import Dino_v2
|
||||
from hunyuanpaintpbr.unet.modules import Dino_v2
|
||||
self.dino_v2 = Dino_v2(config.dino_ckpt_path).to(torch.float16)
|
||||
self.dino_v2 = self.dino_v2.to(self.device)
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ bpy==4.0
|
||||
onnxruntime==1.16.3
|
||||
torchmetrics==1.6.0
|
||||
|
||||
pydantic==2.10.6
|
||||
|
||||
timm
|
||||
pythreejs
|
||||
torchdiffeq
|
||||
|
||||
Reference in New Issue
Block a user