"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "a14912858e71392e9240c87e7e162d5d203dcb4e"
Unverified Commit edb314ae authored by sungho-ham's avatar sungho-ham Committed by GitHub
Browse files

Fix torch.ones usage in xlnet (#28471)



Fix xlnet torch.ones usage
Co-authored-by: default avatarsungho-ham <sungho.ham@linecorp.com>
parent c45ef1c0
...@@ -976,7 +976,7 @@ class XLNetModel(XLNetPreTrainedModel): ...@@ -976,7 +976,7 @@ class XLNetModel(XLNetPreTrainedModel):
v [0 0 0 0 0 0 0 0 0] [1 1 1 1 0 0 0 0 0] v [0 0 0 0 0 0 0 0 0] [1 1 1 1 0 0 0 0 0]
""" """
mask = torch.ones(qlen, qlen + mlen, self.device) mask = torch.ones((qlen, qlen + mlen), device=self.device)
if self.same_length: if self.same_length:
mask_lo = mask[:, :qlen].tril(-1) mask_lo = mask[:, :qlen].tril(-1)
mask.triu_(mlen + 1) mask.triu_(mlen + 1)
......
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