Skip to content

Commit e600cfd

Browse files
authored
docs: fix assisted-generation code example #2 in zh (#3000)
1 parent aaefc43 commit e600cfd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

zh/assisted-generation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ forward_confirmation = model(generated).logits.argmax(-1)
9696

9797
# We exclude the opposing tips from each sequence: the forward pass returns
9898
# the logits for the next token, so it is shifted by one position.
99-
print(generated[:-1].tolist() == forward_confirmation[1:].tolist()) # True
99+
print(generated[0, 1:].tolist() == forward_confirmation[0, :-1].tolist()) # True
100100
```
101101

102102
这意味着你可以将模型前向传递用于不同的目的: 除了提供一些 token 来预测下一个标记外,你还可以将序列传递给模型并检查模型是否会生成相同的序列 (或部分相同序列)。

0 commit comments

Comments
 (0)