知识卡片
序列打包需定义样本边界
把多个短示例装入同一序列可提高有效token比例,但必须明确定界、注意力可见范围与损失mask。若允许样本间互见或将全部提示也计分,训练目标会与只训练独立回答不同;不能把packing仅视为无语义影响的存储优化。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 微调
原书出处 · 1 处
- · 查看原书依据
packing = True Putting It All Together Now that we have set up all the requisite parameters, here is the full code for the fine-tuning process: # Ensure that the specified versions of these libraries are installed. !pip install transformers==4.35.0 accelerate==0.24.0 peft==0.6.0 bitsandbytes==0.41.0 trl==0.7.4 from datasets import load_dataset from transformers import TrainingArguments, BitsAndBytesConfig from transformers import LlamaForCausalLM, LlamaTokenizer from peft import PeftModel, LoraConfig from trl
参考来源
- 位置:《Designing Large Language Model Applications》第06章《微调》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Designing Large Language Model Applications/_epub-src/OEBPS/ch06.html)
- 结论依据:摘录中关于序列打包需定义样本边界的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:packing = True Putting It All Together Now that we have set up all the requisite parameters, here is the full code for the fine-tuning process: # Ensure that the specified versions of these libraries are installed. !pip install transformers==4.35.0 accelerate==0.24.0 peft==0.6.0 bitsandbytes==0.41.0 trl==0.7.4 from datasets import load_dataset from transformers import TrainingArguments, BitsAndBytesConfig from transformers import LlamaForCausalLM, LlamaTokenizer from peft import PeftModel, LoraConfig from trl