Skip to content

Add Apple Silicon (MPS) support #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
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.

1 participant