外观
教程raw.githubusercontent.com6 天前
SimplerEnv:对 VLA 策略做 sim 评估的安装与运行教程
> 本文依据以下官方文档整理:raw.githubusercontent.com/simpler-env/SimplerEnv/main/README。命令与版本以文档当前版本为准。
前置条件
- CUDA version >=11.8 and < 13(如果要 full installation 并执行 RT-1 or Octo inference)
- An NVIDIA GPU(ideally RTX;non-RTX GPUs, such as 1080Ti and A100, environments that involve ray tracing will be slow)
- Currently TPU is not supported as SAPIEN requires a GPU to run
- anaconda environment
1. 1. 创建 anaconda 环境
先创建并激活 README 指定的 anaconda environment。文档给出的环境名是 simpler_env,Python 版本写法保持原文不改动。
bash
conda create -n simpler_env python=3.10 (3.10 or 3.11)
conda activate simpler_env2. 2. 克隆 SimplerEnv 仓库
在本地拉取 SimplerEnv 源码。README 要求使用 --recurse-submodules,因为仓库包含 ManiSkill2_real2sim 等子模块。
bash
git clone https://github.com/simpler-env/SimplerEnv --recurse-submodules3. 3. 安装 numpy<2.0
进入后续安装前,先按 README 安装指定 numpy 版本。文档说明如果不安装 numpy<2.0,pinocchio 中 IK 可能报错。
bash
pip install numpy==1.24.44. 4. 安装 ManiSkill2 real-to-sim 环境
安装 ManiSkill2 real-to-sim environments 以及它们的 dependencies。路径占位符 {this_repo} 保持 README 原文写法。
bash
cd {this_repo}/ManiSkill2_real2sim
pip install -e .5. 5. 安装 SimplerEnv 包
回到 SimplerEnv 仓库根目录,按 editable 方式安装当前 package。这样后续可以直接 import simpler_env。
bash
cd {this_repo}
pip install -e .6. 6. 查看可用环境
安装完成后,可按 README 查询所有 available environments。输出中应包含 google_robot_pick_coke_can、widowx_stack_cube 等任务名。
python
import simpler_env
print(simpler_env.ENVIRONMENTS)7. 7. 跑最小预打包环境脚本
在 interactive python 中执行 README 的 minimal inference script。示例创建 visual matching evaluation setup 的预打包环境,并用随机 action 跑完整 episode。
python
import simpler_env
from simpler_env.utils.env.observation_utils import get_image_from_maniskill2_obs_dict
env = simpler_env.make('google_robot_pick_coke_can')
obs, reset_info = env.reset()
instruction = env.get_language_instruction()
print("Reset info", reset_info)
print("Instruction", instruction)
done, truncated = False, False
while not (done or truncated):
# action[:3]: delta xyz; action[3:6]: delta rotation in axis-angle representation;
# action[6:7]: gripper (the meaning of open / close depends on robot URDF)
image = get_image_from_maniskill2_obs_dict(env, obs)
action = env.action_space.sample() # replace this with your policy inference
obs, reward, done, truncated, info = env.step(action) # for long horizon tasks, you can call env.advance_to_next_subtask() to advance to the next subtask; the environment might also autoadvance if env._elapsed_steps is larger than a threshold
new_instruction = env.get_language_instruction()
if new_instruction != instruction:
# for long horizon tasks, we get a new instruction when robot proceeds to the next subtask
instruction = new_instruction
print("New Instruction", instruction)
episode_stats = info.get('episode_stats', {})
print("Episode stats", episode_stats)8. 8. 复现 SIMPLER 指标计算
如果要复现论文中的 key numbers,可运行 README 指定的 tools/calc_metrics.py。该脚本用于 summarizing eval results 和计算 MMRV、Pearson Correlation。
bash
python3 tools/calc_metrics.py验证是否跑通
确认安装和运行跑通:print(simpler_env.ENVIRONMENTS) 能打印环境列表;最小推理脚本会输出 Reset info、Instruction,长时任务进入下一子任务时可能输出 New Instruction,episode 结束后输出 Episode stats。
文档里点名的注意事项
- Install numpy<2.0;otherwise errors in IK might occur in pinocchio。
- CUDA version >=11.8 and < 13 is required if you want to perform a full installation of this repo and perform RT-1 or Octo inference。
- Currently TPU is not supported as SAPIEN requires a GPU to run。
- For non-RTX GPUs, such as 1080Ti and A100, environments that involve ray tracing will be slow。
- By default, Google Robot environments use a control frequency of 3hz, and Bridge environments use a control frequency of 5hz. Simulation frequency is ~500hz。
相关 SDK 条目
来源
本页事实对应的公开页面,以原文为准。