Instructions to use moonbox-dev/cube3d-v0.5-TensorRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use moonbox-dev/cube3d-v0.5-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
- Notebooks
- Google Colab
- Kaggle
Cube3D TensorRT
TensorRT engines of Cube3D, 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 |
15.1 kB | f0314d152073 |
teacher-forced agreement 73.6 / 77.4 / 63.5 % (ONNX fp16 73.5 / 77.1 / 64.1 %), shape IoU own tokens 0.77 / 0.13 / 0.36, decoder IoU on the original's tokens 0.997 / 0.991 / 0.996; 57-64 s per shape (ONNX fp16 150-168 s) |
| fp16 | fp16/clip_text.engine |
546.6 MB | 7cdea3fca276 |
(the same build: numbers in its first row) |
| fp16 | fp16/device_chain.py |
7.2 kB | 0f471ba19dbd |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_cond_0.engine |
617.7 MB | 3b6c1a44da28 |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_cond_1.engine |
695.8 MB | 54ff295f3615 |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_cond_2.engine |
624.7 MB | 69285ac6ad04 |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_cond_split.json |
1.0 kB | b8812be24952 |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_step_0.engine |
633.1 MB | 2274c3d8692b |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_step_1.engine |
658.8 MB | cafe03acda0a |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_step_2.engine |
582.4 MB | ab98d9bff31b |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_step_3.engine |
240.8 MB | 6644767f5921 |
(the same build: numbers in its first row) |
| fp16 | fp16/gpt_step_split.json |
1.8 kB | b6ae5c77d8be |
(the same build: numbers in its first row) |
| fp16 | fp16/occupancy.engine |
82.5 MB | 265b5c7fb498 |
(the same build: numbers in its first row) |
| fp16 | fp16/pipeline_trt.py |
7.6 kB | 309416c0eb81 |
(the same build: numbers in its first row) |
| fp16 | fp16/shape_decoder.engine |
741.2 MB | e5f302bc0fc7 |
(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
Cube3D v0.5 (Roblox: text-to-shape; an autoregressive GPT over a 1D shape tokenizer, optional bounding box) 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 repository's python -m cube3d.generate: guidance 3.0, greedy decoding, KV cache, resolution
base 8.0) with every graph run as engines. Research use only: the Cube3D Research-Only RAIL-MS licence (below and
fp16/LICENSE.txt).
import sys
sys.path.insert(0, "fp16")
from pipeline_trt import Cube3D, mesh_from_grid
cube = Cube3D("fp16")
v, f = cube("A tall pagoda", bbox=(1.0, 2.0, 1.5)) # vertices [V, 3], faces [F, 3]
Or python fp16/pipeline_trt.py "A tall pagoda" pagoda.obj [--bbox 1.0 2.0 1.5]. It needs numpy, tokenizers,
scikit-image (marching cubes), TensorRT 10.13 (tensorrt-cu12 or tensorrt-lean-cu12) and Polygraphy. No PyTorch
and no ONNX Runtime.
The engines. Together they compute the ONNX fp16/ graphs, except for gpt_step's softmax (see Precisions).
clip_text.engine:input_ids,attention_mask[B, 77] -> CLIP-L's last hidden state [B, 77, 768] (fp32).tokenizer.jsonis CLIP-L's tokenizer.gpt_cond_0..2.engine:text[B, 77, 768],bbox[B, 3] -> the keys / values of the 78 condition tokens for the 23 dual-stream blocks.gpt_step_0..3.engine: one shape token -> logits [B, 16387], the caches extended by one position, and the single block's value of the token. Inputs:token[B, 1],pos[1], the caches [B, 12, 78-1101, 128],v0(the single block's BOS value, empty on the BOS step). B is 1-2.shape_decoder.engine: 1024 token ids -> latents [1, 1024, 768] (fp32).occupancy.engine: up to 6,250 query points [1, N, 3] and the latents -> occupancy logits [1, N] (fp32).gpt_cond_split.json/gpt_step_split.json: the order of the GPT's pieces and the tensors passed between them. The GPT's graphs are cut into pieces of at most 0.7 GB of weights so that each engine builds within the build machine's memory.
On the GPU. The pipeline (device_chain.py) keeps every tensor on the GPU from step to step:
- the caches: each step reads one set of buffers and writes the other, so a step allocates nothing;
- the activations between the GPT's pieces;
- the latents between the decoder and the occupancy head.
Only the tokens go in and the logits come out. The benchmark's process peaked at about 4 GB of memory, host and GPU together.
Precisions. fp16/ is strongly typed: every tensor keeps the precision the ONNX graph gives it, with one change.
gpt_step's attention softmax is computed in fp32, as gpt_cond's already is in the ONNX graphs:
- In the fp16 graph it is fp16. ONNX Runtime's kernel runs it with fp32 arithmetic inside, while TensorRT ran it in fp16.
- In fp16, the engines' logits were 0.17 % from ONNX Runtime's on the same inputs. Classifier-free guidance amplifies that about 7x at guidance 3, and greedy decoding then picked other tokens: teacher-forced agreement was 4-9 points under the ONNX build's.
- With the fp32 softmax the engines agree with the original as closely as the ONNX build does.
No int8: TensorRT's int8 needs calibrated activations, and the ONNX int8 / int4 builds are weight-only
MatMulNBits, which TensorRT doesn't take.
Benchmark.
- Setup: the ONNX build's benchmark: the README prompts (a pagoda with its bounding box, a dragon, a lobster), against the original's run on an RTX 3080 Laptop GPU.
- Teacher forced: the original's tokens fed back; each step's guided argmax is compared with the original's token.
- Free run: the shape from the engines' own tokens, as occupancy IoU against the original's.
- Decoder: the shape decoder and occupancy head on the original's tokens, as IoU against the original's grid.
- Pass mark: teacher-forced agreement no more than 3 points under the ONNX fp16 build's on every prompt, and decoder IoU >= 0.99.
| teacher forced (pagoda / dragon / lobster) | IoU, own tokens | IoU, original's tokens | seconds per shape | |
|---|---|---|---|---|
ONNX fp16/ |
73.5 / 77.1 / 64.1 % | 0.63 / 0.15 / 0.40 | 0.997 / 0.991 / 0.996 | 150-168 |
TensorRT fp16/ |
73.6 / 77.4 / 63.5 % | 0.77 / 0.13 / 0.36 | 0.997 / 0.991 / 0.996 | 57-64 |
The original's own bf16 modules, run the same way, agree 78-80 % teacher forced. Greedy decoding with guidance is that sensitive, so the free-run shapes differ from the original's even between equivalent implementations; the IoU on own tokens varies with that. The seconds cover the prompt, the 1024 GPT steps (about 19 s) and the 257³ occupancy grid, without marching cubes. Engine loading is included.
How these were made
From Cube3D at revision 8cab488680: 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
Cube3D Research-Only RAIL-MS (Hub card: openrail). 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
Cube 3D: Foundational Model for Generative AI
Cube 3D is our first step towards 3D intelligence, which involves a shape tokenizer and a text-to-shape generation model. We are unlocking the power of generating 3D assets and enhancing creativity for all artists. Our latest version of Cube 3D is now accessible to individuals, creators, researchers and businesses of all sizes so that they can experiment, innovate and scale their ideas responsibly.
This release includes model weights and starting code for our v0.5 model. With this update, we introduce two upgrades to the auto-regressive base model for 3D geometry generation from text: higher fidelity 3D compositions and bounding box conditioning
The example gif above shows the model's capacity to generate 3D shapes capturing mixtures of concepts expressed in text, for example mechanical lobster with mechanical tank treads. The v0.5 model also shows significantly better text adherence, for example the lowpoly paper craft victorian rabbit.
With bounding box conditioning, we observe novel 3D generations where the model balances between the two conditioning inputs -- text prompt and global aspect ratio. In the gif below, notice how the model creatively interprets the the seashell or tall pagoda prompts into distinct 3D shapes. The model sometimes struggles when the bounding box is too extreme for a given prompt, for example the cat, where it can produce disconnected components or generates it along a diagonal to fit the bounding box constraints.
For code and details on how to use the models, please refer to our Github repository.
For technical details, please see our tech report
- Downloads last month
- -
Model tree for moonbox-dev/cube3d-v0.5-TensorRT
Base model
Roblox/cube3d-v0.5