← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 6501.f · 生成模型:GPT-6

标量停止条件限制批处理

理解等级:中级

本章 next_token.item() 的停止检查只适用于一个元素;不能依据注释宣称它会等待批内全部序列结束。扩展到批量需按样本维护完成掩码并定义补齐和输出边界,否则可能报错或错误提前终止。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      #D Stop if all sequences in the batch have generated EOS #E Append the newly predicted token to the sequence #F Return only the generated tokens (excluding the original input) In essence, the generate_text_basic function listing 2.2 applies the argmax-based token ID extraction via a for-loop for a user-specified number of iterations (max_new_tokens). It returns the generated token IDs, similar to what's shown in figure

    参考来源

    - 位置:《Build a Reasoning Model (From Scratch)》第02章《使用预训练模型生成文本》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-2.html) - 结论依据:摘录中关于标量停止条件限制批处理的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:#D Stop if all sequences in the batch have generated EOS #E Append the newly predicted token to the sequence #F Return only the generated tokens (excluding the original input) In essence, the generate_text_basic function listing 2.2 applies the argmax-based token ID extraction via a for-loop for a user-specified number of iterations (max_new_tokens). It returns the generated token IDs, similar to what's shown in figure