Instructions to use moonbox-dev/TRELLIS-text-xlarge-TensorRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use moonbox-dev/TRELLIS-text-xlarge-TensorRT with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Trellis
How to use moonbox-dev/TRELLIS-text-xlarge-TensorRT with Trellis:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download README.md from moonbox-dev/TRELLIS-text-xlarge-TensorRT: direct link, hf CLI and curl.
- Browser
- Download file 12.5 kB
-
https://huggingface.co/moonbox-dev/TRELLIS-text-xlarge-TensorRT/resolve/main/README.md
- Command line
-
hf download hf://moonbox-dev/TRELLIS-text-xlarge-TensorRT/README.md
-
curl -L -o README.md https://huggingface.co/moonbox-dev/TRELLIS-text-xlarge-TensorRT/resolve/main/README.md
base_model: microsoft/TRELLIS-text-xlarge
base_model_relation: quantized
license: mit
pipeline_tag: text-to-3d
library_name: tensorrt
tags:
- tensorrt
- moonbox
- trellis
- text-to-3d
- 3d
- mesh
- flow-matching
- sparse-voxels
TRELLIS text-conditioned TensorRT
TensorRT engines of TRELLIS text-conditioned, 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-CLIP.txt |
1.1 kB | 987e63b32f6c |
teacher forced: voxel IoU 0.9994 / 0.9992 / 0.987 (ONNX fp16 0.9997 / 1.000 / 0.989), latent SNR 56.1 / 57.3 / 55.1 dB (60.6 / 59.4 / 58.8; floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (the same); end to end 0.979 / 0.996 / 0.929; 36 / 33 / 42 s of inference per mesh (ONNX fp16 49 / 43 / 53 s) |
| fp16 | fp16/LICENSE-FlexiCubes.txt |
11.6 kB | 49bbe9114e49 |
(the same build: numbers in its first row) |
| fp16 | fp16/LICENSE-TRELLIS.txt |
1.2 kB | 9906940f61b1 |
(the same build: numbers in its first row) |
| fp16 | fp16/clip.engine |
541.2 MB | f718ff7a9242 |
(the same build: numbers in its first row) |
| fp16 | fp16/device_chain.py |
8.3 kB | e675d2e7e2d1 |
(the same build: numbers in its first row) |
| fp16 | fp16/flexicubes_tables.npz |
2.6 kB | 1d22bf7f2ec2 |
(the same build: numbers in its first row) |
| fp16 | fp16/mesh_dec.engine |
343.8 MB | f0a66b70c0c5 |
(the same build: numbers in its first row) |
| fp16 | fp16/pipeline.py |
20.1 kB | 9ed71e95bb29 |
(the same build: numbers in its first row) |
| fp16 | fp16/pipeline_trt.py |
3.6 kB | 3e19c49263a4 |
(the same build: numbers in its first row) |
| fp16 | fp16/slat_flow_0.engine |
768.5 MB | 68c6df2aaa35 |
(the same build: numbers in its first row) |
| fp16 | fp16/slat_flow_1.engine |
762.0 MB | 24eb5d282741 |
(the same build: numbers in its first row) |
| fp16 | fp16/slat_flow_2.engine |
762.1 MB | 042823d65d09 |
(the same build: numbers in its first row) |
| fp16 | fp16/slat_flow_3.engine |
118.9 MB | 32789e8ce5bb |
(the same build: numbers in its first row) |
| fp16 | fp16/slat_flow_split.json |
1.2 kB | 6cceaed7b353 |
(the same build: numbers in its first row) |
| fp16 | fp16/ss_dec.engine |
201.7 MB | 89a8879dd781 |
(the same build: numbers in its first row) |
| fp16 | fp16/ss_flow_0.engine |
732.1 MB | 628eb7c29859 |
(the same build: numbers in its first row) |
| fp16 | fp16/ss_flow_1.engine |
775.5 MB | 3734f34e212d |
(the same build: numbers in its first row) |
| fp16 | fp16/ss_flow_2.engine |
703.1 MB | f4fffb196bea |
(the same build: numbers in its first row) |
| fp16 | fp16/ss_flow_split.json |
0.7 kB | bdd70b22cbea |
(the same build: numbers in its first row) |
| fp16 | fp16/tokenizer.json |
2.2 MB | a83e0809aa4c |
(the same build: numbers in its first row) |
| fp16 | fp16/trt_runner.py |
4.4 kB | cbc9abb1f59c |
(the same build: numbers in its first row) |
How to run
TRELLIS text-to-3D, xlarge (Microsoft: a text prompt to a 3D mesh with vertex colours) as TensorRT engines built from
this model's fp16 ONNX graphs, plus pipeline_trt.py. The pipeline is the ONNX build's pipeline.py (a numpy port
of the official TrellisTextTo3DPipeline: CLIP features, two flow-matching stages on sparse voxels, the mesh decoder
and FlexiCubes in numpy) with every graph run as engines.
import sys
sys.path.insert(0, "fp16")
from pipeline_trt import TrellisTextTrt
from pipeline import save_mesh
t = TrellisTextTrt("fp16")
v, f, attrs = t("A chair looking like a avocado.", seed=1)
save_mesh("chair.glb", v, f, attrs) # y-up, vertex colours
Or python fp16/pipeline_trt.py "A wooden stool" stool.glb --seed 1. It needs numpy, tokenizers, TensorRT 10.13
(tensorrt-cu12 or tensorrt-lean-cu12) and Polygraphy; trimesh to save. No PyTorch and no ONNX Runtime. The engines
are version-compatible and built for Ampere or newer GPUs (RTX 30-series and up). They hold 5.7 GB; the benchmark's
process peaked at 6.5-6.9 GB of memory, GPU memory included (the ONNX fp16 build: about 5-7 GB). About a quarter
faster than the ONNX fp16 build: 33-42 s of inference per mesh against 43-53 s.
The engines. As in the ONNX build, pipeline_trt.py builds the sparse operations' index tables from the voxel
coordinates in numpy (a submanifold convolution is 27 gathers of neighbour features times the kernel slices; pooling
is gathers; the mesh decoder's Swin attention runs as padded per-window batches).
| Engines | Inputs | Output |
|---|---|---|
clip.engine |
input_ids [1, 77] |
[1, 77, 768] (fp32, as the original) |
ss_flow_0..2.engine |
x [B, 8, 16, 16, 16], t [B] (1000 t), cond [B, 77, 768] (B <= 2) |
velocity |
ss_dec.engine |
z [1, 8, 16, 16, 16] |
occupancy logits [1, 1, 64, 64, 64] |
slat_flow_0..3.engine |
feats [N, 8], t, cond, tables |
velocity [N, 8] |
mesh_dec.engine |
slat [N, 8], tables |
FlexiCubes features [64 N, 101] |
The flows (2.2 GB each) are cut into pieces of at most 0.7 GB of weights, so that each engine builds within the
build machine's memory; ss_flow_split.json / slat_flow_split.json give the order and the tensors passed between
pieces, which stay on the GPU. A stage's engines are loaded when it starts and released when it ends, as the ONNX
build does with its sessions.
Limits. Up to 16,384 occupied voxels (the benchmark's prompts: 7,573 - 13,064); the mesh decoder's Swin windows (8^3 voxels) up to 320 occupied windows of up to 384 voxels each (the prompts: up to 199 windows, 297 voxels). A larger shape raises an error naming the limit.
Changes from the ONNX graphs.
- The flows' attention, exported as ONNX Runtime's
com.microsoftMultiHeadAttention, written as standard ops (MatMul, Softmax, MatMul), which TensorRT fuses into its own attention kernels. - The mesh decoder's sparse convolutions: each neighbour slice's gather waits on the partial sum before it (the same output; checked identical in ONNX Runtime). TensorRT would otherwise gather all 27 slices at once: 11.6 GB at the voxel limit.
- CLIP built without TF32, as the ONNX build runs it.
Everything else is strongly typed: every tensor keeps the precision the ONNX graph gives it (the flows and decoders
fp16 with their LayerNorms and embedders fp32, CLIP fp32). No int8: TensorRT's int8 needs calibrated activations, and
the ONNX int8/ build is weight-only MatMulNBits, which TensorRT doesn't take.
Benchmark.
- Setup: the ONNX build's benchmark. Three prompts with the original's seeds: the README's "A chair looking like a avocado." (seed 1), "A ceramic teapot with a curved spout and a round lid." (7), "A small red toy robot with round eyes and antenna." (42). RTX 3080 Laptop GPU.
- Teacher forced: TRELLIS's sampler is chaotic, so each stage is fed the original's own inputs (condition, noise,
voxels, latent) and scored against the original's output (
TrellisTextTo3DPipelinein fp16 on CUDA): structure voxel IoU, latent SNR, mesh F-score at 0.005 on 200k surface samples. The floor is the original's own fp32 run of each stage on the same inputs. - End to end: from the prompt with the original's noise (not gated: one different voxel changes what the latent stage builds).
- Pass mark (set before the first run): per prompt, voxel IoU and mesh F-score at most 0.01 below, and latent SNR at most 3 dB below, the lower of the ONNX fp16 build and the floor.
| structure: voxel IoU | latent: SNR | mesh: F-score | end to end: F-score | seconds of inference | |
|---|---|---|---|---|---|
| original in fp32 (the floor) | 0.141 / 1.000 / 0.994 | 58.5 / 56.2 / 52.9 dB | 0.9998 / 0.9995 / 0.977 | - | - |
ONNX fp16/ (ONNX Runtime CUDA) |
0.9997 / 1.000 / 0.989 | 60.6 / 59.4 / 58.8 dB | 0.9998 / 0.9995 / 0.977 | 0.989 / 0.9996 / 0.900 | 49 / 43 / 53 |
TensorRT fp16/ |
0.9994 / 0.9992 / 0.987 | 56.1 / 57.3 / 55.1 dB | 0.9998 / 0.9995 / 0.977 | 0.979 / 0.996 / 0.929 | 36 / 33 / 42 |
Columns are avocado / teapot / robot. The seconds add up the stages (text features, structure, latent, mesh decoder, FlexiCubes), each including its engines' loading; per stage the TensorRT build takes 14 s for the structure (ONNX 22-25 s) and 9-13 s for the latent (14-22 s).
License. TRELLIS (code and weights) and CLIP are MIT (LICENSE-TRELLIS.txt, LICENSE-CLIP.txt); the FlexiCubes
port is Apache-2.0 (LICENSE-FlexiCubes.txt).
How these were made
From TRELLIS text-conditioned at revision e0b00432b8: 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
MIT. 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
TRELLIS Text XL
The text conditioned version of TRELLIS with model size XL, a large 3D genetive model. It was introduced in the paper Structured 3D Latents for Scalable and Versatile 3D Generation.
Project page: https://trellis3d.github.io/