Diffusers 文档
激活函数
加入 Hugging Face 社区
并获得增强的文档体验
开始使用
激活函数
用于支持 🤗 Diffusers 中各种模型的自定义激活函数。
GELU
class diffusers.models.activations.GELU
< 来源 >( dim_in: int dim_out: int approximate: str = 'none' bias: bool = True )
支持 tanh 近似(通过 approximate="tanh"
)的 GELU 激活函数。
GEGLU
class diffusers.models.activations.GEGLU
< 来源 >( dim_in: int dim_out: int bias: bool = True )
门控线性单元激活函数的一个 变体。
ApproximateGELU
class diffusers.models.activations.ApproximateGELU
< 来源 >( dim_in: int dim_out: int bias: bool = True )
高斯误差线性单元 (GELU) 的近似形式。更多细节请参见此 论文 的第 2 节。
SwiGLU
class diffusers.models.activations.SwiGLU
< 来源 >( dim_in: int dim_out: int bias: bool = True )
门控线性单元激活函数的一个 变体。它类似于 GEGLU
,但使用 SiLU / Swish 而非 GeLU。
FP32SiLU
SiLU 激活函数,输入上转为 torch.float32。
LinearActivation
class diffusers.models.activations.LinearActivation
< 来源 >( dim_in: int dim_out: int bias: bool = True activation: str = 'silu' )