diffusers
84eb5d53 - Build the unfused projections on the meta device

Commit
56 days ago
Build the unfused projections on the meta device unfuse_projections reconstructs to_q/to_k/to_v by pointing them at views into the fused weight, but built the layers on the default device first -- so every reconstructed projection was materialised and Kaiming-initialised in float32 only to have its parameters immediately replaced. On a 5.5B-parameter bf16 Flux transformer that is 3.4 GiB of allocation and 4.0s of wasted init; on `meta` it is nothing measurable and 18ms. The Wan-family transformers inherit this method, so they get the same saving. The accompanying test checks that no parameter is left on meta, which is the new hazard: one that is not replaced by a view would break the module. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Parents
Loading