踩坑GitHub huggingface/lerobot16 天前
LeRobot PI0.5微调精度策略致性能下降及优化器dtype报错
本文由 AI 根据公开内容整理,可能有误,请以原文为准:Question: Why does lerobot keep the entire vision_tower in float32, while the original openpi only preserves 3 specific embedding weights?(GitHub huggingface/lerobot #3259)
状态:有绕过办法
问题
LeRobot v0.5.0中to_bfloat16_for_selected_params将整个vision_tower和multi_modal_projector保持fp32,而原版openpi仅保留3个embedding权重。实测该策略导致LIBERO微调成功率比类openpi策略低4-5个百分点。
环境
LeRobot v0.5.0及main分支,PI0/PI0.5模型,SigLIP视觉编码器,使用fused或foreach模式的AdamW优化器进行bfloat16训练。
解决办法
- 修改
src/lerobot/policies/pi05/modeling_pi05.py中的to_bfloat16_for_selected_params,移除vision_tower与multi_modal_projector的全局fp32设定。 - 采用openpi的白名单策略,仅将
patch_embedding.weight/bias、position_embedding.weight及各类layernorm保留为fp32。 - 在vision tower模块输出边界处显式将fp32 embedding输出cast回bf16,避免优化器因参数组内dtype不一致触发'same dtype'异常。
- 若需兼顾兼容性,可通过config flag切换两种精度策略,并监控peak VRAM与step time验证收益。
讨论原作者:@XueSongTap 等,版权归原作者所有。
外部来源
本页事实对应的公开页面,以原文为准。(点击将离开本站)