57 lines
1.3 KiB
Bash
Executable File
57 lines
1.3 KiB
Bash
Executable File
#!/bin/zsh
|
|
set -e
|
|
|
|
PLUGIN_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
COMFY_DIR="$(cd "$PLUGIN_DIR/../.." && pwd)"
|
|
|
|
export PYTORCH_ENABLE_MPS_FALLBACK=1
|
|
|
|
if [ -f "$PLUGIN_DIR/config.json" ]; then
|
|
TRELLIS_PATH="$(/usr/bin/python3 - "$PLUGIN_DIR/config.json" <<'PY'
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
try:
|
|
data = json.loads(Path(sys.argv[1]).read_text())
|
|
except Exception:
|
|
data = {}
|
|
print(data.get("trellis_mac_path", ""))
|
|
PY
|
|
)"
|
|
if [ -n "$TRELLIS_PATH" ]; then
|
|
export TRELLIS_MAC_PATH="$TRELLIS_PATH"
|
|
fi
|
|
fi
|
|
|
|
cd "$COMFY_DIR"
|
|
|
|
if [ ! -f "main.py" ]; then
|
|
echo "Could not find ComfyUI/main.py at:"
|
|
echo " $COMFY_DIR"
|
|
echo
|
|
echo "This launcher works when ComfyUI-TrellisMac is installed at:"
|
|
echo " ComfyUI/custom_nodes/ComfyUI-TrellisMac"
|
|
echo
|
|
echo "If you use ComfyUI Desktop or a custom launcher, use:"
|
|
echo " launchctl setenv PYTORCH_ENABLE_MPS_FALLBACK 1"
|
|
echo "then restart ComfyUI normally."
|
|
read "?Press Return to close..."
|
|
exit 1
|
|
fi
|
|
|
|
PYTHON_BIN="${PYTHON:-python3}"
|
|
if [ -x ".venv/bin/python" ]; then
|
|
PYTHON_BIN=".venv/bin/python"
|
|
fi
|
|
|
|
echo "Starting ComfyUI with PYTORCH_ENABLE_MPS_FALLBACK=1"
|
|
echo "ComfyUI: $COMFY_DIR"
|
|
if [ -n "$TRELLIS_MAC_PATH" ]; then
|
|
echo "trellis-mac: $TRELLIS_MAC_PATH"
|
|
fi
|
|
echo "Python: $PYTHON_BIN"
|
|
echo
|
|
|
|
exec "$PYTHON_BIN" main.py --auto-launch
|