Hunyuan3D-2mini Modular Diffusers

Front, right, back and left views of a shape generated with the turbo checkpoint

Generated with the code below (seed 42, 30 steps, octree resolution 380).

Modular Diffusers blocks for tencent/Hunyuan3D-2mini: generate an untextured 3D shape from a single image. The model code and weights are in three repositories, one per checkpoint:

Requires PyTorch, diffusers>=0.41.0, transformers>=5.3.0, numpy, pillow and scikit-image. The example also uses trimesh to save the mesh.

Licensing

The blocks are Apache-2.0. This repository contains no model weights. The weights are under the Tencent Hunyuan 3D 2.0 Community License; see the LICENSE and NOTICE in each model repository. Powered by Tencent Hunyuan.

Usage

The example uses trust_remote_code=True, which loads these blocks, and trust_components_code=True, which allows the model repository's custom classes.

Note: both flags run Python code downloaded from the Hub: trust_remote_code=True runs the code of the blocks repository, and trust_components_code=True runs the code shipped in the components_repo. Only use them with repositories you trust, and review their code before passing different ones.

import torch
import trimesh
from diffusers import ModularPipelineBlocks
from diffusers.utils import load_image


blocks = ModularPipelineBlocks.from_pretrained(
    "OzzyGT/hunyuan3d_2mini_custom_blocks",
    trust_remote_code=True,
    components_repo="OzzyGT/hunyuan3d_2mini_turbo",
    trust_components_code=True,
)
pipe = blocks.init_pipeline()
pipe.load_components(dtype=torch.float16)
pipe.to("cuda")

image = load_image(
    "https://huggingface.co/datasets/OzzyGT/diffusers-examples/resolve/main/hunyuan3d_2mini/20261016231355.png",
    convert_method=lambda image: image.convert("RGBA"),
)
mesh = pipe(
    image=image,
    num_inference_steps=30,
    octree_resolution=380,
    generator=torch.Generator().manual_seed(42),
    output="meshes",
)[0]
trimesh.Trimesh(mesh["vertices"], mesh["faces"]).export("shape.glb")

The input is an image of a single object with a transparent background: the object is cropped by its alpha channel and centered on a white canvas. octree_resolution sets the size of the grid the mesh is extracted from; higher values give finer meshes with more triangles.

To use another checkpoint, pass its repository as components_repo. The base checkpoint takes its guidance scale from the guider: pipe.update_components(guider=pipe.guider.new(guidance_scale=5.0)).

Downloads last month
15
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for OzzyGT/hunyuan3d_2mini_custom_blocks

Finetuned
(5)
this model

Spaces using OzzyGT/hunyuan3d_2mini_custom_blocks 2