mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-17 00:23:14 +00:00
f912a79914
https://github.com/Francis-Rings/StableAnimator/commit/0f3d85ad217c0d3edec89e310bb34c3ecb9eaf9b
10 lines
353 B
Python
10 lines
353 B
Python
import diffusers.models.activations
|
|
|
|
|
|
def patch_geglu_inplace():
|
|
"""Patch GEGLU with inplace multiplication to save GPU memory."""
|
|
def forward(self, hidden_states):
|
|
hidden_states, gate = self.proj(hidden_states).chunk(2, dim=-1)
|
|
return hidden_states.mul_(self.gelu(gate))
|
|
diffusers.models.activations.GEGLU.forward = forward
|