← 返回刚才阅读的位置

知识卡片

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

填充与结束共用标识会影响监督

理解等级:中级

把GPT-2的pad_token设成eos_token可解决接口缺少PAD的问题,却使同一ID承担两种语义。若collator按pad_token_id将标签置为忽略,真实EOS也可能失去监督;应核对所用实现,保留停止行为的验证。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      >>> tokenizer.pad_token = tokenizer.eos_token #1 >>> vanilla_gpt2 = GPT2LMHeadModel.from_pretrained('gpt2') #1 Setting the padding token to avoid ValueErrors downstream when attempting to do prediction Once you have loaded the GPT-2 model, you still need to process the input prompt to get it into a format the language model can understand. You need to tokenize and encode it using the exact same vocabulary that GPT-2 used during

    参考来源

    - 位置:《Natural Language Processing in Action, Second Edition》第10章《真实世界中的大语言模型》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-10.html) - 结论依据:摘录中关于填充与结束共用标识会影响监督的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:>>> tokenizer.pad_token = tokenizer.eos_token #1 >>> vanilla_gpt2 = GPT2LMHeadModel.from_pretrained('gpt2') #1 Setting the padding token to avoid ValueErrors downstream when attempting to do prediction Once you have loaded the GPT-2 model, you still need to process the input prompt to get it into a format the language model can understand. You need to tokenize and encode it using the exact same vocabulary that GPT-2 used during