HackerTrans
TopNewTrendsCommentsPastAskShowJobs

shivampkumar

no profile record

Submissions

Show HN: Run TRELLIS.2 Image-to-3D generation natively on Apple Silicon

github.com
202 points·by shivampkumar·há 3 meses·40 comments

comments

shivampkumar
·há 3 meses·discuss
Agreed...I've been adding some like mtlgemm, mtldiffrast from other contributors already
shivampkumar
·há 3 meses·discuss
Not currently - TRELLIS.2 is single-image input only AFAIK
shivampkumar
·há 3 meses·discuss
In theory yes - the pipeline already does this to some extent with its low_vram mode, offloading models to CPU between stages. The challenge at 16GB is that even a single 1.3B sub-model at fp32 plus activations can push past what's available after macOS takes its share. Someone on an M1 iMac with 16GB did get geometry generation working tho (issue #5 on the repo), so 16GB is probably possible. 24GB gives comfortable headroom though.
shivampkumar
·há 3 meses·discuss
The gather-scatter sparse conv should be fairly generic. Any model using 3x3x3 or 5x5x5 sparse convolutions on voxel grids could use it directly.

The main thing that's TRELLIS-specific is the neighbor cache key format, but that's a few lines to adapt.

The SDPA attention swap is even more reusable - it's just padding variable-length sequences into batches and calling torch.nn.functional.scaled_dot_product_attention.
shivampkumar
·há 3 meses·discuss
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.
shivampkumar
·há 3 meses·discuss
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.
shivampkumar
·há 3 meses·discuss
added! will add more, maybe even a GIF
shivampkumar
·há 3 meses·discuss
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
shivampkumar
·há 3 meses·discuss
thanks!
shivampkumar
·há 3 meses·discuss
I mean I can see that it's niche. Did not expect so many upvotes, but ig it's less niche than I tought

If you're not working with 3D on Apple Silicon this isn't relevant to you. For the subset of people who are, running this 4B parameter 3D generation model locally on a Mac was previously blocked by hard CUDA dependencies with no workaround.
shivampkumar
·há 3 meses·discuss
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.
shivampkumar
·há 3 meses·discuss
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.
shivampkumar
·há 3 meses·discuss
You're right, thanks for flagging this, let me run something and push images
shivampkumar
·há 3 meses·discuss
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.