2022-12-23 12:57:41 +00:00
|
|
|
from .cuda_native import FusedScaleMaskSoftmax, LayerNorm, MultiHeadAttention
|
2021-12-21 04:19:52 +00:00
|
|
|
|
2022-12-23 12:57:41 +00:00
|
|
|
try:
|
|
|
|
from colossalai._C import fused_optim
|
|
|
|
except:
|
|
|
|
from colossalai.kernel.op_builder.fused_optim import FusedOptimBuilder
|
|
|
|
fused_optim = FusedOptimBuilder().load()
|
|
|
|
|
|
|
|
try:
|
|
|
|
from colossalai._C import cpu_optim
|
|
|
|
except ImportError:
|
|
|
|
from colossalai.kernel.op_builder import CPUAdamBuilder
|
|
|
|
cpu_optim = CPUAdamBuilder().load()
|
|
|
|
|
2022-12-27 08:06:09 +00:00
|
|
|
try:
|
|
|
|
from colossalai._C import multihead_attention
|
|
|
|
except ImportError:
|
|
|
|
from colossalai.kernel.op_builder import MultiHeadAttnBuilder
|
|
|
|
multihead_attention = MultiHeadAttnBuilder().load()
|
|
|
|
|
2022-12-30 01:58:00 +00:00
|
|
|
try:
|
|
|
|
from colossalai._C import scaled_upper_triang_masked_softmax
|
|
|
|
except ImportError:
|
|
|
|
from colossalai.kernel.op_builder import ScaledSoftmaxBuilder
|
|
|
|
scaled_upper_triang_masked_softmax = ScaledSoftmaxBuilder().load()
|
|
|
|
|
2023-01-03 12:29:39 +00:00
|
|
|
try:
|
|
|
|
from colossalai._C import moe
|
|
|
|
except ImportError:
|
|
|
|
from colossalai.kernel.op_builder import MOEBuilder
|
|
|
|
moe = MOEBuilder().load()
|
|
|
|
|
2022-12-27 08:06:09 +00:00
|
|
|
__all__ = [
|
2023-01-03 12:29:39 +00:00
|
|
|
"fused_optim",
|
|
|
|
"cpu_optim",
|
|
|
|
"multihead_attention",
|
|
|
|
"moe",
|
|
|
|
"LayerNorm",
|
|
|
|
"FusedScaleMaskSoftmax",
|
|
|
|
"MultiHeadAttention",
|
|
|
|
"scaled_upper_triang_masked_softmax",
|
2022-12-27 08:06:09 +00:00
|
|
|
]
|