Skip to content

fix(diffusion): inherit cpu offload hooks in from_pipe pipelines - #5759

Open
ChristianGruend wants to merge 3 commits into
odysseus-dev:devfrom
ChristianGruend:fix/inpaint-cpu-offload-oom-v2
Open

fix(diffusion): inherit cpu offload hooks in from_pipe pipelines#5759
ChristianGruend wants to merge 3 commits into
odysseus-dev:devfrom
ChristianGruend:fix/inpaint-cpu-offload-oom-v2

Conversation

@ChristianGruend

@ChristianGruend ChristianGruend commented Jul 26, 2026

Copy link
Copy Markdown

Summary

from_pipe() does not carry over CPU offload hooks from the source pipeline. When --cpu-offload is enabled, inpaint and img2img pipelines created via from_pipe() load their shared components fully onto the GPU instead of respecting the offload setting, causing an out-of-memory crash.

Target branch

  • This PR targets dev.

Linked Issue

Fixes #5759 — no separate issue was opened; the bug was discovered and fixed directly while testing CPU offload with inpaint/img2img pipelines.

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)

Checklist

  • I searched open issues and open PRs — this is not a duplicate.
  • My changes are limited to the scope described above — no unrelated refactors or whitespace changes mixed in.
  • I actually ran the app (docker compose up) and verified the change works end-to-end.

How to Test

  1. Start the app with --cpu-offload enabled.
  2. Load an image and trigger the inpaint or img2img pipeline (this uses from_pipe() internally to share the base pipeline).
  3. Without the fix: the process OOMs because the shared components load fully onto the GPU. With the fix: enable_model_cpu_offload() is called explicitly and the pipeline runs without OOM.

Visual / UI changes

Not applicable — this is a backend-only fix in scripts/diffusion_server.py, no UI/rendering code touched.

@github-actions github-actions Bot added needs work PR description incomplete — please update before review ready for review Description complete — ready for maintainer review and removed needs work PR description incomplete — please update before review labels Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant