NVIDIA / NVIDIA/TransformerEngine

thd qkv-format in transformer layer

Open
#1,383 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

attention
Dominant language
Python
Stars
3.5k
Forks
831
Avg merge
3d 11h
Merged PRs (30d)
65

Description

Hello!
I'm currently trying to rewrite my pipeline with TE. I use merged sequences for LM and as far as I know I should use "thd" format for it.
I see that MultiheadAttention class (from here) doesn't support this format (as there is no mention of tithed in args annotation). But DotProductAttention seems to be support "thb".
When I pass qkv_format = "thd" in transformer layer it looks like the only reason why it doesn't work is that in MultiheadAttention we need to pass cu_seqlens to DotProductAttention. Am I correct about it? Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in transformer_engine/pytorch/attention.py, comparing MultiheadAttention and DotProductAttention handling of qkv_format and cu_seqlens. Determine the required behavior for thd inputs in the transformer layer; done means merged-sequence inputs are accepted and the intended support is covered by the relevant existing tests, if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.