Skip to content

Fix macOS install: transformers 4.35.2 incompatible with diffusers 0.33.1#1

Open
MerrittLegacy wants to merge 1 commit into
patrickhartono:mainfrom
MerrittLegacy:fix/mac-transformers-compat
Open

Fix macOS install: transformers 4.35.2 incompatible with diffusers 0.33.1#1
MerrittLegacy wants to merge 1 commit into
patrickhartono:mainfrom
MerrittLegacy:fix/mac-transformers-compat

Conversation

@MerrittLegacy

Copy link
Copy Markdown

Problem

On a fresh macOS install following demo/realtime-img2img/requirements.txt, importing diffusers fails immediately:

RuntimeError: Failed to import diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion ...
cannot import name 'SiglipImageProcessor' from 'transformers'

The pinned transformers==4.35.2 is too old for diffusers==0.33.1: diffusers' IP-Adapter loader (diffusers/loaders/ip_adapter.py) imports SiglipImageProcessor, which was only added to transformers in 4.45.0. So the demo can't even start on a clean environment.

Fix

Bump transformers to 4.49.0 (lowest tested version with SiglipImageProcessor that resolves cleanly with the rest of the pinned stack — it pulls tokenizers>=0.21).

Verified end-to-end on Apple Silicon (M-series, MPS), Python 3.10:

  • import diffusers / StableDiffusionPipeline import OK
  • python main.py --taesd --acceleration none --debug starts
  • stabilityai/sd-turbo loads on MPS, Uvicorn running on http://0.0.0.0:7860
  • Web UI returns HTTP 200 and /api/settings responds — realtime img2img works

Also included

demo/realtime-img2img/start_mac.sh — a small launcher that, unlike run_mac.sh, does not edit main.py in place (the sed -i there mutates a tracked file on every run) and supports fully-offline model loading via HF_HUB_OFFLINE=1. Happy to drop this if you'd prefer to keep the PR to the one-line requirements fix.

🤖 Generated with Claude Code

… 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 <noreply@anthropic.com>
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