How should `ModularPipeline` handle a component that failed to load?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 15/100
Research direction
Start in ModularPipeline.load_components, where each component load sits inside a try/except that logs a warning and leaves None. The example reproduces through Qwen2VLProcessor raising an ImportError for missing torchvision, so trace how that error reaches the modular path. Done means maintainers have agreed on whether a failed load should raise, be marked as deferred, or stay a warning, and that decision is recorded in the thread before any code is written.
Written by the indexing model from the issue text.
Description
What happens today
ModularPipeline.load_components wraps every component load in try/except. When one fails, it logs a warning and carries on with the others, leaving None for the component that failed.
My motivation for this was that loading is a time-consuming process, and one failure should not force the user to load everything again. If the component is optional (e.g. a safety checker that needs an external dependency that is not installed), they can simply skip it. If it is required and failed for a legitimate reason (e.g. a missing dependency), it is better that they load it separately and pass it with update_components than reload everything.
The other side of this is that a warning is not loud enough. If you do not notice it, the failure comes back at run time as an AttributeError or TypeError on None inside a block, far from the warning that explained the cause. In diffusers we prefer things to be explicit, and silently carrying on with a None component is not.
Example
Qwen2VLProcessor bundles a video processor that only has a torchvision implementation, and torchvision is not installed by diffusers or transformers. In an environment without it:
from diffusers import ModularPipeline
pipe = ModularPipeline.from_pretrained("Qwen/Qwen-Image-Edit")
pipe.load_components(names=["tokenizer", "processor"])
# logs: Failed to create component processor: ... you can safely ignore this message ...
# ImportError: Qwen2VLVideoProcessor requires the Torchvision library but it was not found in your environment.
print(pipe.processor) # None
Running the pipeline afterwards fails in the text encoder block when it calls the None processor. Loading the same processor directly, or through DiffusionPipeline.from_pretrained, raises the ImportError right away, so this only happens on the modular path.
Feedback and suggestions welcome.
Opened by Claude on behalf of @yiyixuxu
- Dominant language
- Python
- Stars
- 35k
- Forks
- 7.5k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 58
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from huggingface/diffusers
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
huggingface/diffusers#15436 · 1 comment ·
Maintainers usually reply within 1 day
-
InpaintProcessor crashes when padding_mask_crop is set and a dimension is omittedPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
huggingface/diffusers#15433 ·
Maintainers usually reply within 1 day
-
LTXEulerAncestralRFScheduler skips signal scaling with s_noise=0Possibly taken @hparik11 claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
huggingface/diffusers#15423 · 2 comments ·
Maintainers usually reply within 1 day
-
Docs: 13 docstrings document parameters their functions don't havePossibly taken @M-Colley claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
huggingface/diffusers#15363 · 2 comments ·
Maintainers usually reply within 1 day
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeErrorPossibly taken @chessing234 claimed this 11 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
huggingface/diffusers#15337 · 3 comments ·
Maintainers usually reply within 1 day
All issues in huggingface/diffusers
Similar issues
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
MakazhanAlpamys/Soup#3589 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/clickhouse-connect#1266 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
biosustain/growthcurves_app#89 ·
Maintainers usually reply within 1 day
-
`LogProxyConsumer._on_relation_departed` raises `APIError` when the promtail service does not existOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
canonical/loki-k8s-operator#695 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day