diffusers
cae82a76 - support group offloading under auto offloading (#14358)

Commit
4 days ago
support group offloading under auto offloading (#14358) Let group offloaded models take part in auto offloading `ComponentsManager.enable_auto_cpu_offload` and `enable_group_offload` are two independent hook systems — accelerate's `_hf_hook` and diffusers' `HookRegistry` — and neither noticed the other. Enabling both raised nothing and appeared to work, but auto offloading frees memory by calling `.to()`, which a group offloaded module refuses and only warns about. Every offload the manager thought it performed was a no-op: it recorded memory as freed that never was, and it charged a group offloaded model's whole weight against the device although only one group is ever resident. A group offloaded model now takes part but places itself. It still makes room by moving other models aside, since its `pre_forward` consults the strategy as before; it is never chosen as the thing to move, because moving it does nothing; and the manager no longer pretends to offload it. Either order works, group offload before or after enabling. Deciding *what* to move then has to come from somewhere other than memory estimates, so `enable_auto_cpu_offload` takes an `offload_strategy` and `set_offload_strategy` can replace it later. The default `AutoOffloadStrategy` sizes its decisions from model memory footprints, which do not describe a model holding one group at a time, so it warns when it meets group offloading — only when no strategy was passed. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Parents
Loading