mirror of
https://github.com/Stability-AI/stablediffusion.git
synced 2024-12-22 07:34:58 +00:00
use pytorch built-in SiLU function to save GPU memory usage
This commit is contained in:
parent
cf1d67a6fd
commit
51c813001b
1 changed files with 2 additions and 1 deletions
|
@ -5,6 +5,7 @@ import torch.nn as nn
|
|||
import numpy as np
|
||||
from einops import rearrange
|
||||
from typing import Optional, Any
|
||||
import torch.nn.functional as F
|
||||
|
||||
from ldm.modules.attention import MemoryEfficientCrossAttention
|
||||
|
||||
|
@ -40,7 +41,7 @@ def get_timestep_embedding(timesteps, embedding_dim):
|
|||
|
||||
def nonlinearity(x):
|
||||
# swish
|
||||
return x*torch.sigmoid(x)
|
||||
return F.silu(x)
|
||||
|
||||
|
||||
def Normalize(in_channels, num_groups=32):
|
||||
|
|
Loading…
Reference in a new issue