Download reference/code/T3D/sample/jetengine_ext/layers/activation.py from Ouzhang/hku_diffusion_dllm: direct link, hf CLI and curl.
- Browser
- Download file 360 Bytes
-
https://huggingface.co/Ouzhang/hku_diffusion_dllm/resolve/main/reference/code/T3D/sample/jetengine_ext/layers/activation.py
- Command line
-
hf download hf://Ouzhang/hku_diffusion_dllm/reference/code/T3D/sample/jetengine_ext/layers/activation.py
-
curl -L -o activation.py https://huggingface.co/Ouzhang/hku_diffusion_dllm/resolve/main/reference/code/T3D/sample/jetengine_ext/layers/activation.py
360 Bytes
| import torch | |
| from torch import nn | |
| import torch.nn.functional as F | |
| from liger_kernel.ops.swiglu import LigerSiLUMulFunction | |
| class SiluAndMul(nn.Module): | |
| def __init__(self): | |
| super().__init__() | |
| def forward(self, x: torch.Tensor) -> torch.Tensor: | |
| x, y = x.chunk(2, -1) | |
| return LigerSiLUMulFunction.apply(x, y) | |