Describe the bug
Can you please reconsider requiring transformers>=5.0.0 on the module-level solely for the optional prompt-enhancer (pe) component?
This is a significant burden for downstream projects that pin transformers 4.x for unrelated reasons. As one data point, migrating to transformers v5 in our project (OneTrainer) turned out to be a substantial breaking change well beyond Ernie itself (e.g. Nerogar/OneTrainer#1506)
We will eventually upgrade transformers, but I'd appreciate it if it isn't forced by upgrading diffusers.
Details:
if is_transformers_version("<", "5.0.0"):
raise ImportError("`ErnieImagePipeline` requires `transformers>=5.0.0` for `Ministral3ForCausalLM`.")
from transformers import Ministral3ForCausalLM # noqa: E402
Ministral3ForCausalLM is only used as the type of the optional pe/pe_tokenizer ("prompt enhancer") components (_optional_components = ["pe", "pe_tokenizer"]), which the pipeline runs perfectly well without
The actually-required components — text_encoder: Mistral3Model, the transformer, VAE and scheduler — work fine on transformers 4.x (Mistral3Model already exists there).
Because the guard is unconditional and at module scope, any code that imports ErnieImagePipeline at all — even without ever touching pe — is now forced onto transformers>=5.0.0, even though the core model doesn't need it.
Reproduction
import transformers
print(transformers.__version__) # e.g. 4.57.6
from diffusers import ErnieImagePipeline
Logs
4.57.6
Traceback (most recent call last):
...
ImportError: `ErnieImagePipeline` requires `transformers>=5.0.0` for `Ministral3ForCausalLM`.
System Info
not needed
Who can help?
Other: @yiyixuxu @DN6
Describe the bug
Can you please reconsider requiring
transformers>=5.0.0on the module-level solely for the optional prompt-enhancer (pe) component?This is a significant burden for downstream projects that pin
transformers4.x for unrelated reasons. As one data point, migrating totransformersv5 in our project (OneTrainer) turned out to be a substantial breaking change well beyond Ernie itself (e.g. Nerogar/OneTrainer#1506)We will eventually upgrade transformers, but I'd appreciate it if it isn't forced by upgrading diffusers.
Details:
Ministral3ForCausalLMis only used as the type of the optionalpe/pe_tokenizer("prompt enhancer") components (_optional_components = ["pe", "pe_tokenizer"]), which the pipeline runs perfectly well withoutThe actually-required components —
text_encoder: Mistral3Model, the transformer, VAE and scheduler — work fine on transformers 4.x (Mistral3Modelalready exists there).Because the guard is unconditional and at module scope, any code that imports
ErnieImagePipelineat all — even without ever touchingpe— is now forced ontotransformers>=5.0.0, even though the core model doesn't need it.Reproduction
Logs
System Info
not needed
Who can help?
Other: @yiyixuxu @DN6