Skip to content

Commit 7325046

Browse files
authored
fix(diffusers): drop compel from requirements to unblock pip resolver (mudler#9632)
compel 2.3.1 (latest, Nov 2025) declares transformers~=4.25 in its metadata, i.e. >=4.25,<5.0. After transformers 5.0 (2026-01-26) and huggingface-hub 1.0 (2025-10-27) shipped, the weekly DEPS_REFRESH cache rotation in CI started seeing the new majors and pip's resolver went into multi-hour backtracking storms walking every transformers 4.x candidate against every accelerate/hf-hub/tokenizers combination to find a set compel would accept. The 2026-04-29 backend-build for the diffusers backend (darwin-mps + l4t + cublas13-turboquant matrix cells) hit the GitHub Actions 6h job timeout still inside pip install — the build itself never started. compel is the only hard upper bound on transformers in this stack (diffusers, accelerate, peft, optimum-quanto are all flexible), and upstream support for transformers 5 is still in flight: damian0815/ compel#129 ("Modernize Compel for Transformers 5") and mudler#128 ("Bump transformers version to >5.0") are both open as of today. backend.py only constructs Compel() when COMPEL=1 is set in the env (default off), so make compel a true optional extra: - Wrap the top-level `from compel import ...` in try/except ImportError, mirroring the existing sd_embed pattern. - Auto-disable COMPEL with a warning when the module isn't installed, instead of crashing on module load. - Drop compel from all eight requirements-*.txt variants so the resolver no longer has to satisfy its transformers cap. - Leave a TODO in backend.py and in each requirements file pointing at the upstream PR/issue, so the dependency can be reinstated once compel supports transformers >= 5. Users who rely on weighted-prompt embeddings can opt in with a manual `pip install compel` alongside COMPEL=1; the warning emitted on startup tells them how. Assisted-by: Claude:claude-opus-4-7 [Bash Read Edit WebFetch] Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 8452068 commit 7325046

9 files changed

Lines changed: 68 additions & 13 deletions

backend/python/diffusers/backend.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,19 @@
4040
from diffusers import FluxPipeline, FluxTransformer2DModel, AutoencoderKLWan
4141
from diffusers.pipelines.stable_diffusion import safety_checker
4242
from diffusers.utils import load_image, export_to_video
43-
from compel import Compel, ReturnedEmbeddingsType
43+
# TODO: re-enable compel as a hard dependency once it supports transformers >= 5.
44+
# Tracking upstream: https://github.com/damian0815/compel/pull/129
45+
# and https://github.com/damian0815/compel/issues/128
46+
# Until then compel pins transformers ~= 4.25, which forces the pip resolver into
47+
# multi-hour backtracking storms in CI when DEPS_REFRESH rotates the cache.
48+
# Keep the import optional and gate usage on the COMPEL env var (set COMPEL=1 to opt in).
49+
try:
50+
from compel import Compel, ReturnedEmbeddingsType
51+
COMPEL_AVAILABLE = True
52+
except ImportError:
53+
Compel = None
54+
ReturnedEmbeddingsType = None
55+
COMPEL_AVAILABLE = False
4456
from optimum.quanto import freeze, qfloat8, quantize
4557
from transformers import T5EncoderModel
4658
from safetensors.torch import load_file
@@ -66,6 +78,9 @@
6678

6779
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
6880
COMPEL = os.environ.get("COMPEL", "0") == "1"
81+
if COMPEL and not COMPEL_AVAILABLE:
82+
print("WARNING: COMPEL is enabled but the compel module is not installed. Install it manually (`pip install compel`) or unset COMPEL. Falling back to standard prompt processing.", file=sys.stderr)
83+
COMPEL = False
6984
SD_EMBED = os.environ.get("SD_EMBED", "0") == "1"
7085
# Warn if SD_EMBED is enabled but the module is not available
7186
if SD_EMBED and not SD_EMBED_AVAILABLE:

backend/python/diffusers/requirements-cpu.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ opencv-python
44
transformers
55
torchvision==0.22.1
66
accelerate
7-
compel
87
git+https://github.com/xhinker/sd_embed
98
peft
109
sentencepiece
1110
torch==2.7.1
1211
optimum-quanto
13-
ftfy
12+
ftfy
13+
# TODO: re-add compel once it supports transformers >= 5.
14+
# Tracking: https://github.com/damian0815/compel/pull/129
15+
# https://github.com/damian0815/compel/issues/128
16+
# compel currently pins transformers~=4.25, which forced pip into multi-hour
17+
# resolver backtracking storms in CI. backend.py imports it lazily and gates
18+
# the COMPEL=1 env var on the import succeeding, so dropping it here is safe.

backend/python/diffusers/requirements-cublas12.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ opencv-python
44
transformers
55
torchvision
66
accelerate
7-
compel
87
git+https://github.com/xhinker/sd_embed
98
peft
109
sentencepiece
1110
torch
1211
ftfy
1312
optimum-quanto
13+
# TODO: re-add compel once it supports transformers >= 5.
14+
# Tracking: https://github.com/damian0815/compel/pull/129
15+
# https://github.com/damian0815/compel/issues/128
16+
# compel currently pins transformers~=4.25, which forced pip into multi-hour
17+
# resolver backtracking storms in CI. backend.py imports it lazily and gates
18+
# the COMPEL=1 env var on the import succeeding, so dropping it here is safe.

backend/python/diffusers/requirements-cublas13.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ opencv-python
44
transformers
55
torchvision
66
accelerate
7-
compel
87
git+https://github.com/xhinker/sd_embed
98
peft
109
sentencepiece
1110
torch
1211
ftfy
1312
optimum-quanto
13+
# TODO: re-add compel once it supports transformers >= 5.
14+
# Tracking: https://github.com/damian0815/compel/pull/129
15+
# https://github.com/damian0815/compel/issues/128
16+
# compel currently pins transformers~=4.25, which forced pip into multi-hour
17+
# resolver backtracking storms in CI. backend.py imports it lazily and gates
18+
# the COMPEL=1 env var on the import succeeding, so dropping it here is safe.

backend/python/diffusers/requirements-hipblas.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ git+https://github.com/huggingface/diffusers
55
opencv-python
66
transformers
77
accelerate
8-
compel
98
peft
109
sentencepiece
1110
optimum-quanto
12-
ftfy
11+
ftfy
12+
# TODO: re-add compel once it supports transformers >= 5.
13+
# Tracking: https://github.com/damian0815/compel/pull/129
14+
# https://github.com/damian0815/compel/issues/128
15+
# compel currently pins transformers~=4.25, which forced pip into multi-hour
16+
# resolver backtracking storms in CI. backend.py imports it lazily and gates
17+
# the COMPEL=1 env var on the import succeeding, so dropping it here is safe.

backend/python/diffusers/requirements-intel.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ git+https://github.com/huggingface/diffusers
77
opencv-python
88
transformers
99
accelerate
10-
compel
1110
git+https://github.com/xhinker/sd_embed
1211
peft
1312
sentencepiece
1413
optimum-quanto
15-
ftfy
14+
ftfy
15+
# TODO: re-add compel once it supports transformers >= 5.
16+
# Tracking: https://github.com/damian0815/compel/pull/129
17+
# https://github.com/damian0815/compel/issues/128
18+
# compel currently pins transformers~=4.25, which forced pip into multi-hour
19+
# resolver backtracking storms in CI. backend.py imports it lazily and gates
20+
# the COMPEL=1 env var on the import succeeding, so dropping it here is safe.

backend/python/diffusers/requirements-l4t12.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ torch
33
git+https://github.com/huggingface/diffusers
44
transformers
55
accelerate
6-
compel
76
peft
87
optimum-quanto
98
numpy<2
109
sentencepiece
1110
torchvision
1211
ftfy
12+
# TODO: re-add compel once it supports transformers >= 5.
13+
# Tracking: https://github.com/damian0815/compel/pull/129
14+
# https://github.com/damian0815/compel/issues/128
15+
# compel currently pins transformers~=4.25, which forced pip into multi-hour
16+
# resolver backtracking storms in CI. backend.py imports it lazily and gates
17+
# the COMPEL=1 env var on the import succeeding, so dropping it here is safe.

backend/python/diffusers/requirements-l4t13.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ torch
33
git+https://github.com/huggingface/diffusers
44
transformers
55
accelerate
6-
compel
76
peft
87
optimum-quanto
98
numpy<2
109
sentencepiece
1110
torchvision
1211
ftfy
1312
chardet
13+
# TODO: re-add compel once it supports transformers >= 5.
14+
# Tracking: https://github.com/damian0815/compel/pull/129
15+
# https://github.com/damian0815/compel/issues/128
16+
# compel currently pins transformers~=4.25, which forced pip into multi-hour
17+
# resolver backtracking storms in CI. backend.py imports it lazily and gates
18+
# the COMPEL=1 env var on the import succeeding, so dropping it here is safe.

backend/python/diffusers/requirements-mps.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ git+https://github.com/huggingface/diffusers
44
opencv-python
55
transformers
66
accelerate
7-
compel
87
peft
98
sentencepiece
109
optimum-quanto
11-
ftfy
10+
ftfy
11+
# TODO: re-add compel once it supports transformers >= 5.
12+
# Tracking: https://github.com/damian0815/compel/pull/129
13+
# https://github.com/damian0815/compel/issues/128
14+
# compel currently pins transformers~=4.25, which forced pip into multi-hour
15+
# resolver backtracking storms in CI. backend.py imports it lazily and gates
16+
# the COMPEL=1 env var on the import succeeding, so dropping it here is safe.

0 commit comments

Comments
 (0)