We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Something like the following seems to be needed to run on GPU.
def predict_next(self): """Call the fairseq model.""" if self.use_cuda: lprobs, _ = self.model.forward_decoder( torch.cuda.LongTensor([self.consumed]), self.encoder_outs ) lprobs[0, self.pad_id] = utils.NEG_INF return np.array(lprobs[0].cpu()) else: lprobs, _ = self.model.forward_decoder( torch.LongTensor([self.consumed]), self.encoder_outs ) lprobs[0, self.pad_id] = utils.NEG_INF return np.array(lprobs[0])
The text was updated successfully, but these errors were encountered:
is this code tested? If yes I'm happy to update the code, or you can also make a PR / push it directly if you like.
Sorry, something went wrong.
that's enough testing for now - I'll have a go at updating it to 1.10.x in a few weeks
No branches or pull requests
Something like the following seems to be needed to run on GPU.
def predict_next(self):
"""Call the fairseq model."""
if self.use_cuda:
lprobs, _ = self.model.forward_decoder(
torch.cuda.LongTensor([self.consumed]), self.encoder_outs
)
lprobs[0, self.pad_id] = utils.NEG_INF
return np.array(lprobs[0].cpu())
else:
lprobs, _ = self.model.forward_decoder(
torch.LongTensor([self.consumed]), self.encoder_outs
)
lprobs[0, self.pad_id] = utils.NEG_INF
return np.array(lprobs[0])
The text was updated successfully, but these errors were encountered: