层1: 修复远程 sanity OOM——per_device batch 8→2、累积 2→8(全局 64 不变)

根因:150k 大词表下显存大头是 (B,T,V) logits 链(fp32 ~20G@B=8)与逐层激活,
均正比于 B 而与 0.6B 参数量无关。docs/02 §2.6 旧显存估算勘误入档;
train_sft.sh 加 expandable_segments 防碎片。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-18 09:21:38 -04:00
parent 68216ace22
commit a0faec0df7
5 changed files with 14 additions and 6 deletions
+6 -3
View File
@@ -64,10 +64,13 @@ class SFTConfig:
# 2e-5;层 5 的蒸馏配置再回到论文的 1e-6。
learning_rate: float = 2e-5
per_device_train_batch_size: int = 8
per_device_train_batch_size: int = 2
"""非显然约束:别看 0.6B 小就调大它——显存大头是 (B,T,V) 的 logits 链
fp32 一份 ~20G@B=8)与逐层激活,都正比于 B 而与参数量无关;B=8 实测
爆 80G 卡(2026-07-18 远程 sanity)。"""
gradient_accumulation_steps: int = 2
"""全局 batch = 8(per_device) × 4(卡) × 2(累积) = 64,与参考实现注释的
gradient_accumulation_steps: int = 8
"""全局 batch = 2(per_device) × 4(卡) × 8(累积) = 64,与参考实现注释的
训练规模(trainer 配置注释"global batch 64")对齐。"""
num_train_epochs: int = 1