{"slug": "one-more-measured-note-for-diffusers-named-containers-never-hook-as-blocks", "title": "One more measured note for diffusers — named containers never hook as blocks", "summary": "Hugging Face merged diffusers pull request #15409 on November 28, 2026, which warns on and ignores redundant ModuleList names so group offloading preserves child grouping, fixing issue #15386. In a test on a Tesla T4 with three FP32 Linear/Tanh blocks in one container and two in another, released 0.43.0 registered 2 groups and 2 group-hook entries that hooked only the two containers, while the fixed revision registered 5 groups and 5 entries that hooked the five children, with onload/offload method calls rising from 0/0 to 5/5 and output matching a no-offload reference at a max absolute difference of 0.0 across three forwards. The tested fix was revision ffd566461df1ab130c46bee8b0131469bcc756ed, not the released wheel; the latest release on November 29 was still 0.43.0 from November 12.", "body_md": "In addition to counting the groups, I also checked whether the hooks actually fired and compared the outputs:\n\nI tested the three-plus-two-block selection difference with real Diffusers hooks on a small CUDA model.\n\n[PR #15409](https://github.com/huggingface/diffusers/pull/15409), addressing [issue #15386](https://github.com/huggingface/diffusers/issues/15386), merged on November 28, 2026. It warns and ignores redundant `ModuleList` names, preserving child grouping. Named `Sequential` modules still take the explicit selection path.\n\nOn a Tesla T4 I used three FP32 Linear/Tanh blocks in one container and two in another, not a FLUX checkpoint. Both names were supplied, with group size one and streams enabled.\n\n| Observation | Released 0.43.0 | With the ModuleList change | \n|---|---|---|\n| Unique groups / registered group-hook entries | 2 / 2 | 5 / 5 | \n| Hook locations | The two containers | The five children | \n| Input and weight at the first block’s computation | CUDA input, CPU weight | Both CUDA | \n| Onload / offload method calls during the first attempted forward | 0 / 0 | 5 / 5 | \n| Output comparison against a no-offload reference | Stopped at a device-mismatch check | Max absolute difference 0.0 on each of three forwards | \n\nThe failure was an explicit device check in my block immediately before Linear, not an uninstrumented PyTorch matmul exception. Transfer counts are real group method invocations, not every hook callback or a GPU copy trace. Both the functional-hunk variant and the fixed source gave the result on the right.\n\nA directly called named `Sequential` already worked with two parent groups. Manually iterating its children bypassed those groups and triggered the guard. The actual call boundary matters.\n\nThe latest [release](https://github.com/huggingface/diffusers/releases/tag/v0.43.0) on November 29 was still 0.43.0 (November 12). The tested fixed revision was `ffd566461df1ab130c46bee8b0131469bcc756ed`; it was not the released wheel.\n\nStart with automatic grouping for ordinary `ModuleList` blocks. Removing redundant names avoids the old selection branch.\n\nOmitting `block_modules` or setting `None` can select the model’s `_group_offload_block_modules` defaults; `[]` bypasses that fallback in the inspected versions. Preserve custom callable parent names that are actually needed.\n\n| Situation | First thing I would try | \n|---|---|\n| Ordinary ModuleLists, no special parent selection needed | Use automatic block grouping. | \n| Pinned to 0.43.0 and supplying redundant list names | Remove the redundant names; check whether a model default reintroduces them. | \n| Model default only contains redundant lists | An explicit empty list is a candidate on the old release; verify the resulting groups. | \n| Model default also identifies real callable parent modules | Preserve those deliberately selected parents; remove only the redundant list entries if needed. | \n| Sequential or custom container is called as a unit | A parent-level group can be intentional. | \n| Children are called individually instead | Prefer a grouping boundary that the real forward path reaches. | \n\nStart diagnosis with a fresh model, `block_level`, size one, and `use_stream=False`; repeat with streams at size one and multiple forwards once correct. Turning off streams does not fix the named-list selection problem.\n\nSee the [memory optimization guide](https://huggingface.co/docs/diffusers/optimization/memory) for configuration options.\n\nThe counting result therefore has an execution counterpart. The merged change restores child grouping for redundant ModuleList names; matching group ownership to actual execution and checking repeated reference parity are useful before measuring memory or speed.", "url": "https://wpnews.pro/news/one-more-measured-note-for-diffusers-named-containers-never-hook-as-blocks", "canonical_source": "https://discuss.huggingface.co/t/one-more-measured-note-for-diffusers-named-containers-never-hook-as-blocks/192464#post_2", "published_at": "2026-11-29 08:52:15+00:00", "updated_at": "2026-11-29 09:13:36.124016+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-infrastructure", "generative-ai", "mlops"], "entities": ["Hugging Face", "diffusers", "pull request #15409", "issue #15386", "Tesla T4", "FLUX", "PyTorch"], "also_reported_by": [], "takeaway": "With the merged ModuleList fix, redundant container names no longer hijack group offloading: the same T4 test went from 2 hooked containers to 5 hooked children, 5/5 onload/offload calls, and 0.0 max output difference versus a no-offload reference.", "recommendation": {"advice": "Use automatic block grouping for ordinary ModuleList blocks and drop redundant list names; diagnose with a fresh model, block_level, group size one and use_stream=False, then verify repeated forwards match a no-offload reference before measuring memory or speed.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/one-more-measured-note-for-diffusers-named-containers-never-hook-as-blocks", "markdown": "https://wpnews.pro/news/one-more-measured-note-for-diffusers-named-containers-never-hook-as-blocks.md", "text": "https://wpnews.pro/news/one-more-measured-note-for-diffusers-named-containers-never-hook-as-blocks.txt", "jsonld": "https://wpnews.pro/news/one-more-measured-note-for-diffusers-named-containers-never-hook-as-blocks.jsonld"}}