Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TRELLIS 2 + ComfyUI on AMD ROCm β€” End-to-End Install Guide

A working install of microsoft/TRELLIS.2 (image-to-3D, 4B parameter model) inside ComfyUI on AMD GPUs via ROCm. Tested end-to-end with both shape-only and full textured pipelines on a 7900 XTX (gfx1100, 24 GB VRAM).

This guide consolidates fixes for several real bugs in the upstream wrapper that prevent the stack from working out-of-the-box on most environments. If you've tried the Aero-Ex/ComfyUI-Trellis2-GGUF install or the egore/comfyui-trellis2-gguf-rocm ROCm fork and got stuck, this is the path that worked.

πŸ–ΌοΈ See it running: Live demo of meshes generated with this setup is at /docs (will be hosted via GitHub Pages once a few showpieces are added).


What you'll have at the end

  • ComfyUI running on ROCm with 45 TRELLIS-2 nodes registered
  • 6 native HIP extensions built and loadable: cumesh, flex_gemm, nvdiffrast, nvdiffrec_render, o_voxel, custom_rasterizer
  • TRELLIS auto-downloads its model weights (~2.5 GB GGUF Q4 / ~8 GB BF16) from Aero-Ex/Trellis2-GGUF into ComfyUI/models/Trellis2/
  • Working image-to-3D pipeline producing .glb outputs from your reference images

Prerequisites

Tested Notes
GPU AMD Radeon RX 7900 XTX (gfx1100) Should also work on 7900 XT, 7800 XT, 7700 XT (same Navi 31/32 ISA). 7600/7600 XT = gfx1102 β€” change the arch flag below. RDNA2 (6000-series) untested; would need ROCm 6.x and may hit Triton kernel issues
OS Ubuntu 22.04 (kernel 6.8) Other Linux distros should work; ROCm packages must match
ROCm 7.2.2 7.0+ likely fine; 6.x untested with this stack
Python 3.10.12 The wrapper authors test on 3.14; 3.10 works with the patches in this repo
Disk ~15 GB free Build temp ~2 GB, downloads ~3 GB GGUF or ~8 GB BF16, build artifacts in site-packages
VRAM 8 GB+ workable, 16 GB+ comfortable Q4_K_M model + low_vram=True fits in 8 GB; BF16 + textured pipeline wants 16+

Confirm your GPU's ISA target before starting:

rocminfo | grep "Name:.*gfx" | head -1
# Example output:    Name:                    gfx1100

Use whatever your card reports (gfx1100, gfx1101, gfx1102) anywhere this guide says gfx1100. The patches default to gfx1100; edit patches/01-gfx-arch.patch if your card is different before applying.


Step 1 β€” Install ROCm-enabled PyTorch and ComfyUI

If you already have ComfyUI on ROCm, skip to Step 2.

# ROCm 7.2 PyTorch wheels (adjust URL for your ROCm version)
pip install --user torch torchvision torchaudio \
  --index-url https://download.pytorch.org/whl/rocm7.2

# Verify ROCm + GPU detected
python3 -c "import torch; print('torch:', torch.__version__); \
  print('hip:', torch.version.hip); \
  print('cuda_avail:', torch.cuda.is_available()); \
  print('device:', torch.cuda.get_device_name(0))"
# Expect: torch 2.11.0+rocm7.2, hip 7.2.x, cuda_avail True, device Radeon RX 7900 XTX

# ComfyUI
git clone https://github.com/comfyanonymous/ComfyUI.git ~/ComfyUI
cd ~/ComfyUI
pip install --user -r requirements.txt

Test ComfyUI loads cleanly before going further:

cd ~/ComfyUI
python3 main.py --listen 0.0.0.0 --port 8188
# Browse to http://localhost:8188 β€” should show the empty canvas. Ctrl-C to stop.

Step 2 β€” Clone the egore ROCm wrapper

cd ~/ComfyUI/custom_nodes
git clone https://github.com/egore/comfyui-trellis2-gguf-rocm.git
cd comfyui-trellis2-gguf-rocm

ComfyUI imports every directory under custom_nodes/, including this script-only directory. Drop a no-op __init__.py to prevent a startup error:

cat > __init__.py <<'EOF'
# This directory is the install script (not a custom node).
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
EOF

Step 3 β€” Apply the install-script patches

The egore install script has four issues outside its tester's exact environment. Apply patches 01 through 04 from this repo:

# Clone this guide repo somewhere (or copy just the patches/ dir)
cd /tmp
git clone https://github.com/toastmanAu/trellis-2-rocm-comfyui.git
cd ~/ComfyUI/custom_nodes/comfyui-trellis2-gguf-rocm

# Apply each patch
git apply /tmp/trellis-2-rocm-comfyui/patches/01-gfx-arch.patch
git apply /tmp/trellis-2-rocm-comfyui/patches/02-comfy-root-home.patch
git apply /tmp/trellis-2-rocm-comfyui/patches/03-pip-user-flag.patch
git apply /tmp/trellis-2-rocm-comfyui/patches/04-site-packages-user.patch

Don't have your GPU on gfx1100? Edit patches/01-gfx-arch.patch first β€” replace gfx1100 with gfx1101 (Navi 32) or gfx1102 (Navi 33 / 7600-series).

What each patch does:

Patch What it fixes
01-gfx-arch.patch The script hardcodes gfx1102 (the maintainer's 7600 XT). Change to your card's ISA.
02-comfy-root-home.patch Repoints COMFY_ROOT from the script's directory to $HOME so ${COMFY_ROOT}/ComfyUI resolves to a vanilla ~/ComfyUI install.
03-pip-user-flag.patch Adds --user to pip args so packages install to ~/.local/lib/python3.x/site-packages instead of needing sudo.
04-site-packages-user.patch Makes SITE_PACKAGES point at the user site-packages (matching the --user install) so post-install file patches target the right path. Without this the script dies at curl: (23) Failure writing output partway through.

Step 4 β€” Run the install

Make sure ComfyUI is not running on port 8188 (the script checks and aborts if it is):

# If you have a systemd unit for ComfyUI:
systemctl --user stop comfyui.service
# Or just kill the process:
pkill -f "ComfyUI/main.py"

Then:

cd ~/ComfyUI/custom_nodes/comfyui-trellis2-gguf-rocm
bash ./install-trellis2-gguf-rocm.sh

This runs ~20–30 minutes the first time:

  1. Downloads DINOv3 model (~1.2 GB)
  2. Builds CuMesh from source with HIP patches (~5 min)
  3. Builds FlexGEMM (Triton-based, ~1 min)
  4. Builds nvdiffrast with HIP patches and OpenGL backend (~3 min)
  5. Builds nvdiffrec_render (~2 min)
  6. Builds o_voxel (~3 min)
  7. Clones Aero-Ex/ComfyUI-Trellis2-GGUF into custom_nodes/
  8. Installs Python requirements (transformers 5.2.0, sdnq, meshlib, pymeshlab, rembg, etc.)

Step 5 β€” Apply the BF16 download fix

There's a real upstream bug in Aero-Ex/ComfyUI-Trellis2-GGUF/model_manager.py that 404s any Safetensors (BF16) model_format pick. The Aero-Ex HF repo names BF16 weights as <basename>.safetensors (basename already ends in _bf16), but the wrapper unconditionally appends _bf16.safetensors β†’ _bf16_bf16.safetensors β†’ 404.

Apply the fix after Step 4 (the wrapper's source has to exist first):

cd ~/ComfyUI/custom_nodes/ComfyUI-Trellis2-GGUF
git apply /tmp/trellis-2-rocm-comfyui/patches/05-model-manager-bf16.patch

If you only intend to use GGUF quants, you can skip this β€” the bug only affects the BF16 / FP8 safetensors path.


Step 6 β€” Build custom_rasterizer for ROCm

The egore script doesn't include custom_rasterizer (used by TRELLIS's texturing pipeline), but it lives inside the Hunyuan3D wrapper's tree and PyTorch's CUDAExtension auto-HIPifies the source. ~3-min build:

# Get the source (this is also the Hy3D wrapper, useful in its own right)
cd ~/ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-Hunyuan3DWrapper.git
cd ComfyUI-Hunyuan3DWrapper/hy3dgen/texgen/custom_rasterizer

PYTORCH_ROCM_ARCH=gfx1100 \
  ROCM_HOME=/opt/rocm \
  HIP_HOME=/opt/rocm \
  CUDA_HOME=/opt/rocm \
  FORCE_CUDA=1 \
  python3 -m pip install --user --no-build-isolation .

# Verify
python3 -c "import custom_rasterizer; print(custom_rasterizer.__file__)"

Step 7 β€” Launch ComfyUI with the right flag

TRELLIS uses nvdiffrast's OpenGL backend on AMD (the CUDA rasterizer doesn't have a HIP port). OpenGL doesn't compose with ComfyUI's default xformers attention path, so you must pass --use-pytorch-cross-attention:

cd ~/ComfyUI
python3 main.py --listen 0.0.0.0 --port 8188 --use-pytorch-cross-attention

If you have a systemd user unit, add the flag to your ExecStart:

ExecStart=/usr/bin/python3 main.py --listen 0.0.0.0 --port 8188 --use-pytorch-cross-attention
systemctl --user daemon-reload && systemctl --user start comfyui.service

Watch for these markers in the log to confirm everything loaded:

[Trellis2] Using native ComfyUI-GGUF support (ops/dequant/loader)
0.7 seconds: /home/.../custom_nodes/ComfyUI-Trellis2-GGUF

If you see IMPORT FAILED for comfyui-trellis2-gguf-rocm, you forgot the no-op __init__.py from Step 2.


Step 8 β€” Run a test workflow

ComfyUI ships example workflows in ~/ComfyUI/custom_nodes/ComfyUI-Trellis2-GGUF/example_workflows/. Pick LowPoly.json for fastest first test.

⚠️ Heads up: Aero-Ex's example JSONs were authored against an older node schema; loading them in the current ComfyUI UI causes widget-position drift errors like device: 'True' not in ['cpu', 'cuda'] or model_format: 'flash_attn' not in [...]. The values are correct but in the wrong dropdown slots.

  • Manual fix: re-pick model_format, backend, device, low_vram in the Trellis2LoadModel_GGUF node; re-pick dual_contouring_resolution in Trellis2Remesh_GGUF; re-pick uv_unwrap_method in Trellis2MeshTexturing_GGUF. The error messages name the offending fields.
  • Or build fresh from the Add Node menu β€” the registered node signatures are correct, only the example JSONs are stale.

Steps:

  1. Browser β†’ http://localhost:8188
  2. Drag LowPoly.json onto the canvas
  3. In Trellis2LoadModel_GGUF, set:
    • modelname: TRELLIS.2-4B
    • model_format: GGUF Q4_K_M (smallest first download)
    • backend: sdpa (only ROCm-compatible option β€” flash_attn, xformers, flash_attn_3 are CUDA-only)
    • device: cuda (yes, "cuda" β€” PyTorch ROCm advertises itself as CUDA via HIP)
    • low_vram: True
    • keep_models_loaded: True
  4. In Trellis2LoadImageWithTransparency_GGUF, upload a clear-subject reference image
  5. Critical: in Trellis2PreProcessImage_GGUF, set remove_background: True if your image is RGB (no alpha). Set False only if you've pre-cut a transparent PNG yourself.
  6. Queue Prompt

First run downloads ~2.5 GB of weights from Aero-Ex/Trellis2-GGUF to ~/ComfyUI/models/Trellis2/. Expect 5–10 min download then ~30 s generation. Output .glb files appear in ~/ComfyUI/output/3D/.


Quant tiers β€” which one to pick

model_format Disk VRAM working set Notes
GGUF Q4_K_M ~2.5 GB ~6 GB Smallest; surprisingly capable for shape, slightly soft textures
GGUF Q5_K_M ~3 GB ~7 GB Good balance
GGUF Q6_K ~3.5 GB ~8 GB Diminishing returns above this for shape
GGUF Q8_0 ~4.5 GB ~10 GB Near-BF16 quality
Safetensors (FP8) ~4 GB ~9 GB Faster than GGUF on some GPUs
Safetensors (BF16) ~8 GB ~16 GB Reference quality (needs Step 5 patch)

Voxel resolution (pipeline_type field on Trellis2MeshWithVoxelAdvancedGenerator_GGUF) is independent of quant β€” 512 is fast (~30 s), 1024 is detailed (~90 s), 1024_cascade is max quality (~3 min). Each resolution downloads a separate set of weight files on first use.


Troubleshooting

No module named 'custom_rasterizer' β€” see Step 6.

IndexError: index 3 is out of bounds for axis 2 with size 3 β€” Trellis2PreProcessImage_GGUF tried to read alpha on an RGB input. Fix: enable remove_background: True, OR upload a transparent PNG.

Generation hangs at 85% in custom frontend integrations β€” ComfyUI 0.18+ emits execution_success as the workflow-end WebSocket event, not the legacy null-node executing. Listen for both:

elif msg["type"] == "execution_success" and msg["data"].get("prompt_id") == prompt_id:
    break
elif msg["type"] == "executing" and msg["data"].get("node") is None:
    break

HSA_STATUS_ERROR_INVALID_ISA β€” native extension built for wrong gfx target. Rebuild with the correct PYTORCH_ROCM_ARCH=<your_gfx>.

Entry Not Found for url: https://huggingface.co/...bf16_bf16.safetensors β€” Step 5 BF16 patch not applied.

Custom validation failed for node β€” device: 'True' not in [...] β€” Aero-Ex example workflow JSON has widget-position drift. See Step 8 heads-up.

HIPBLAS_STATUS_INVALID_VALUE on RDNA3 β€” add to your launch env:

export TORCH_BLAS_PREFER_HIPBLASLT=0

hipBLASLt has shape gaps on RDNA3 for certain matmul sizes; falling back to hipBLAS costs ~5–10 % on those matmuls but handles every shape.

OpenGL context creation fails β€” nvdiffrast needs a usable GL context. On a desktop with a connected display this works; headless servers may need EGL/GBM fallback or Xvfb.


Beyond this guide

  • TRELLIS via SDNQ quants β€” alternative quantization scheme; Trellis2LoadModel_SDNQ instead of _GGUF. Same install applies.
  • Mesh refinement β€” Trellis2MeshRefiner_GGUF runs a second pass at higher voxel resolution conditioned on multiple views. Adds 1–2 min, recovers thin features.
  • Upstreaming the BF16 fix β€” patch 05 is small and clear. PR welcome from anyone with cycles.

Credits

If this guide saved you time, ⭐ star the repo and link upstream too.

License

MIT β€” see LICENSE.

About

Working install guide + patches for TRELLIS 2 image-to-3D on AMD GPUs via ROCm + ComfyUI. Tested end-to-end on RDNA3 (gfx1100, 7900 XTX).

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors