Skip to content

Latest commit

 

History

History
91 lines (65 loc) · 2.47 KB

File metadata and controls

91 lines (65 loc) · 2.47 KB

命令

python3 policies/infer.py <policy> [args]

解释:

  • policy: 位置参数,指定策略的类型,目前支持的选项:act

act

依赖安装

pip install -r policies/act/requirements/train_eval.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

推理配置

推理配置文件可基于训练配置文件修改,其中主要参数解释如下:

  • max_timesteps: 动作执行总步数,动作达到总步数后自动结束本次推理

推理命令

python3 policies/infer.py act -tn <task_name> -rn airbot_play -mts 100 -ts 20241125-110709

其中:

  • -tn 任务名,程序会根据任务名分别在task_configsdata目录下寻找同名的配置文件和数据集,同时需要与数据采集时使用的任务名一致,确保加载同样的场景
  • -rn 机器人类型,需与数据采集时使用的一致
  • -mts 动作执行总步数,该命令行参数会覆盖配置文件中的max_timesteps
  • -ts 时间戳,对应训练得到的模型文件所在的以时间戳命名的文件夹,程序会根据任务名和时间戳在policies/act/my_ckpt目录下寻找对应的模型文件

dp

推理配置

推理配置文件与训练配置文件相同

推理命令

python3 policies/infer.py dp --config-path=configs --config-name=block_place mode=eval model_path=path/to/model

其中:

  • --config-path: 配置文件所在路径
  • --config-name: 配置文件名
  • mode: 指定训练或是推理
  • model_path: 模型权重路径

真机推理

python3 policies/dp/infer_real.py --config-path=configs --config-name=block_place

其中:

  • --config-path: 配置文件所在路径
  • --config-name: 配置文件名
  • 需要注意,真机推理的config.yaml相较于sim中的config.yaml,需要增加global_camidwrist_camid,分别指向对应的相机编号

diffusion_policy

推理命令

python3 eval.py "$task_name" "$checkpoint" "$gpu_id"
# for example: bash eval.sh block_place note_1000 0

RDT

推理命令

cd DISCOVERSE/policies/RDT
bash eval.sh ${task_name} ${model_name} ${ckpt_id}
# for example:
bash eval.sh block_place model_name 20000

openpi

推理命令

bash eval.sh ${task_name} ${train_config_name} ${model_name} ${checkpoint}
# for example:
bash eval.sh block_place pi0_base_aloha_full model_a 9999