Update 5.在无标记数据集上进行预训练.md

修复代码错误
This commit is contained in:
long_long_ago 2025-09-07 09:02:42 +08:00 committed by GitHub
parent 8f18f81dec
commit 592cc35a7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -158,7 +158,7 @@ inputs = torch.tensor([[16833, 3626, 6100], # ["every effort moves",
[40, 1107, 588]]) # "I really like"] [40, 1107, 588]]) # "I really like"]
# Matching these inputs, the `targets` contain the token IDs we aim for the model to produce: # Matching these inputs, the `targets` contain the token IDs we aim for the model to produce:
targets = torch.tensor([[3626, 6100, 345 ], # [" effort moves you", targets = torch.tensor([[3626, 6100, 345 ], # [" effort moves you",
[107, 588, 11311]]) # " really like chocolate"] [1107, 588, 11311]]) # " really like chocolate"]
``` ```
需要注意的是,目标值中展示的是输入数据向前偏移了一个位置。我们在第 2 章实现数据加载器时已介绍过这一概念。这种偏移策略对于教会模型预测序列中的下一个 token 至关重要。 需要注意的是,目标值中展示的是输入数据向前偏移了一个位置。我们在第 2 章实现数据加载器时已介绍过这一概念。这种偏移策略对于教会模型预测序列中的下一个 token 至关重要。