Skip to content

Commit

Permalink
Fixed DDP bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tatp22 committed Oct 10, 2020
1 parent c3e1a6a commit f10226a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linformer_pytorch/linformer_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def forward(self, Q, K, V, **kwargs):
K = self.E(K)
Q = torch.matmul(Q, K)

P_bar = Q/torch.sqrt(torch.tensor(self.dim).type(Q.type()))
P_bar = Q/torch.sqrt(torch.tensor(self.dim).type(Q.type())).to(Q.device)
if self.causal_mask is not None:
self.causal_mask = self.causal_mask.to(Q.device)
P_bar = P_bar.masked_fill_(~self.causal_mask, float('-inf'))
Expand Down

0 comments on commit f10226a

Please sign in to comment.