apex
apex copied to clipboard
How to load weights to MultiHeadAttention
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!
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.