Skip to content

[Support for Cross-Attention] How to use cross-attention with magiattention #123

@zelingao98

Description

@zelingao98

Dear all,

thanks for the great work!
I am using this great magiattention.
However, I find it seems that magiattention only support self-attention.
e.g.,
q: [32*1024(seq_len), 12(num_head), 128(channel)]

k: [32*512(seq_len), 12(num_head), 128(channel)]

v: [32*512(seq_len), 12(num_head), 128(channel)]
the code will say something like:

[default0]:[rank0]: File "/opt/conda/lib/python3.10/site-packages/magi_attention/meta/_calc_dispatch_meta.py", line 241, in _calc_self_attn_dispatch_meta_from_qk_ranges
[default0]:[rank0]: assert total_seqlen_q == total_seqlen_k and num_chunks_q == num_chunks_k, (
[default0]:[rank0]: AssertionError: For self-attn, total_seqlen_q=32768 should be the same as total_seqlen_k=16384, as well as num_chunks_q=64 and num_chunks_k=32

Pls correct me if I am wrong.

Best!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions