Show HN: Run TRELLIS.2 Image-to-3D generation natively on Apple Silicon
179 points
11 hours ago
| 11 comments
| github.com
| HN
I ported Microsoft's TRELLIS.2 (4B parameter image-to-3D model) to run on Apple Silicon via PyTorch MPS. The original requires CUDA with flash_attn, nvdiffrast, and custom sparse convolution kernels: none of which work on Mac.

I replaced the CUDA-specific ops with pure-PyTorch alternatives: a gather-scatter sparse 3D convolution, SDPA attention for sparse transformers, and a Python-based mesh extraction replacing CUDA hashmap operations. Total changes are a few hundred lines across 9 files.

Generates ~400K vertex meshes from single photos in about 3.5 minutes on M4 Pro (24GB). Not as fast as H100 (where it takes seconds), but it works offline with no cloud dependency.

https://github.com/shivampkumar/trellis-mac

strimoza
11 minutes ago
[-]
Cool project. I've been working on something similar in spirit — a personal video cloud (strimoza.com) — and the hardest part was also getting local playback to work reliably without internet. How are you handling memory pressure on the M-series chips with larger models?
reply
sergiopreira
3 hours ago
[-]
Most 'runs on Mac' ports are a wrapper around a cloud call or a quantized shell of the original model. Going after the CUDA-specific kernels with pure-PyTorch alternatives is the kind of work that ages well, because the next CUDA-locked research release is three weeks away. One question: how much of the gather-scatter sparse conv is reusable for other TRELLIS-like architectures, or is it bespoke to this one?
reply
sebakubisz
4 hours ago
[-]
This is the kind of porting work I always hope for when I see a CUDA-only release. Have you thought about publishing the gather-scatter sparse 3D convolution and SDPA attention swaps as a standalone toolkit or writeup? A lot of folks running models locally on Apple Silicon hit the same wall with flash_attn, nvdiffrast, and custom sparse kernels and end up redoing the same work.
reply
shivampkumar
3 hours ago
[-]
that makes so much sense...I am exploring if I can find someone who has done this well...If not I'll try to do it myself.
reply
gondar
9 hours ago
[-]
Nice work. Although this model is not very good, I tried a lot of different image-to-3d models, the one from meshy.ai is the best, trellis is in the useless tier, really hope there could be some good open source models in this domain.
reply
shivampkumar
9 hours ago
[-]
Hey, thanks for sharing this. I'm sure TRELLIS.2 definitely has room to improve, especially on texturing.

From what I've seen personally, and community benchmarks, it does fair on geometry and visual fidelity among open-source options, but I agree it's not perfect for every use case.

Meshy is solid, I used it to print my girlfriend a mini 3d model of her on her birthday last year!

Though worth noting it's a paid service, and free tier has usage limitations while TRELLIS.2 is MIT licensed with unlimited local generation. Different tradeoffs for different workflows. Hopefully the open-source side keeps improving.

reply
isoprophlex
5 hours ago
[-]
Meshy is indeed great but I am terminally put off by their alltogether terrible, sleazy, gamified, opaque web UI. It's like aliexpress and a lootbox game had a baby that's into mesh generation. Ugh.
reply
drbscl
1 hour ago
[-]
Does it support multi-view input?
reply
petargyurov
4 hours ago
[-]
This is fantastic, great work. I will attempt to run it on my 16GB M1 but I doubt it'll run.

Out of curiosity, how did you go about replacing the CUDA specific ops? Any resources you relied on or just experience? Would love to learn more.

reply
antirez
2 hours ago
[-]
Great. Potentially can go much faster rewriting it in terms of Metal shaders.
reply
kennyloginz
9 hours ago
[-]
So much effort, but no examples in the landing page.
reply
shivampkumar
9 hours ago
[-]
You're right, thanks for flagging this, let me run something and push images
reply
shivampkumar
8 hours ago
[-]
added! will add more, maybe even a GIF
reply
post-it
8 hours ago
[-]
How much RAM does this use? Only sitting on 8 GB right now, I'm trying to figure out if I should buy 24 GB when it's time for a replacement or spring for 32.
reply
shivampkumar
7 hours ago
[-]
The model needed about 15GB at peak during generation - the 4B model loads multiple sub-models (1.3B each for shape and texture flow). 8GB won't be enough, but both 24GB and 32GB both should be fine.
reply
post-it
6 hours ago
[-]
Thanks! Could it conceivably load the sub-models in series rather than parallel? 8 still won't be enough but I wonder if those with 16 could eke something out.
reply
villgax
10 hours ago
[-]
That’s always been possible with MPS backend, the reason people choose to omit it in HF spaces/demos is that HF doesn’t offer an MPS backend. People would rather have the thing work at best speeds than 10x worse speeds just for compatibility.
reply
shivampkumar
8 hours ago
[-]
IMO TRELLIS.2 is slightly different case from the HF models scenario. It depends on five compiled CUDA-only extensions -- flex_gemm for sparse convolution, flash_attn, o_voxel for CUDA hashmap ops, cumesh for mesh processing, and nvdiffrast for differentiable rasterization. These aren't PyTorch ops that fall back to MPS -- they're custom C++/CUDA kernels. The upstream setup.sh literally exits with "No supported GPU found" if nvidia-smi isn't present. The only reason I picked this up because I thought it was cool and no one was working on this open issue for Silicon back then (github.com/microsoft/TRELLIS.2/issues/74) requesting non-CUDA support.
reply
Reubend
9 hours ago
[-]
Are you saying the original one worked with MPS? Or are you just saying it was always theoretically possible to build what OP posted?
reply
refulgentis
10 hours ago
[-]
It’s always been possible, but it’s not possible because there’s no backend, and no one wants to it to be possible because everyone needs it 10x the speed of running on a Mac? I’m missing something, I think.
reply
shivampkumar
8 hours ago
[-]
I thought it was cool and then I found the open issue mentioned above, that convinced me its def something more people want.

It IS significantly slower, about 3.5 minutes on my MacBook vs seconds on an H100. That's partly the pure-PyTorch backend overhead and partly just the hardware difference.

For my use case the tradeoff works -- iterate locally without paying for cloud GPUs or waiting in queues.

reply
jmatthews
8 hours ago
[-]
Well done
reply
serf
8 hours ago
[-]
rad. how long does output take? trellis is a fun model.
reply
shivampkumar
8 hours ago
[-]
i was able to get it in 3.5 mins from a single image on my 24gb m4 pro macbook

I'm still working on this to try to replicate nvdiffrast better. Found an open source port, might look it tonight

reply
shivampkumar
8 hours ago
[-]
thanks!
reply