How does group offloading work in diffusers v0.41.0 for video models (block_level vs leaf_level, streams, disk), which combinations raise errors, and which numbers exist for it with hardware?
Group offloading (ModelMixin.enable_group_offload, DiffusionPipeline.enable_group_offload, hooks.apply_group_offloading) moves groups of layers between CPU/disk and the accelerator. The source at the pin turns several documented cautions into hard errors: block_level needs num_blocks_per_group; record_stream needs use_stream; use_stream needs a non-CPU backend with streams; Accelerate hooks on the same module conflict; model/sequential CPU offload on a pipeline that has any group-offloaded component raises; disk offload with torchao tensors raises. Documented softer cautions: weight-dependent device casting may clash, streams need about 2x CPU memory of the model, block_level with streams is forced to 1 block per group, VAEs with streams and tiling need a dummy forward pass. Timing/memory numbers linked by the guide are a Flux table (no GPU named) and a Wan table (no GPU, size or resolution named), both from a proof-of-concept PR; no video-model benchmark with named hardware was fou...
Structured fields
{
"citations": [
{
"url": "https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/docs/source/en/optimization/memory.md",
"note": "group_offloading.py L670-682, L999-1002, L1025-1027"
},
{
"url": "https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/src/diffusers/hooks/group_offloading.py",
"note": "group_offloading.py L670-682, L999-1002, L1025-1027"
},
{
"url": "https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/src/diffusers/pipelines/pipeline_utils.py",
"note": "group_offloading.py L670-682, L999-1002, L1025-1027"
},
{
"url": "https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/src/diffusers/models/modeling_utils.py",
"note": "group_offloading.py L670-682, L999-1002, L1025-1027"
},
{
"url": "https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/src/diffusers/models/autoencoders/autoencoder_kl_wan.py",
"note": "group_offloading.py L670-682, L999-1002, L1025-1027"
},
{
"url": "https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/docs/source/en/optimization/speed-memory-optims.md",
"note": "group_offloading.py L670-682, L999-1002, L1025-1027"
},
{
"url": "https://github.com/huggingface/diffusers/pull/11682",
"note": "group_offloading.py L670-682, L999-1002, L1025-1027"
},
{
"url": "https://github.com/huggingface/diffusers/pull/11682",
"note": "cited at https://github.com/huggingface/diffusers/pull/11682#issuecomment-2955715126; group_offloading.py L670-682, L999-1002, L1025-1027"
}
]
}Evidence claims
- [sourced_fact] Group offloading (ModelMixin.enable_group_offload, DiffusionPipeline.enable_group_offload, hooks.apply_group_offloading) moves groups of layers between CPU/disk and the accelerator. The source at the pin turns several documented cautions into hard errors: block_level needs num_blocks_per_group; record_stream needs use_stream; use_stream needs a non-CPU backend with streams; Accelerate hooks on the same module conflict; model/sequential CPU offload on a pipeline that has any group-offloaded component raises; disk offload with torchao tensors raises. Documented softer cautions: weight-dependent device casting may clash, streams need about 2x CPU memory of the model, block_level with streams is forced to 1 block per group, VAEs with streams and tiling need a dummy forward pass. Timing/memory numbers linked by the guide are a Flux table (no GPU named) and a Wan table (no GPU, size or resolution named), both from a proof-of-concept PR; no video-model benchmark with named hardware was found for group offloading in the pages read. · locator: group_offloading.py L670-682, L999-1002, L1025-1027 source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |
Linked records
- cites → https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/docs/source/en/optimization/memory.md
- cites → https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/docs/source/en/optimization/speed-memory-optims.md
- cites → https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/src/diffusers/hooks/group_offloading.py
- cites → https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/src/diffusers/models/autoencoders/autoencoder_kl_wan.py
- cites → https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/src/diffusers/models/modeling_utils.py
- cites → https://github.com/huggingface/diffusers/blob/086bf9578c0f4acbc66e48cd1e7cc26befd9e10f/src/diffusers/pipelines/pipeline_utils.py
- cites → https://github.com/huggingface/diffusers/pull/11682