← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 6502.d.1 · 生成模型:GPT-6

相同参数名需核对实际分支

理解等级:高级

本章 sample_response 在温度为零时跳过缩放,但仍调用随机抽样;前章生成器则把零温度当贪心。两函数在常用正温度下可能一致,不代表所有参数取值行为相同。迁移接口时需逐项检查特殊值语义。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      if temperature and temperature != 1.0: #B logits = logits / temperature probas = torch.softmax(logits, dim=-1) probas = top_p_filter(probas, top_p) #C next_token = torch.multinomial( probas.cpu(), num_samples=1 ).to(device) if ( tokenizer.eos_token_id is not None and next_token.item() == tokenizer.eos_token_id ): break generated.append(next_token.item()) logits = model(next_token, cache=cache)[:, -1] full_token_ids = torch.cat( [input_ids,

    参考来源

    - 位置:《Build a Reasoning Model (From Scratch)》第06章《强化学习训练推理模型》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Build a Reasoning Model (From Scratch)/_epub-src/OEBPS/Text/chapter-6.html) - 结论依据:摘录中关于相同参数名需核对实际分支的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:if temperature and temperature != 1.0: #B logits = logits / temperature probas = torch.softmax(logits, dim=-1) probas = top_p_filter(probas, top_p) #C next_token = torch.multinomial( probas.cpu(), num_samples=1 ).to(device) if ( tokenizer.eos_token_id is not None and next_token.item() == tokenizer.eos_token_id ): break generated.append(next_token.item()) logits = model(next_token, cache=cache)[:, -1] full_token_ids = torch.cat( [input_ids,