知识卡片

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

关闭梯度与切换评估有别

理解等级:中级

inference_mode 禁用推理期间不需要的自动微分跟踪;eval 切换受训练状态影响的层的行为,两者职责不同。仅对某个输出 detach 不能撤销此前已建立计算图的成本;eval 也不能保证所有设备和算子的结果完全一致。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      #A Disable gradient tracking for speed and memory efficiency #B Switch model to evaluation mode to enable deterministic behavior (best practice) #C Get the scores of the last token #D Stop if all sequences in the batch have generated EOS

    参考来源

    - 位置:《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) - 结论依据:摘录中关于关闭梯度与切换评估有别的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:#A Disable gradient tracking for speed and memory efficiency #B Switch model to evaluation mode to enable deterministic behavior (best practice) #C Get the scores of the last token #D Stop if all sequences in the batch have generated EOS