"vscode:/vscode.git/clone" did not exist on "79a82cc06aaa68088639bf9bb000752cfd33a8c6"
Unverified Commit 1e4a1913 authored by Thomas Wolf's avatar Thomas Wolf Committed by GitHub
Browse files

Merge pull request #1284 from slayton58/pooler_end_logits_fp16_fix

Fix fp16 masking in PoolerEndLogits
parents 6971556a c50783e3
......@@ -501,7 +501,10 @@ class PoolerEndLogits(nn.Module):
x = self.dense_1(x).squeeze(-1)
if p_mask is not None:
x = x * (1 - p_mask) - 1e30 * p_mask
if next(self.parameters()).dtype == torch.float16:
x = x * (1 - p_mask) - 65500 * p_mask
else:
x = x * (1 - p_mask) - 1e30 * p_mask
return x
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment