From c0c6475226d50e922c2c3600a27605ade0a884a8 Mon Sep 17 00:00:00 2001 From: MerrittLegacy Date: Sun, 21 Jun 2026 10:31:00 -0700 Subject: [PATCH] Fix macOS install: transformers 4.35.2 is incompatible with diffusers 0.33.1 The pinned transformers==4.35.2 breaks `import diffusers` on a fresh macOS install: diffusers 0.33.1's IP-Adapter loader imports `SiglipImageProcessor`, which only exists in transformers >= 4.45. Result: cannot import name 'SiglipImageProcessor' from 'transformers' Bump to transformers==4.49.0, verified end-to-end on Apple Silicon (MPS): sd-turbo loads, the FastAPI server starts, and realtime img2img runs. Also add demo/realtime-img2img/start_mac.sh, a launcher that (unlike run_mac.sh) does not edit main.py in place and supports fully-offline model loading via HF_HUB_OFFLINE=1. Co-Authored-By: Claude Opus 4.8 --- demo/realtime-img2img/requirements.txt | 5 ++++- demo/realtime-img2img/start_mac.sh | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 demo/realtime-img2img/start_mac.sh diff --git a/demo/realtime-img2img/requirements.txt b/demo/realtime-img2img/requirements.txt index 7f77e46..6ef2ac7 100644 --- a/demo/realtime-img2img/requirements.txt +++ b/demo/realtime-img2img/requirements.txt @@ -1,5 +1,8 @@ diffusers==0.33.1 -transformers==4.35.2 +# transformers 4.35.2 is incompatible with diffusers 0.33.1: diffusers' IP-Adapter +# loader imports SiglipImageProcessor, which only exists in transformers >= 4.45. +# 4.49.0 is verified working with this stack on macOS (Apple Silicon / MPS). +transformers==4.49.0 --pre torch torchvision diff --git a/demo/realtime-img2img/start_mac.sh b/demo/realtime-img2img/start_mac.sh new file mode 100755 index 0000000..3a60333 --- /dev/null +++ b/demo/realtime-img2img/start_mac.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Launch StreamDiffusion realtime img2img on macOS (Apple Silicon / MPS). +# +# Differs from run_mac.sh: it does NOT edit main.py in place, and it lets you +# opt into fully-offline model loading (use only locally-cached weights) by +# exporting HF_HUB_OFFLINE=1 before running. +# +# Open http://localhost:7860 once it prints "Uvicorn running". +set -e +cd "$(dirname "$0")" + +# Free port 7860 if a previous run is still listening. +lsof -ti:7860 | xargs kill -9 2>/dev/null || true + +# Make the repo's `streamdiffusion` importable without installing. +export PYTHONPATH="$(cd ../.. && pwd):${PYTHONPATH:-}" + +exec python main.py --taesd --acceleration none --debug