TRELLIS text-conditioned ONNX

ONNX builds of TRELLIS text-conditioned, made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each precision is one folder holding the graphs and a small Python pipeline.py that does the rest (image preprocessing, the sampling loop, mesh extraction); what the graphs take and return is under How to run.

Files

The last column is the benchmark against the original PyTorch model (details under How to run): how closely each mesh matches the original's, made from the same pictures and the same starting noise.

Precision File Size sha256 Benchmark
fp16 fp16/LICENSE-CLIP.txt 1.1 kB 987e63b32f6c teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/LICENSE-FlexiCubes.txt 11.6 kB 49bbe9114e49 teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/LICENSE-TRELLIS.txt 1.2 kB 9906940f61b1 teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/clip.onnx 0.2 MB de594e18e59c teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/clip.onnx.data 492.2 MB ab7f2bbbdf2c teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/flexicubes_tables.npz 2.6 kB 1d22bf7f2ec2 teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/mesh_dec.onnx 0.5 MB bb626eec211d teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/mesh_dec.onnx.data 181.9 MB 14dd1588a5d4 teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/pipeline.py 20.1 kB 9ed71e95bb29 teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/slat_flow.onnx 2.2 MB 8195f26ecb50 teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/slat_flow.onnx.data 2.15 GB 77ce93aabe1b teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/ss_dec.onnx 39.2 kB 23afc83ea18f teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/ss_dec.onnx.data 147.6 MB c092fd40b354 teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/ss_flow.onnx 1.8 MB a84c914cd585 teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/ss_flow.onnx.data 1.98 GB 8a4c36a48cad teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
fp16 fp16/tokenizer.json 2.2 MB a83e0809aa4c teacher forced: voxel IoU 0.9997 / 1.000 / 0.989 (floor 0.141 / 1.000 / 0.994), latent SNR 60.6 / 59.4 / 58.8 dB (floor 58.5 / 56.2 / 52.9), mesh F-score@0.005 0.9998 / 0.9995 / 0.977 (floor the same); end to end 0.989 / 0.9996 / 0.900; ~65 s per mesh from launch (CUDA; original ~25 s inference)
int8 int8/LICENSE-CLIP.txt 1.1 kB 987e63b32f6c experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/LICENSE-FlexiCubes.txt 11.6 kB 49bbe9114e49 experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/LICENSE-TRELLIS.txt 1.2 kB 9906940f61b1 experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/clip.onnx 0.2 MB de594e18e59c experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/clip.onnx.data 492.2 MB ab7f2bbbdf2c experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/flexicubes_tables.npz 2.6 kB 1d22bf7f2ec2 experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/mesh_dec.onnx 0.5 MB bb626eec211d experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/mesh_dec.onnx.data 181.9 MB 14dd1588a5d4 experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/pipeline.py 20.1 kB 9ed71e95bb29 experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/slat_flow.onnx 2.4 MB d3848ac1f8fc experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/slat_flow.onnx.data 1.14 GB 51628bd0586e experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/ss_dec.onnx 39.2 kB 23afc83ea18f experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/ss_dec.onnx.data 147.6 MB c092fd40b354 experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/ss_flow.onnx 1.9 MB 72a9601ae064 experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/ss_flow.onnx.data 1.06 GB e6f848d2f585 experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh
int8 int8/tokenizer.json 2.2 MB a83e0809aa4c experimental: flows 8-bit: voxel IoU 0.934 / 0.995 / 0.983, latent SNR 29.9 / 29.9 / 33.2 dB, end to end 0.920 / 0.998 / 0.952; ~65 s per mesh

How to run

TRELLIS text-to-3D, xlarge (Microsoft: a text prompt to a 3D mesh with vertex colours) as five ONNX graphs plus pipeline.py, a numpy runtime that reproduces the official TrellisTextTo3DPipeline (github.com/microsoft/TRELLIS).

What runs. TRELLIS works on sparse voxels:

  • Text features: CLIP ViT-L/14 encodes the prompt and the empty prompt (for classifier-free guidance).
  • Structure: a flow transformer (1.1B) samples a 16^3 x 8 latent, and a convolutional decoder turns it into a 64^3 occupancy grid. Its occupied voxels (typically 5-15 thousand) are the structure.
  • Latent: a second flow transformer (1.1B) samples 8 latent features per voxel.
  • Mesh: the mesh decoder subdivides each voxel twice (to 256^3) and predicts FlexiCubes parameters, from which pipeline.py extracts the mesh.

The weights are from three repositories, as the official pipeline loads them:

  • microsoft/TRELLIS-text-xlarge: the two flows;
  • microsoft/TRELLIS-image-large: the structure decoder and the mesh decoder;
  • openai/clip-vit-large-patch14: the text encoder and its tokenizer.

The Gaussian-splat and radiance-field decoders and the textured-GLB baking (which needs nvdiffrast) aren't included. The meshes carry the decoder's own vertex colours.

The graphs. Sparse operations can't be expressed directly in ONNX, so pipeline.py builds index tables from the voxel coordinates in numpy and the graphs use them:

  • a submanifold 3x3x3 convolution is 27 gathers of neighbour features times the kernel slices;
  • pooling and its inverse are gathers;
  • the mesh decoder's Swin attention runs as padded per-window batches.

Same arithmetic as spconv and xformers in the original.

Graph Inputs Output
clip.onnx input_ids [1, 77] [1, 77, 768] (fp32, as the original)
ss_flow.onnx x [B, 8, 16, 16, 16], t [B] (1000 t), cond [B, 77, 768] velocity
ss_dec.onnx z [1, 8, 16, 16, 16] occupancy logits [1, 1, 64, 64, 64]
slat_flow.onnx feats [N, 8], t, cond, tables velocity [N, 8]
mesh_dec.onnx slat [N, 8], tables FlexiCubes features [64 N, 101]
import sys
sys.path.insert(0, "fp16")
import pipeline
t = pipeline.TrellisText("fp16", "cuda")
v, f, attrs = t("A chair looking like a avocado.", seed=1)
pipeline.save_mesh("chair.glb", v, f, attrs)         # y-up, vertex colours

Or python fp16/pipeline.py "A wooden stool" stool.glb --cuda --seed 1. It needs numpy, onnxruntime-gpu and tokenizers; trimesh to save.

Ported as the original behaves.

  • Sampler: 25 Euler steps per stage, the time schedule rescaled by 3, guidance 7.5 only for t in [0.5, 0.95].
  • Tokenizer: the prompt ids match the original tokenizer's.
  • FlexiCubes: ported to numpy from TRELLIS's copy of NVIDIA FlexiCubes (Apache-2.0, LICENSE-FlexiCubes.txt; lookup tables in flexicubes_tables.npz). It visits only the cubes that can hold the surface instead of the original's dense 256^3 grid. On the same decoder output it gives the original's mesh: same faces, vertices within 1e-7.
  • Noise: pipeline.py draws its own noise with numpy, so a seed gives a different shape than the original's; ss_noise= and slat_noise= take your own.
  • Graph optimization: sessions use the basic level and are loaded one at a time.

Running it.

  • Memory: about 5-7 GB of system memory at the peak on Windows (GPU allocations count toward it). The original needed 9-12 GB here for the same prompts.
  • Time: an RTX 3080 Laptop GPU takes about 65 s per mesh from launch with fp16/ or int8/. That is about 45-55 s of inference: structure 22 s, latent 14-21 s, mesh 6-9 s. The original (PyTorch with xformers and spconv) takes about 25 s of inference.
  • Large shapes: shapes with very many voxels (a box-like chest made 38k) make the mesh stage large. The original ran out of memory on this 16 GB machine for such a shape.
  • cuDNN log lines: on CUDA, ONNX Runtime may print cuDNN "No execution plans support the graph" errors while it picks an algorithm for the structure decoder's 3-D convolutions. They are harmless.

Precisions.

  • fp16/: the flows and decoders fp16 as the original runs them (its LayerNorms and embedders fp32); CLIP fp32.
  • int8/, experimental: both flows' MatMuls 8-bit MatMulNBits (block 32); the rest as fp16/. It is below the pass mark on the latent stage (below). The shapes stay close end to end.
  • No int4: tried (both flows 4-bit) and far below the pass mark (latent SNR 7 dB, end-to-end F-score 0.69 on the avocado). No bf16: fp16 passes.

Benchmark.

  • Prompts: three, 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).
  • Original: TrellisTextTo3DPipeline (GitHub @ 193e050) in fp16 on CUDA, as it runs, every intermediate saved.
  • Teacher forced: TRELLIS's sampler is chaotic. With the same noise, the original in fp32 keeps only 14 % of its fp16 voxels on the avocado. So each stage is fed the original's own inputs (condition, noise, voxels, latent) and scored against the original's output:
    • structure: voxel IoU;
    • latent: SNR;
    • mesh: F-score at 0.005 (0.5 % of the shape's extent) on 200k surface samples.
  • End to end: from the prompt with the original's noise.
  • Pass mark: each stage at least as close as the original's own fp32 run of that stage, on the same inputs (the mean over the prompts).
structure: voxel IoU latent: SNR mesh: F-score end to end: F-score
original in fp32 (the floor) 0.141 / 1.000 / 0.994 58.5 / 56.2 / 52.9 dB 0.9998 / 0.9995 / 0.977 -
fp16/ 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
int8/ (experimental) 0.934 / 0.995 / 0.983 29.9 / 29.9 / 33.2 dB 0.9998 / 0.9995 / 0.977 0.920 / 0.998 / 0.952
int4 (not published) 0.807 / 0.942 / - 6.9 / 7.5 / - dB (decoders as fp16) 0.694 / 0.985 / -

Columns are avocado / teapot / robot.

  • The mesh column: the decoders are the same fp16 graphs in every build. Their mesh matches the original's as closely as the original's own fp32 decoder does.
  • The robot's end-to-end score: its structure keeps 99 % of the voxels, and the 1 % that differ change the details the latent stage builds on them.
  • int4 on the robot: its run needed more memory than this machine allows and was stopped.

Before the benchmark each graph was checked against its PyTorch module on real inputs (cosine):

  • CLIP: 1.0;
  • structure flow: 0.999998;
  • structure decoder: 1.0;
  • latent flow: 0.9999996;
  • mesh decoder: largest difference 0.46 of 16.6, against 0.39 for the patched modules themselves (fp16 attention order).

License. TRELLIS (code and weights) and CLIP are MIT (LICENSE-TRELLIS.txt, LICENSE-CLIP.txt); the FlexiCubes port is Apache-2.0.

How these were made

From TRELLIS text-conditioned at revision e0b00432b8. The graphs were exported from the original PyTorch modules with torch.onnx (opset 17 / 18) and checked against them. Weight-only quantization: int8 is a per-output-channel int8 weight behind DequantizeLinear, int4 is ONNX Runtime's MatMulNBits (block 32). Each card above says which precision every graph uses. Every precision was benchmarked against the original before upload (the pass mark is under How to run), 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/

Code: https://github.com/Microsoft/TRELLIS

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for moonbox-dev/TRELLIS-text-xlarge-ONNX

Quantized
(1)
this model

Paper for moonbox-dev/TRELLIS-text-xlarge-ONNX