MCPcopy Create free account
hub / github.com/Francis-Rings/StableAnimator / patch_geglu_inplace

Function patch_geglu_inplace

animation/utils/geglu_patch.py:4–9  ·  view source on GitHub ↗

Patch GEGLU with inplace multiplication to save GPU memory.

()

Source from the content-addressed store, hash-verified

2
3
4def patch_geglu_inplace():
5 """Patch GEGLU with inplace multiplication to save GPU memory."""
6 def forward(self, hidden_states):
7 hidden_states, gate = self.proj(hidden_states).chunk(2, dim=-1)
8 return hidden_states.mul_(self.gelu(gate))
9 diffusers.models.activations.GEGLU.forward = forward

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected