From 353e4c596260b535de95c48cacc3b732192787f4 Mon Sep 17 00:00:00 2001 From: ktyap Date: Wed, 9 Nov 2022 19:13:52 +0800 Subject: [PATCH] [#61] Bug fix CPU if no_cuda --- sgnlp/models/dialogue_rnn/eval.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sgnlp/models/dialogue_rnn/eval.py b/sgnlp/models/dialogue_rnn/eval.py index 782444c..2da8a42 100644 --- a/sgnlp/models/dialogue_rnn/eval.py +++ b/sgnlp/models/dialogue_rnn/eval.py @@ -23,7 +23,8 @@ def eval_model(model, dataloader, no_cuda=False): preprocessor = DialogueRNNPreprocessor(model.transformer_model_family, model.model, - model.tokenizer) + model.tokenizer, + no_cuda) for conversations, label, loss_mask, speaker_mask in tqdm(dataloader, leave=False): @@ -46,7 +47,7 @@ def eval_model(model, dataloader, no_cuda=False): labels_ = label.view(-1) # obtain log probabilities - output = model(features, lengths, umask, qmask) + output = model(features, lengths, umask, qmask, None, None, None, no_cuda) pred_ = output.prediction preds.append(pred_.data.cpu().numpy())