# PI0.5训练保存Checkpoint时终端无报错退出及RAM OOM

> 原文链接：https://robotics.hellobike.com/pitfalls/2026-10-20-openpi-827
> 频道：pitfalls | 更新日期：2026-10-20 | 标签：auto, github-issue, openpi
> 核心摘要：PI0.5训练保存检查点时因RAM溢出导致进程静默退出，可通过编写独立脚本定期清理系统缓存或注释掉train state保存代码绕过。

# PI0.5训练保存Checkpoint时终端无报错退出及RAM OOM

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[During the training process of the PI0.5 model, it automatically exits and the terminal closes without any errors.](https://github.com/Physical-Intelligence/openpi/issues/827)（GitHub Physical-Intelligence/openpi #827）

**状态**：有绕过办法

## 问题

在PI0.5模型训练过程中，程序运行至特定步数（如17.5k步）保存Checkpoint时自动退出且终端关闭，Wandb日志截断无显式报错。经排查确认为系统内存（RAM）OOM而非磁盘空间不足，调整`ocp.PyTreeCheckpointHandler`的并发参数或禁用异步保存均无效，疑似数据加载或保存过程存在内存泄漏。

## 环境

SLURM集群环境，双主机各4卡GPU，单机480GB RAM；Physical-Intelligence/openpi仓库；PI0.5模型训练任务。

## 解决办法

1. 编写并运行独立的系统缓存清理程序，在训练期间定期释放RAM缓存，实测可支持连续训练42小时以上不触发OOM退出。
2. 修改`src/openpi/training/checkpoints.py`第83行，注释掉保存train state的代码逻辑，仅保留模型参数保存以降低峰值内存占用（注意：此法会导致无法完整恢复训练状态）。

讨论原作者：@sunmoon2018 等，版权归原作者所有。
:::

## 原始参考来源 (Sources)

- [GitHub Physical-Intelligence/openpi #827：During the training process of the PI0.5 model, it automatically exits and the terminal closes without any errors.](https://github.com/Physical-Intelligence/openpi/issues/827)