from_pretrained fails loading deprecated pipelines
Note: I understand these pipelines are deprecated and bugfixes aren't accepted anymore. But this seems to be a bug in the process of moving pipelines to deprecated itself
Describe the bug
_get_custom_components_and_folders (src/diffusers/pipelines/pipeline_loading_utils.py) resolves custom pipeline components by checking hasattr(diffusers.pipelines, module_candidate). Since #13157 moved several pipelines (e.g. Wuerstchen) to diffusers.pipelines.deprecated.<name>, that check no longer finds them, even though the relocated module still exists.
Reproduction
from diffusers import DiffusionPipeline
DiffusionPipeline.from_pretrained("warp-ai/wuerstchen-prior")
ValueError: prior/wuerstchen.py as defined in `model_index.json` does not exist in warp-ai/wuerstchen-prior and is not a module in 'diffusers/pipelines'.
model_index.json declares "prior": ["wuerstchen", "WuerstchenPrior"]. hasattr(diffusers.pipelines, "wuerstchen") is False, but hasattr(diffusers.pipelines.deprecated, "wuerstchen") is True — confirming the module just moved out from under the check.
Suggested fix: have _get_custom_components_and_folders also check diffusers.pipelines.deprecated before raising.
System Info
- diffusers commit: 0f1abc4ae8b0eb2a3b40e82a310507281144c423 (main)
- Python: 3.12
- Platform: Linux
Who can help?
@yiyixuxu @stevhliu
Drafted by Claude
I have a small fix for this. It looks like a bug in the deprecation mechanism: pipelines relocated under diffusers.pipelines.deprecated are not recognized by the loader, so from_pretrained wrongly treats them as a missing custom module. Opening a PR now with a regression test.