Skip to content

Commit fd97ed4

Browse files
krkvbrianjo
andauthored
Update chatbot_tutorial.py (#1535)
Fix lengths to cpu. See issue #1300 Co-authored-by: Brian Johnson <[email protected]>
1 parent ee37770 commit fd97ed4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beginner_source/chatbot_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ def evaluate(encoder, decoder, searcher, voc, sentence, max_length=MAX_LENGTH):
12071207
input_batch = torch.LongTensor(indexes_batch).transpose(0, 1)
12081208
# Use appropriate device
12091209
input_batch = input_batch.to(device)
1210-
lengths = lengths.to(device)
1210+
lengths = lengths.to("cpu")
12111211
# Decode sentence with searcher
12121212
tokens, scores = searcher(input_batch, lengths, max_length)
12131213
# indexes -> words

0 commit comments

Comments
 (0)