Image-to-3D
TensorRT
moonbox
hunyuan3d
hunyuan3d-2.1
3d
mesh
flow-matching

Run this model with HF Jobs

Run moonbox-dev/Hunyuan3D-2.1-TensorRT on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT. Ask me which dataset to train on, then push the fine-tuned model to a new private model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
jennyxue's picture
Model card and the original license
874b3b6 verified
|
Raw History Blame Contribute Delete
16.5 kB
---
base_model: tencent/Hunyuan3D-2.1
base_model_relation: quantized
license: other
license_name: tencent-hunyuan-community
license_link: LICENSE
extra_gated_eu_disallowed: true
extra_gated_heading: "Accept the Tencent Hunyuan 3D 2.1 Community License Agreement to access these files"
extra_gated_prompt: >-
These files are modified Tencent Hunyuan 3D 2.1 Works, licensed under the Tencent Hunyuan 3D 2.1 Community
License Agreement (LICENSE.txt in every folder), including its Acceptable Use Policy (Exhibit A). The license
does not apply in the European Union, the United Kingdom or South Korea: you may not use, reproduce, modify,
distribute or display these files or their outputs there (Section 5.c). Products or services with more than
1 million monthly active users need a separate license from Tencent (Section 4).
extra_gated_fields:
I have read and accept the Tencent Hunyuan 3D Community License Agreement (LICENSE) and its Acceptable Use Policy: checkbox
I am not located in, and will not use these files or their outputs in, the European Union, the United Kingdom or South Korea: checkbox
extra_gated_button_content: "Accept and access"
pipeline_tag: image-to-3d
library_name: tensorrt
tags:
- tensorrt
- moonbox
- hunyuan3d
- hunyuan3d-2.1
- image-to-3d
- 3d
- mesh
- flow-matching
---
# Hunyuan3D-2.1 TensorRT
TensorRT engines of [Hunyuan3D-2.1](https://huggingface.co/tencent/Hunyuan3D-2.1), made by Moonbox for NVIDIA RTX GPUs. Each precision is one folder holding the
engine, `trt_runner.py` (a small numpy runner: TensorRT plus Polygraphy, no PyTorch) and a script that does the rest
of the pipeline. What the engine takes and returns is under *How to run*.
**Compatibility.** The engines are built *hardware compatible* (Ampere and newer: RTX 30, 40 and 50 series) and
*version compatible* (any TensorRT 10.x from 10.13 on, through its lean runtime). That costs a little speed against an
engine built for one GPU, but no rebuild is needed. Install the runtime with
`pip install "tensorrt-cu12>=10.13,<11" "tensorrt-lean-cu12>=10.13,<11" polygraphy numpy`.
## Files
The last column is the benchmark (details under *How to run*).
| Precision | File | Size | sha256 | Benchmark |
|---|---|---|---|---|
| fp16 | [`fp16/LICENSE.txt`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/LICENSE.txt) | 17.9 kB | `5bd08f93b2d2` | F-score@0.01 vs the original's mesh 0.9998 / 0.940 / 0.997 (ONNX fp16 0.999 / 0.950 / 0.995; original bf16 0.836 / 0.896 / 0.968); VAE + occupancy alone 0.9999 / 0.985 / 0.9999, grid IoU vs the ONNX fp16 build 0.9999 / 0.9997 / 0.9998; ~160 s per mesh (ONNX fp16 ~290 s) |
| fp16 | [`fp16/NOTICE.txt`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/NOTICE.txt) | 0.4 kB | `a2a58de0528f` | (the same build: numbers in its first row) |
| fp16 | [`fp16/TENCENT_NOTICE.txt`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/TENCENT_NOTICE.txt) | 16.6 kB | `ffccf6b539a8` | (the same build: numbers in its first row) |
| fp16 | [`fp16/cond.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/cond.engine) | 687.7 MB | `3d926086c3b0` | (the same build: numbers in its first row) |
| fp16 | [`fp16/device_chain.py`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/device_chain.py) | 8.3 kB | `e675d2e7e2d1` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_0.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_0.engine) | 636.7 MB | `8a0f20fefcc6` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_1.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_1.engine) | 699.7 MB | `460962c69e60` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_2.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_2.engine) | 767.3 MB | `6f996bdc6fa4` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_3.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_3.engine) | 732.8 MB | `cb5264903868` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_4.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_4.engine) | 738.3 MB | `f533cb2a6548` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_5.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_5.engine) | 738.3 MB | `4bd7f0a2267e` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_6.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_6.engine) | 738.3 MB | `6bb839bf13f0` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_7.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_7.engine) | 738.3 MB | `9a20d85f5dc6` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_8.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_8.engine) | 738.3 MB | `dbc88a897170` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_9.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_9.engine) | 181.6 MB | `5175f88681ed` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit_split.json`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/dit_split.json) | 5.1 kB | `16fc6873af38` | (the same build: numbers in its first row) |
| fp16 | [`fp16/geo.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/geo.engine) | 73.1 MB | `72c6d36253a9` | (the same build: numbers in its first row) |
| fp16 | [`fp16/pipeline.py`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/pipeline.py) | 8.0 kB | `c67147d8fa9d` | (the same build: numbers in its first row) |
| fp16 | [`fp16/pipeline_trt.py`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/pipeline_trt.py) | 3.3 kB | `36053950b0bf` | (the same build: numbers in its first row) |
| fp16 | [`fp16/trt_runner.py`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/trt_runner.py) | 4.4 kB | `cbc9abb1f59c` | (the same build: numbers in its first row) |
| fp16 | [`fp16/vae.engine`](https://huggingface.co/moonbox-dev/Hunyuan3D-2.1-TensorRT/blob/main/fp16/vae.engine) | 490.5 MB | `8a7d4845666a` | (the same build: numbers in its first row) |
## How to run
Hunyuan3D-2.1's shape model (Tencent: one image to a 3D mesh; a 3.3B flow-matching DiT with mixture-of-experts layers
over a ShapeVAE's latents, conditioned on DINOv2 image features) as TensorRT engines built from this model's fp16 ONNX
graphs, plus `pipeline_trt.py`. The pipeline is the ONNX build's `pipeline.py` (the official
`Hunyuan3DDiTFlowMatchingPipeline` ported to numpy) with every graph run as engines. The texture (PBR paint) model is
not included: the meshes come out untextured.
**License limits.** The Tencent Hunyuan 3D 2.1 Community License (`LICENSE.txt` in the folder) **does not apply in the
European Union, the United Kingdom or South Korea**: these files and their outputs may not be used there. Its
Acceptable Use Policy applies, and products or services with more than 1 million monthly active users need a separate
license from Tencent. Access is gated on accepting it. `NOTICE.txt` carries the required notice; `TENCENT_NOTICE.txt`
is the original's `Notice.txt` (its third-party components).
```python
import sys
from PIL import Image
sys.path.insert(0, "fp16")
import trimesh
from pipeline_trt import Hunyuan3DShapeTrt
hy = Hunyuan3DShapeTrt("fp16")
v, f = hy(Image.open("object_rgba.png"), seed=1234)
trimesh.Trimesh(v, f).export("object.glb")
```
Or `python fp16/pipeline_trt.py object_rgba.png object.glb --seed 1234`. It needs numpy, opencv-python,
scikit-image, Pillow, TensorRT 10.13 (`tensorrt-cu12` or `tensorrt-lean-cu12`) and Polygraphy; trimesh saves the mesh.
No PyTorch and no ONNX Runtime. The input is an RGBA picture with the object matted (or RGB, used whole), as for the
ONNX build. The engines are version-compatible and built for Ampere or newer GPUs (RTX 30-series and up).
**The engines.**
- `cond.engine`: DINOv2-L, `image` [1, 3, 512, 512] in [-1, 1] -> `cond` [1, 1370, 1024].
- `dit_0..9.engine`: the DiT (`dit_split.json`), `latents` [2, 4096, 64], `t` [2], `cond` [2, 1370, 1024] ->
`velocity`: the guidance pair (the condition and an all-zero one) in one batch. Cut into pieces of at most 0.7 GB of
weights, so that each engine builds within the build machine's memory; the tensors between pieces stay on the GPU.
The MoE layers run every expert weighted by the gate (zero outside the top 2), as in the ONNX graph.
- `vae.engine`: `latents` [1, 4096, 64] -> `decoded` [1, 4096, 1024], once per mesh.
- `geo.engine`: `queries` [1, N, 3] (N <= 16,384), `latents` (`decoded`) -> occupancy `logits` [1, N]. The 385^3 grid
is queried in chunks of 16,384 points (the ONNX pipeline: 8,000; each point is computed on its own).
Each graph's engines are loaded for its stage and released after it, as the ONNX build does with its sessions.
**Changes from the ONNX graphs.** The attention, exported as ONNX Runtime's `com.microsoft` MultiHeadAttention, is
written as standard ops (MatMul, Softmax, MatMul), which TensorRT fuses into its own attention kernels. Everything else
is strongly typed: every tensor keeps the precision the ONNX graph gives it (fp16, as the original runs). No int8:
TensorRT's int8 needs calibrated activations, and the ONNX `int8/` build is weight-only `MatMulNBits`, which TensorRT
doesn't take.
**Running it.** On an RTX 3080 Laptop GPU a mesh takes about 160 s: about 87 s for the 100 DiT evaluations and 67 s
for the 385^3 occupancy grid (the ONNX fp16 build: about 290 s, 110 s + 170 s; the original PyTorch pipeline about
145 s). It needs more memory than the ONNX build: the benchmark's process peaked at 11.5-11.7 GB of system memory on
Windows, GPU memory included (the ONNX fp16 build: 7-9 GB), as the DiT's engines (6.7 GB) are all loaded during
sampling. The engines hold 8.0 GB.
**Benchmark.**
- **Setup:** the ONNX build's benchmark. The repository's demo picture and two of its example pictures (052, 1008),
seed 1234, 50 steps, guidance 5, the original's own starting noise, the same 385^3 grid extraction for both sides.
- **Original:** `Hunyuan3DDiTFlowMatchingPipeline` (GitHub @ 82920d6) in float16 on CUDA, as it runs.
- **Score:** F-score at 0.01 between each mesh and the original's, on 200k surface samples (the shapes span about 2
units). Also the latents' SNR against the original's and, from the original's latents, the VAE and occupancy engines
alone.
- **Pass mark** (set before the first run), per picture against the ONNX fp16 build: condition cosine within 0.0001,
latent SNR at most 3 dB lower, the VAE + occupancy F-score at most 0.01 lower, the end-to-end F-score at most 0.03
lower, and grid IoU from the original's latents at most 0.005 lower. The original's own grids were no longer kept
when the engines were benchmarked, so that IoU is against the ONNX fp16 build's grid instead (at least 0.995).
| | F-score: demo / 052 / 1008 | latent SNR (dB) | VAE + occupancy alone: F-score | seconds per mesh |
|---|---|---|---|---|
| original in bf16 (PyTorch, CUDA) | 0.836 / 0.896 / 0.968 | - | - | - |
| ONNX `fp16/` (ONNX Runtime CUDA) | 0.999 / 0.950 / 0.995 | 20.7 / 12.5 / 14.9 | 0.9999 / 0.985 / 0.9999 | ~290 |
| TensorRT `fp16/` | 0.9998 / 0.940 / 0.997 | 21.0 / 12.4 / 15.2 | 0.9999 / 0.985 / 0.9999 | ~160 |
From the original's latents the TensorRT engines' grid matches the ONNX fp16 build's at IoU 0.9999 / 0.9997 / 0.9998.
The latent SNR is low for every build because 50 guided steps amplify small differences; the original's own bf16 run
is further from its fp16 run, by F-score, than either build.
## How these were made
From [Hunyuan3D-2.1](https://huggingface.co/tencent/Hunyuan3D-2.1) at revision `0b94677654`: each engine was built with TensorRT's builder from Moonbox's published
ONNX graph of the same model and precision. The network is *strongly typed*: every tensor keeps the precision the
ONNX graph gives it, so an fp16 engine computes what the fp16 ONNX build computes. Built on an RTX 3080 Laptop GPU,
it was benchmarked against the original before upload, and the `sha256` column above is what the files must hash to.
## License
Tencent Hunyuan Community (region-restricted). These files are a derivative of the original model and carry its license: it is copied in this
repository, and it governs your use of these files. The original model card follows unchanged.
---
# Original model card
<p align="center">
<img src="https://raw.githubusercontent.com/Tencent-Hunyuan/Hunyuan3D-2.1/refs/heads/main/assets/images/teaser.jpg">
</p>
<div align="center">
<a href=https://3d.hunyuan.tencent.com target="_blank"><img src=https://img.shields.io/badge/Hunyuan3D-black.svg?logo=homepage height=22px></a>
<a href=https://huggingface.co/spaces/tencent/Hunyuan3D-2.1 target="_blank"><img src=https://img.shields.io/badge/%F0%9F%A4%97%20Demo-276cb4.svg height=22px></a>
<a href=https://huggingface.co/tencent/Hunyuan3D-2.1 target="_blank"><img src=https://img.shields.io/badge/%F0%9F%A4%97%20Models-d96902.svg height=22px></a>
<a href=https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1 target="_blank"><img src= https://img.shields.io/badge/Page-bb8a2e.svg?logo=github height=22px></a>
<a href=https://discord.gg/GuaWYwzKbX target="_blank"><img src= https://img.shields.io/badge/Discord-white.svg?logo=discord height=22px></a>
<a href=https://arxiv.org/abs/2506.15442 target="_blank"><img src=https://img.shields.io/badge/Report-b5212f.svg?logo=arxiv height=22px></a>
</div>
## 🔗 BibTeX
If you found this repository helpful, please cite our report:
```bibtex
@misc{hunyuan3d2025hunyuan3d,
title={Hunyuan3D 2.1: From Images to High-Fidelity 3D Assets with Production-Ready PBR Material},
author={Team Hunyuan3D and Shuhui Yang and Mingxin Yang and Yifei Feng and Xin Huang and Sheng Zhang and Zebin He and Di Luo and Haolin Liu and Yunfei Zhao and Qingxiang Lin and Zeqiang Lai and Xianghui Yang and Huiwen Shi and Zibo Zhao and Bowen Zhang and Hongyu Yan and Lifu Wang and Sicong Liu and Jihong Zhang and Meng Chen and Liang Dong and Yiwen Jia and Yulin Cai and Jiaao Yu and Yixuan Tang and Dongyuan Guo and Junlin Yu and Hao Zhang and Zheng Ye and Peng He and Runzhou Wu and Shida Wei and Chao Zhang and Yonghao Tan and Yifu Sun and Lin Niu and Shirui Huang and Bojian Zheng and Shu Liu and Shilin Chen and Xiang Yuan and Xiaofeng Yang and Kai Liu and Jianchen Zhu and Peng Chen and Tian Liu and Di Wang and Yuhong Liu and Linus and Jie Jiang and Jingwei Huang and Chunchao Guo},
year={2025},
eprint={2506.15442},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{hunyuan3d22025tencent,
title={Hunyuan3D 2.0: Scaling Diffusion Models for High Resolution Textured 3D Assets Generation},
author={Tencent Hunyuan3D Team},
year={2025},
eprint={2501.12202},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{yang2024tencent,
title={Tencent Hunyuan3D-1.0: A Unified Framework for Text-to-3D and Image-to-3D Generation},
author={Tencent Hunyuan3D Team},
year={2024},
eprint={2411.02293},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
```
## Acknowledgements
We would like to thank the contributors to
the [TripoSG](https://github.com/VAST-AI-Research/TripoSG), [DINOv2](https://github.com/facebookresearch/dinov2), [Stable Diffusion](https://github.com/Stability-AI/stablediffusion), [FLUX](https://github.com/black-forest-labs/flux), [diffusers](https://github.com/huggingface/diffusers)
and [HuggingFace](https://huggingface.co) repositories, for their open research and exploration.
## Star History
<a href="https://star-history.com/#Tencent-Hunyuan/Hunyuan3D-2.1&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Tencent-Hunyuan/Hunyuan3D-2.1&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Tencent-Hunyuan/Hunyuan3D-2.1&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Tencent-Hunyuan/Hunyuan3D-2.1&type=Date" />
</picture>
</a>