Skip to content

How to implement Bidirectional Alibi with padding using flex attention? #74

Open
@sphmel

Description

@sphmel

Hi, I want to use FlexAttention for alibi with padding(no bias)

If seq_len is 5 I want to make alibi tensor like below, which is alibi tensor with seq_len, and last item is not penalized

0 -1 -2 -3 0
-1 0 -1 -2 0
-2 -1 0 -1 0
-3 -2 -1 0 0
0 0 0 0 0

How can I implement score mod like this? seq_len can be different every forward. Such alibi is used in Voicebox paper. I'm new to BatchedTensor or maybe vmap API? I do not know how to implement it at all. Can you help me?

Metadata

Metadata

Assignees

No one assigned

    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