Skip to content

Conversation

@rbourgeat
Copy link

@rbourgeat rbourgeat commented May 9, 2025

Issue: #5

This MR enables the TripoSG project to run on Apple Silicon (macOS) using PyTorch's MPS backend.

How to Run on macOS (Apple Silicon):

  1. Enable MPS Fallback (Important):
    Before running any inference script, execute the following in your terminal:
export PYTORCH_ENABLE_MPS_FALLBACK=1

This is required because some 3D operations used during mesh extraction (e.g., max_pool3d_with_indices) are not yet natively supported on MPS and need to fall back to the CPU.

  1. Example: Image-to-3D Inference:
python3 -m scripts.inference_triposg \
    --image-input assets/example_data/jkghed.png \ 
    --output-path ./output_macos_hierarchical.glb \
    --faces 5000 \
    --no-use-flash-decoder

(Note: --no-use-flash-decoder is recommended for MPS due to potential diso library compatibility and to ensure the CPU fallback path for hierarchical_extract_geometry (which now produces correct results with float32) is used.)

  1. Example: Scribble-to-3D Inference:
python3 -m scripts.inference_triposg_scribble \
    --image-input assets/example_scribble_data/cat_with_wings.png \
    --prompt "a cat with wings" \
    --output-path ./output_macos_scribble.glb

@rbourgeat rbourgeat mentioned this pull request May 9, 2025
@Stoobs
Copy link

Stoobs commented Jun 22, 2025

How did you resolve the diso package not being available?

@prom3theu5
Copy link

They added a fallback in case diso isn't available in the PR, so you can comment it out
I also had to remove the version constraint from numpy, but it works then

Will be slower though as it falls back to the CPU for the final stage due to no DISO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants