# robosuite + robomimic：仿真数据集下载与模仿学习训练实操

> 原文链接：https://robotics.hellobike.com/tutorials/robosuite-robomimic-quickstart
> 频道：tutorials | 更新日期：2026-10-22 | 标签：robomimic, robosuite, behavior cloning, imitation learning, tensorboard
> 核心摘要：基于 robomimic Getting Started，完成 robosuite Lift PH 数据集下载、BC 训练启动、输出目录查看与 tensorboard 结果浏览。

# robosuite + robomimic：仿真数据集下载与模仿学习训练实操

&gt; 本文依据以下官方文档整理：[robomimic.github.io/docs/introduction/getting_started.html](https://robomimic.github.io/docs/introduction/getting_started.html)。命令与版本以文档当前版本为准。

## 前置条件

- 位于 robomimic 的 base repo path
- 本示例需要安装 robosuite，且在 v1.5.1 branch
- 如不使用 robosuite，可在 robomimic/exps/templates/bc.json 中将 experiment.rollout.enabled 改为 false

## 1. 进入 robomimic 仓库根目录

开始下载数据集和运行实验前，先确认当前目录是 robomimic 的 base repo path。后续所有脚本路径都以该位置为起点执行。

```bash
$ cd {/path/to/robomimic}
```

## 2. 下载 robosuite Lift PH 数据集

使用 robomimic 提供的下载脚本获取 robosuite Lift (PH) dataset。文档说明该数据集下载后可在 datasets/lift/ph/low_dim_v141.hdf5 找到。

```bash
$ python robomimic/scripts/download_datasets.py --tasks lift --dataset_types ph
```

## 3. 启动 BC 模仿学习训练

使用 train.py 启动实验。本例对刚下载的 lift dataset 运行 behavior cloning (BC)，并添加 --debug 做 quick sanity check。

```bash
$ python robomimic/scripts/train.py --config robomimic/exps/templates/bc.json --dataset datasets/lift/ph/low_dim_v141.hdf5 --debug
```

## 4. 了解恢复训练机制

如果训练任务失败，文档说明可重新启动任务并增加 --resume，从最近一次训练输出目录中的 last.pth checkpoint 恢复。resume 会加载 optimizer state；若传入 --resume，config.experiment.ckpt_path 会被忽略，last.pth 优先。

## 5. 查看实验输出目录

脚本结束后，检查 bc_trained_models/test。实验输出包括 config.json、logs/、logs/log.txt、logs/tb/、videos/、models/，分别对应配置、日志、tensorboard 日志、训练 rollout 视频和模型 checkpoint。

## 6. 用 tensorboard 查看结果

实验结果可用 tensorboard 查看。文档给出的日志目录是 bc_trained_models/test，并使用 --bind_all 参数启动。

```bash
$ tensorboard --logdir bc_trained_models/test --bind_all
```

## 验证是否跑通

确认 datasets/lift/ph/low_dim_v141.hdf5 已存在；训练结束后 bc_trained_models/test 下出现 config.json、logs/、videos/、models/；运行 tensorboard 命令后可查看实验结果。

## 文档里点名的注意事项

- 运行 quick sanity check experiments 时，文档建议给实验添加 --debug flag。
- 本例需要安装 robosuite，且在 v1.5.1 branch。
- 如不安装 robosuite，可在 robomimic/exps/templates/bc.json 中将 experiment.rollout.enabled flag 改为 false，以 disabling rollouts。
- 使用 --resume 恢复训练时，会从最近训练运行输出目录中的 last.pth checkpoint 恢复，并加载 optimizer state。
- 如果传入 --resume，config.experiment.ckpt_path 会被忽略，last.pth will take precedence。

## 相关 SDK 条目

- [robosuite](/sdks/arise-initiative-robosuite)

## 原始参考来源 (Sources)

- [robomimic.github.io/docs/introduction/getting_started.html](https://robomimic.github.io/docs/introduction/getting_started.html)