apex icon indicating copy to clipboard operation
apex copied to clipboard

How to load weights to MultiHeadAttention

Open hzqjyyx opened this issue 6 years ago • 1 comments

Hello,

The c++ version of multihead_attn looks so good. But when I run it, I do not find common weights of a selfattention module, like query,key and so on. So my question is, how to load weights to it?

BTW, does it have a tutorial for building a bert model based on it?

Thanks!

hzqjyyx avatar May 18 '20 15:05 hzqjyyx

If you would like to trigger a path that allows for separate Q,K, and V weights, you can trigger this path: https://github.com/NVIDIA/apex/blob/02a33875970e1b555754dfc4ab85d05595d23764/apex/contrib/multihead_attn/self_multihead_attn.py#L127

Otherwise, the weights are interleaved.

There is not a Bert specific tutorial.

kevinstephano avatar Jun 14 '20 02:06 kevinstephano