Instructions to use Lifec-321/trellis2-quantized-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TRELLIS.2
How to use Lifec-321/trellis2-quantized-v3 with TRELLIS.2:
# 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 Lifec-321/trellis2-quantized-v3: direct link, hf CLI and curl.
- Browser
- Download file 20.3 kB
-
https://huggingface.co/Lifec-321/trellis2-quantized-v3/resolve/main/README.md
- Command line
-
hf download hf://Lifec-321/trellis2-quantized-v3/README.md
-
curl -L -o README.md https://huggingface.co/Lifec-321/trellis2-quantized-v3/resolve/main/README.md
20.3 kB
| license: mit | |
| base_model: microsoft/TRELLIS.2-4B | |
| tags: | |
| - image-to-3d | |
| - trellis2 | |
| - quantized | |
| - gptq | |
| - early-release | |
| # TRELLIS.2 Quantized (v3, GPTQ INT4/INT8) | |
| > **Status: early release.** So far this has been tested on cloud NVIDIA L4 GPUs (23 GB). The "consumer GPU" results below are *simulated* limits on that machine; testing on real RTX 3060 / 3080-class cards and 16 GB-RAM desktops is still in progress. If you try it on your hardware, we'd love to hear how it went (see [Help wanted](#help-wanted)). | |
| > | |
| > **Corrections (Nov 2026):** earlier versions of this card said "zero quality loss" and "LPIPS 0.089", and that the script wrote a mesh as `.ply`. All three were wrong. 0.089 was the number for a different (LoRA) variant; the quantized model *does* differ from FP16; and the `.ply` the script wrote was a coloured point cloud with no faces. The script now exports a textured `.glb`. Measured numbers are below. | |
| ## What this is | |
| A smaller copy of the five flow (diffusion-transformer) models from [microsoft/TRELLIS.2-4B](https://huggingface.co/microsoft/TRELLIS.2-4B), plus a standalone script that runs the TRELLIS.2 image-to-3D pipeline with them. The goal was to make TRELLIS.2 usable on GPUs with less than the 24 GB upstream asks for. **That goal is only partly met**: see [Memory and speed](#memory-and-speed-measured). | |
| | | Original | This repo | | |
| |---|---|---| | |
| | 5 flow models (1.3B params each) | 13.1 GB (BF16) | **5.37 GB** (INT4/INT8) | | |
| | 3 decoders | 2.0 GB (FP16) | 2.0 GB (unchanged FP16) | | |
| | Whole repo | n/a | 7.43 GB | | |
| ## What was quantized, and how | |
| **Quantized:** the `nn.Linear` layers inside the five flow models: `sparse_structure_flow_model`, `shape_slat_flow_model_512`, `shape_slat_flow_model_1024`, `tex_slat_flow_model_512`, `tex_slat_flow_model_1024` (215 layers each). | |
| **Not quantized:** the three decoders (stored as FP16, same as upstream), the timestep embedder, the `adaLN_modulation` layers, and the input/output projection layers (kept at 16-bit). DINOv3 and the background-removal model are **not included**: they are downloaded from their own repos at runtime (see [Licenses](#licenses)). | |
| **Method (post-training, no gradient training):** | |
| - Layer-by-layer GPTQ (Hessian-based rounding), group size 64, 1% Hessian dampening, columns processed in descending Hessian-diagonal order. | |
| - MSE-optimal clipping range per group (grid search over 80-100% of min/max). | |
| - AWQ-style per-channel scaling to protect high-activation input channels (strength 0.5, clamped to 0.5-2x). | |
| - **Bit widths:** INT8 for attention projections (`self_attn.to_qkv`, `self_attn.to_out`, `cross_attn.to_q/to_kv/to_out`); INT4 for MLP layers; the 10 most sensitive MLP layers in each model are bumped to INT8 using a sensitivity analysis. | |
| - **Calibration:** 10 images, 5 denoising steps each, per model. The calibration images and the evaluation images are separate files (no byte-identical overlap; near-duplicates were not checked). | |
| - The weights are stored packed. They are dequantized to FP16 on the GPU at run time. There is no INT4 compute kernel, so this saves memory, not compute. | |
| The scripts that produced this are not in the repo yet; the settings above come from the quantization script (`phase_3v3_quantize.py`). | |
| ## Quality (measured) | |
| How "quality" is measured here matters, so first the setup. Quantized and original FP16 pipelines are run on the same input; four views of each result are rendered with TRELLIS.2's own PBR renderer (512 px, studio HDRI) and compared with LPIPS (VGG; lower is better, 0 means identical). Unless stated, `1024_cascade`, 20 steps, seed 42. The LPIPS numbers come from the generated voxel attributes, so they do not include the GLB export step. | |
| ### v3 vs FP16, 40 images (seed 42) | |
| | Metric | Value | | |
| |---|---| | |
| | Mean LPIPS | **0.081** | | |
| | Median LPIPS | 0.063 | | |
| | Worst image | 0.224 (see the ship below: a rotation, not damage) | | |
| | Mean SSIM / PSNR | 0.887 / 25.2 dB | | |
| | LPIPS < 0.05 / < 0.10 / < 0.15 / ≥ 0.15 | 16 / 25 / 35 / 5 images (of 40) | | |
| The 40 images are from our own test set (of 64; the run produced 40 results): TRELLIS.2 example images plus web thumbnails. It is small and not a standard benchmark. | |
|  | |
| *Four inputs chosen to span the range (LPIPS 0.057, 0.094, 0.187, 0.224), all TRELLIS.2 repository example images. Renders appear on black because the saved renders are transparent PNGs. The best-scoring images (16 of 40 are below 0.05) are not shown, because those inputs are third-party thumbnails we do not have the right to republish.* | |
| ### How big is that, really? Different seeds of FP16 itself | |
| A single LPIPS number against one FP16 sample does not say whether a difference is "quantization damage" or just "a different but plausible sample". So we also measured how far FP16 is from itself when only the random seed changes. | |
| - **Control:** re-running FP16 with the same seed reproduces the stored result exactly (LPIPS 0.0000), so the differences below are due to the seed, not GPU nondeterminism. | |
| - **12 images** spread over the v3 error range, FP16 seed 43 vs FP16 seed 42: **mean 0.1125** (median 0.093, max 0.233). v3 vs FP16 on the same 12 images: **0.0837**. v3's error is below the FP16 seed-to-seed distance on 9 of the 12 images and above it on 3 (test_0014 and test_0038 marginally, test_0027 clearly). | |
| A fuller study on 4 images (2 easier, 2 harder) and 3 seeds (42, 43, 44): | |
| | Mean LPIPS | easy (2) | hard (2) | all (4) | | |
| |---|---|---|---| | |
| | FP16 vs FP16, different seeds (3 pairs) | 0.018-0.020 | 0.152-0.249 | 0.086-0.134 | | |
| | v3 vs FP16, same seed (42 / 43 / 44) | 0.012 / 0.017 / 0.014 | 0.194 / 0.118 / 0.117 | 0.103 / 0.068 / 0.065 | | |
| | v3 vs FP16, different seeds (3 pairs) | 0.017-0.021 | 0.149-0.251 | 0.083-0.136 | | |
| | v3 vs v3, different seeds (2 pairs) | 0.016-0.021 | 0.216-0.219 | 0.116-0.120 | | |
| What we read from it: | |
| - Once the seed differs, v3 is about as far from FP16 as FP16 is from itself. We don't see a measurable extra gap on these images. | |
| - On the easy images the differences are tiny either way (bottle: LPIPS below 0.01). | |
| - On the hard images, results depend strongly on the seed for *both* models (backpack back side, ship orientation). | |
|  | |
| *Backpack and ship (TRELLIS.2 example images), 2 of 4 views each. Top four rows FP16, bottom four v3: seeds 42, 43, 44 at 20 steps, then seed 42 at 12 steps.* | |
| **The ship at seed 42:** FP16 draws it from a three-quarter angle and v3 draws it rotated about 90°, at every step count and resolution. At seeds 43 and 44, v3 and FP16 agree (LPIPS 0.075 and 0.069), and FP16 itself produces both orientations depending on the seed. The 0.224 LPIPS for that image therefore reflects a different pose, not worse texture or geometry. LPIPS cannot tell those apart. | |
| **The vase** (not shown: that input is a third-party thumbnail): the shape is the same everywhere, but two v3 rows show a more saturated green on the leaf band than their FP16 counterparts. FP16 also varies from seed to seed, so we can't say this is a quantization artifact, but we saw it. | |
| **Steps and resolution** (same seed, 4 images): | |
| | | easy | hard | all | | |
| |---|---|---|---| | |
| | 12 vs 20 steps, FP16 | 0.010 | 0.114 | 0.062 | | |
| | 12 vs 20 steps, v3 | 0.013 | 0.107 | 0.060 | | |
| | 512 vs 1024 pipeline, FP16 / v3 | 0.013 / 0.016 | 0.090 / 0.090 | 0.052 / 0.053 | | |
| Going from 20 to 12 steps (upstream's `pipeline.json` default is 12) changes the output by about as much as quantization does, and cut generation time by roughly 40% on the larger objects. The `512` pipeline is softer and differs from `1024` by about 0.05. All of this is 4 images and should be read as indicative. | |
| **Caveats for everything above:** small image set; one hardware setup; the numbers come from our evaluation harness (dequantized weights patched into the FP16 pipeline), and we have not separately re-run the full evaluation through the standalone script in this repo; no human judging. | |
| ### Fine-tuning attempts (LoRA): not released | |
| We tried to recover quality with LoRA adapters trained against the FP16 model. It did not give a reliable improvement, so **there is no fine-tuned variant to download**, and the script has no adapter-loading support. | |
| On the 25 images where both were evaluated: | |
| | | v3 (this repo) | v3 + LoRA (FP16 adapters, +187 MB) | | |
| |---|---|---| | |
| | Mean LPIPS | 0.0924 | 0.0891 | | |
| | Mean PSNR | 25.1 dB | 24.5 dB | | |
| | "Easy" images (v3 LPIPS < 0.06, n=10) | **0.0299** | 0.0363 | | |
| | "Hard" images (v3 LPIPS ≥ 0.10, n=13) | 0.1425 | **0.1322** | | |
| | Images where LoRA scored better | | 14 of 25 | | |
| LoRA helped a little on hard images and hurt a little on easy ones; the overall 0.003 difference is within noise for a single seed. A LoRA-then-requantize variant scored 0.0893 on its own 25-image run, and an end-to-end distilled variant was clearly worse (mean LPIPS 0.19 vs 0.15 on the 8 hardest images). Neither is published. | |
| ## Exporting a mesh (GLB) | |
| The script writes a **textured GLB** by default (`--output model.glb`). The export is upstream's own `o_voxel.postprocess.to_glb` (decimate, UV-unwrap, bake PBR textures); we only call it. `.ply`/`.npz`/`.vxz` outputs are still available but are the raw voxel attributes: a point cloud with no faces. | |
| **Remeshing is off by default** (`--remesh` turns it on). Remeshing is upstream's optional dual-contouring step. Upstream's example enables it, but the function's own default is off. We leave it off because of memory (hardest image, test_0005, measured on an L4 from stored latents): | |
| | Export | Time | GPU peak (PyTorch) | GPU peak (`nvidia-smi`) | | |
| |---|---|---|---| | |
| | remesh, 4096 px texture | 83 s | **14.8 GB** | 19.1 GB | | |
| | remesh, 2048 px | 65 s | 14.8 GB | 19.3 GB | | |
| | no remesh, 4096 px | 99 s | **4.05 GB** | 5.5 GB | | |
| | no remesh, 2048 px | 74 s | 2.2 GB | 3.7 GB | | |
| | no remesh, 1024 px, 300k vertices | 26 s | 1.7 GB | 3.6 GB | | |
| What you give up without remeshing: surface positions match (average distance within sampling noise), but connectivity is much messier. On that image, after welding UV-seam duplicates: **134,347 open (boundary) edges without remeshing vs 332 with it**, and 1,582 vs 188 disconnected pieces. Neither is watertight. If you plan to retopologize or clean the mesh anyway this may not matter; if you need a tidy mesh, use `--remesh` on a GPU with enough memory. In the render comparison, the 4096 px and 2048 px no-remesh exports looked very similar to the remeshed one; 300k vertices at 1024 px visibly loses thin structures (petals, ragged edges). Texture size changes the GLB size very little (34-47 MB at 1M vertices) because the vertex count dominates. | |
| Export time is erratic. In our 1024-resolution runs on an 8-vCPU machine it ranged from about 26 s to 315 s per file (the simple flower took 315 s at 4096 px without remeshing, the much larger hardest image 89 s); the UV step is CPU-bound. In one 1536-resolution case the no-remesh export took 56 to 87 minutes. | |
| ## Memory and speed (measured) | |
| All runs: NVIDIA L4 (23 GB), PyTorch 2.6.0 / CUDA 12.4, Python 3.10, `1024_cascade`, 20 steps, on AWS instances with 4 vCPU / 15 GB RAM or 8 vCPU / 32 GB RAM. "Capped" runs limit the CUDA allocator to N GiB (`torch.cuda.set_per_process_memory_fraction`) and the process to 14 GB of RAM with no swap, to *imitate* a smaller machine. This is a simulation, not a real 8/12 GB card. | |
| **Where the memory goes:** | |
| - Flow-model sampling (the part we quantized): about **4.1 GB** on the GPU (per-layer dequantization). | |
| - **Mesh decoding is the bottleneck.** On test_0005 (our hardest input) the shape decoder peaks at 10.1 GB and the texture decoder at 11.0 GB; on the simple flower (test_0009), 3.7 and 4.0 GB. The peak is in the last upsampling block (`SparseResBlockC2S3d`, 2.4M → 9.8M voxels on test_0005); the neighbouring ConvNeXt MLP blocks add about 4.6 GB above baseline. | |
| - GLB export: see the table above. | |
| | Run | Result | | |
| |---|---| | |
| | `--low-vram`, test_0005, 8 GiB cap | **failed: out of memory** in the shape decoder | | |
| | `--low-vram`, test_0005, 12 GiB cap | **failed: out of memory** in the shape decoder (tried to allocate 2.3 GiB) | | |
| | `--low-vram`, test_0009 (simple flower), 8 GiB cap, 14 GB RAM cap | **worked**; inference 125 s; peak GPU 6.8 GB | | |
| | `--low-vram`, test_0005, 15 GB RAM, no swap, `.ply` export | **killed by the OOM killer** at export (inference had finished in 435.7 s; peak resident 14.6 GB) | | |
| | `--low-vram`, test_0005, 15 GB RAM, no swap, GLB **with remesh** | **finished**: inference 7.2 min + export 96 s; peak resident 13.4 GB of 15.3 GB (thin margin); GPU peak during export 13.9 GB | | |
| | `--low-vram`, test_0005, 14 GB RAM hard cap (cgroup, no swap), **final script, default flags (GLB, no remesh)** | **finished**: generation 7.0 min + export 89 s; peak resident 13.7 GB of the 14 GB cap (thin margin); GPU peak 14.2 GB by `nvidia-smi` (decode stage), 4.0 GB during export | | |
| | same, test_0009 (simple flower) | **finished**: generation 2.0 min + export **315 s**; peak resident 13.1 GB; GPU peak 5.1 GB by `nvidia-smi` | | |
| What this means: | |
| - "4 GB VRAM" is only true for sampling. **Decoding and export need far more on large or complex outputs**: the hardest input did not fit even a simulated 12 GB card. | |
| - A simple input fit in a simulated 8 GB. Where yours falls depends on how large the generated 3D structure is. | |
| - Peak resident memory on the hardest input was 13.7 GB under a 14 GB cap: it fits a 16 GB-RAM machine, but with little margin. We did not test below that. | |
| **Speed.** On an L4, generation (sampling + decoding, models already loaded) takes about 36-55 s for simple objects and 100-210 s for the larger ones at 20 steps on the 8-vCPU machine, plus model loading and export; the hardest image took 7.2 minutes. `--fast` was about 17% quicker than `--low-vram` on the same image (378 s vs 433 s). Upstream reports about 17 s for 1024³ on an **H100**; we have not measured that GPU. By our estimate an H100 has roughly 8× the L4's FP16 compute, and our default of 20 steps (upstream's is 12) accounts for another 1.7×, which is consistent with minutes rather than seconds on an L4. Consumer cards will differ: a 3060 has less FP16 tensor throughput than an L4, so expect minutes there too (not measured). | |
| ## Not tested yet | |
| - Any real consumer GPU (RTX 3060/3070/3080/4060, etc.). A real 16 GB-RAM desktop beyond the 15 GB cloud instance above. | |
| - Windows, macOS, AMD or Apple Silicon. | |
| - 8 GB of VRAM on anything but a simple input (simulated only). | |
| - More than one image per configuration for the memory numbers. | |
| - Output quality judged by people, as opposed to LPIPS/SSIM/PSNR. | |
| - The 1536 pipeline: tried on one easy object only. Remeshed exports worked (about 80 s each); no-remesh exports at 2048 and 1024 px took 56 and 87 minutes (cause unknown). We stopped there. | |
| - Batches of images (the script loads the models for every image; a batch mode is not written yet). | |
| ## Known issues | |
| - **Decode memory** (see above) is the main limit for 8-12 GB cards. We have profiled it but not fixed it. | |
| - The PBR preview renderer crashed with `CUDA error 700` on our hardest mesh (an upstream TRELLIS.2 renderer problem, not related to quantization). | |
| - The script uses `flash_attn` by default (as upstream does). FlashAttention 2 does not support Turing GPUs (e.g. T4); upstream TRELLIS.2 can be switched with `ATTN_BACKEND=sdpa`, which we have *not* verified with this script. | |
| - LPIPS is blind to pose: a rotated but otherwise equal object scores as a large difference. | |
| ## Kaggle notebook: still in progress | |
| We are trying to make a Kaggle notebook (free T4s) so people can try this without their own GPU. **It does not work yet.** What we learned so far: `trellis2` is not on PyPI and has to be cloned from the Microsoft repo; its CUDA extensions (`flex_gemm`, `o_voxel`, `cumesh`, `nvdiffrast`) have to be built against Kaggle's Python (3.13), which differs from what we built them on; and the T4 needs `ATTN_BACKEND=sdpa` because FlashAttention 2 doesn't support it (untested). We'll post the notebook and its results when it runs. | |
| ## Licenses | |
| This repository contains only (a) weights derived from `microsoft/TRELLIS.2-4B`, which is **MIT** licensed (Copyright (c) Microsoft Corporation; the license text is in `LICENSE`), and (b) a script. The weights here are released under the same MIT terms. | |
| **The full pipeline also uses other components that are *not* in this repo and have their own terms, which you must read and accept yourself:** | |
| - **DINOv3** (`facebook/dinov3-vitl16-pretrain-lvd1689m`): gated on Hugging Face (manual approval) under Meta's custom DINOv3 license (<https://ai.meta.com/resources/models-and-libraries/dinov3-license>). The pipeline downloads it on first run, so you need an approved Hugging Face account and token. We do not redistribute it. There is open uncertainty about what that license permits for downstream and derived use; we are not lawyers and do not take a position. Read it before using the outputs commercially. | |
| - **RMBG-2.0** (`briaai/RMBG-2.0`), the background-removal model the pipeline loads: gated, under BRIA's license, which links to **CC BY-NC 4.0 (non-commercial)**. We do not redistribute it. | |
| - **nvdiffrast** (NVIDIA), required by the pipeline (it is imported by `o_voxel`): NVIDIA Source Code License (1-Way Commercial). Per its text, use outside NVIDIA is limited to non-commercial "research or evaluation purposes". We do not redistribute it. | |
| - **CuMesh** and **FlexGEMM** (MIT) and **o-voxel** (part of the MIT-licensed TRELLIS.2 repo) are build dependencies. CuMesh says it integrates code from cubvh, xatlas and pamo; we did not check those licenses. | |
| As configured, the pipeline therefore carries a non-commercial restriction regardless of the MIT license on these weights. Nothing here is legal advice. | |
| ## Usage | |
| Requirements: Python 3.10, PyTorch 2.6 / CUDA 12.4 (the versions we tested; upstream's `setup.sh` installs them), a clone of the TRELLIS.2 repository with its CUDA extensions built (`flash-attn`, `nvdiffrast`, `cumesh`, `flexgemm`, `o-voxel`), and a Hugging Face token with access to DINOv3 and RMBG-2.0. | |
| ```bash | |
| # 1. TRELLIS.2 itself (not on PyPI): follow its README / setup.sh | |
| git clone --recursive https://github.com/microsoft/TRELLIS.2 | |
| # 2. These weights (use `hf download` or `huggingface-cli download`, depending on your huggingface_hub version) | |
| hf download Lifec-321/trellis2-quantized-v3 --local-dir ./trellis2-quantized | |
| # 3. Run (accept the DINOv3 / RMBG-2.0 terms on their pages and log in first: `hf auth login`) | |
| export PYTHONPATH=/path/to/TRELLIS.2:$PYTHONPATH | |
| python ./trellis2-quantized/trellis2_quantized_inference.py \ | |
| --standalone-dir ./trellis2-quantized --image photo.png --output model.glb | |
| ``` | |
| Useful options: | |
| | Flag | Effect | | |
| |---|---| | |
| | `--low-vram` / `--fast` | per-layer dequantization (default for GPUs ≤ 13 GB) / pre-dequantize everything (faster, more memory) | | |
| | `--remesh` | rebuild the surface in the GLB export: cleaner connectivity, needs ~10-15 GB GPU memory on large objects | | |
| | `--texture-size 2048` | smaller baked texture (less memory) | | |
| | `--decimation N` | target vertex count of the GLB (default 1,000,000) | | |
| | `--steps 12` | fewer sampling steps (default 20; upstream's own default is 12) | | |
| | `--pipeline-type 512` | lower-resolution pipeline: faster, less memory, softer | | |
| | `--output x.ply` | raw voxel attributes (point cloud, no faces) | | |
| ## Help wanted | |
| Real-hardware reports are the thing we need most. If you run this, please open a discussion in the Community tab with: GPU model and VRAM, system RAM, OS, which flags you used, the input image type, wall-clock time, whether it finished, and peak VRAM/RAM if you measured it. Failures and out-of-memory reports are just as useful as successes. Reports of quality problems (with the input image, if you can share it) are welcome too. | |
| ## Changelog | |
| - **Nov 2026:** card rewritten. Removed "zero quality loss", the 0.089 figure (wrong attribution) and the `.ply`-as-mesh claim; added measured quality including seed-to-seed variation, memory limits and profile, GLB export (script now writes `.glb`, remeshing optional), license notes (nvdiffrast, CuMesh) and known issues. Install instructions corrected. | |
| - **Oct 2026:** initial upload. | |