Image-to-3D
Hunyuan3D-2
English
Chinese
text-to-3d

Request: DOI

#5
by nonnt66v2 - opened

this is an example of a kaggle notebook working to create a 3D shape using this model:

Local Inference on GPU

Model page: https://huggingface.co/tencent/Hunyuan3D-2.1

!pip install --upgrade pip
!hf auth login --token "HF_API_TOKEN"
!git clone https://github.com/Tencent-Hunyuan/Hunyuan3D-2.git
%cd "/kaggle/working/Hunyuan3D-2"
!pwd
!pip install -r requirements.txt
!pip install -e .

for texture

!cd hy3dgen/texgen/custom_rasterizer
!python3 setup.py install
!cd ../../..
!cd hy3dgen/texgen/differentiable_renderer
!python3 setup.py install
**provo inferenza con 30 step e 380 octree_resolution, modello: **

tencent/Hunyuan3D-2/hunyuan3d-dit-v2-0
import time

import torch
from PIL import Image

from hy3dgen.rembg import BackgroundRemover
from hy3dgen.shapegen import Hunyuan3DDiTFlowMatchingPipeline

image_path = '/kaggle/input/datasets/nonnt66/dataset3d1/3d-game-assets-kontext-dev-lora_create-3d-game.png'
image = Image.open(image_path).convert("RGBA")
if image.mode == 'RGB':
rembg = BackgroundRemover()
image = rembg(image)

pipeline = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained(
'tencent/Hunyuan3D-2mini',
subfolder='hunyuan3d-dit-v2-mini-turbo',
variant='fp16'
)

start_time = time.time()
mesh = pipeline(image=image,
num_inference_steps=50,
octree_resolution=380,
num_chunks=20000,
generator=torch.manual_seed(12345),
output_type='trimesh'
)[0]
print("--- %s seconds ---" % (time.time() - start_time))
mesh.export(f'demo.glb')

Sign up or log in to comment