知识卡片
采样参数要与生成模式配合
设置top_p或top_k并不自动保证实际启用随机采样,还要核对生成模式和完整配置。原书top-p代码未显式do_sample,不能只凭参数名宣称它已按核采样运行;实现需检查实际生效的配置。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 按任务适配模型
原书出处 · 1 处
- · 查看原书依据
output = model.generate(**inputs, max_new_tokens=50, top_p=0.9) print(tokenizer.decode(output[0], skip_special_tokens=True)) Figure 5-9 shows an example of top-p sampling using the FLAN-T5 model. Top-p sampling, also called nucleus sampling, is the most popular sampling strategy used today. Figure 5-9. Top-p sampling Note So far, the decoding approaches we have seen operate serially; i.e., each token is generated one at a time, with a full pass through the model each
参考来源
- 位置:《Designing Large Language Model Applications》第05章《按任务适配模型》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Designing Large Language Model Applications/_epub-src/OEBPS/ch05.html)
- 结论依据:摘录中关于采样参数要与生成模式配合的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:output = model.generate(**inputs, max_new_tokens=50, top_p=0.9) print(tokenizer.decode(output[0], skip_special_tokens=True)) Figure 5-9 shows an example of top-p sampling using the FLAN-T5 model. Top-p sampling, also called nucleus sampling, is the most popular sampling strategy used today. Figure 5-9. Top-p sampling Note So far, the decoding approaches we have seen operate serially; i.e., each token is generated one at a time, with a full pass through the model each