"projects/vscode:/vscode.git/clone" did not exist on "98313d4a25fad370f1c0b8859a65d98b1114df8e"
Unverified Commit 95395837 authored by Ivan Dolgov's avatar Ivan Dolgov Committed by GitHub
Browse files

XLNet Bug when training with apex 16-bit precision (#6567)



* xlnet fp16 bug fix

* comment cast added

* Update modeling_xlnet.py
Co-authored-by: default avatarKevin Canwen Xu <canwenxu@126.com>
parent 505f2d74
......@@ -446,7 +446,8 @@ class XLNetRelativeAttention(nn.Module):
v_head_h = torch.einsum("ibh,hnd->ibnd", cat, self.v)
# positional heads
k_head_r = torch.einsum("ibh,hnd->ibnd", r, self.r)
# type casting for fp16 support
k_head_r = torch.einsum("ibh,hnd->ibnd", r.type(self.r.dtype), self.r)
# core attention ops
attn_vec = self.rel_attn_core(
......
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