You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to use a non-causal attention mask for a llama model with Unsloth and looking over the code to find the best way to achieve all the other speedups but use a non-causal attention mask.
I would appreciate some advice on places to look for code changes, prior to stepping through with a debugger.
Ye sadly non causal attention masks are not yet supported - there is a way though - you'll have to fork the project, then edit it to causal = False for FA, and Xformers will need a different causal mask
@danielhanchen I managed to get this working, but actually with a non-causal mask SDPA outperformed xformers by 12% (I didn't test FA). Using the unsloth LlamaAttention w/SDPA gave about 1.5% (fp32) - 2.5% (bf16), perf boost nonetheless.
Activity
brthor commentedon Jun 27, 2024
I realized my requirements are different than I at first thought, closing this.
danielhanchen commentedon Jul 1, 2024
Apologies relocated to SF, hence the delay!
Ye sadly non causal attention masks are not yet supported - there is a way though - you'll have to fork the project, then edit it to
causal = Falsefor FA, and Xformers will need a different causal maskbrthor commentedon Jul 1, 2024
@danielhanchen I managed to get this working, but actually with a non-causal mask SDPA outperformed xformers by 12% (I didn't test FA). Using the unsloth LlamaAttention w/SDPA gave about 1.5% (fp32) - 2.5% (bf16), perf boost nonetheless.
danielhanchen commentedon Jul 2, 2024
Interesting!!