Skip to content
Snippets Groups Projects
Commit e9ae3132 authored by Zhengxiao Du's avatar Zhengxiao Du
Browse files

Fix attention mask

parent 7c35e218
No related branches found
No related tags found
No related merge requests found
......@@ -52,9 +52,8 @@ def standard_attention(query_layer, key_layer, value_layer, attention_mask,
if log_attention_weights is not None:
attention_scores += log_attention_weights
# if attention_mask.shape[-2] > 1: # if auto-regressive, skip
# attention_scores = torch.mul(attention_scores, attention_mask) - \
# 10000.0 * (1.0 - attention_mask)
attention_scores = torch.mul(attention_scores, attention_mask) - \
10000.0 * (1.0 - attention_mask)
attention_probs = F.softmax(attention_scores, dim=-1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment