FlagOpen / FlagGems

FlagGems is an operator library for large language models implemented in Triton Language.
Apache License 2.0
347 stars 49 forks source link

Code Contribution: 【Lv3】【Bug Fix】- Incompatibility of backward operators when using torch.compile #249

Closed Bowen12992 closed 1 week ago

Bowen12992 commented 1 month ago
import flag_gems
import torch
flag_gems.enable()
def f(x,y):
    a =  torch.tanh(y)
    b = x - y
    return flag_gems.fused.gelu_and_mul(a,b)
x = torch.randn(10,device="cuda")
y = torch.randn(10,device="cuda")
F=torch.compile(f)
print(F(x,y))

tanh 在 使用 triton3.0 torch2.4 的时候会有报错: 注:不同的 triton3.0 torch2.4 版本会有不同的报错,可以定位解决最新版本的即可

Tango2018cc commented 1 month ago

认领方式:

  1. Issue中留言评论:「认领人名称+认领」
  2. 在贡献者微信群内发送:认领的Issue号例如:「认领+[https://github.com/FlagOpen/FlagGems/issues/xxx」]
yinfan98 commented 1 month ago

尹帆 认领

Tango2018cc commented 1 month ago

领取后,请于11.15日前完成,谢谢

yinfan98 commented 1 month ago

PR: https://github.com/FlagOpen/FlagGems/pull/263