calvin-sim复现过程——eval
代码地址:https://github.com/pranavatreya/calvin-sim
论文名字: Zero-Shot Robotic Manipulation With Pretrained Image-Editing Diffusion Models
实验环境及配置:Ubuntu20.04, GPU:3080
环境配置流程
1.环境创建
#下载代码
git clone --recurse-submodules https://github.com/pranavatreya/calvin-sim.git
#conda 创建环境,注意这里我用的python=3.10,原来作者用3.8(和jax有冲突)
conda create -n susie-calvin python=3.10
conda activate susie-calvin
#安装tensorflow并测试
pip install --upgrade tensorflow
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
输出:[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]则安装成功
#安装jax
pip install -U "jax[cuda12]"
# 切换到calvin-sim所在的文件夹并安装
cd /home/new1/calvin-sim(更换路径)
sh install.sh
pip install setuptools==57.5.0(出现问题1的解决办法,如果没有出现,就不需要运行)
# 切换到susie所在的文件夹(susie的文件夹放在任何地方都可以,但是要安装在susie-calvin环境中)
git clone https://github.com/kvablack/susie.git (susie下载,若下载忽略此步骤)
cd susie/
pip install -e .
# 切换到bridge_data_v2所在的文件夹(文件夹放在任何地方都可以,但是要安装在susie-calvin环境中)
git clonehttps://github.com/rail-berkeley/bridge_data_v2.git
cd bridge_data_v2/
pip install -e .
2.下载权重
权重地址: link
一个是DIFFUSION_MODEL的,一个是GC_POLICY
3.运行 ./eval_susie.sh
因为numpy版本之间的适配问题,在运行程序的时候出现很多问题。因此,我对代码修改了很多地方进行了修改,下面是我修改比较明显的地方。如果出现其它报错,就按照报错进行修改,会涉及到site-package、susie的model修改。
# eval_susie.sh文件的内容
export DIFFUSION_MODEL_CHECKPOINT='/home/new1/calvin-sim/checkpoints/diffusion_model'
export GC_POLICY_CHECKPOINT='/home/new1/calvin-sim/checkpoints/goal_conditioned_policy'
export XLA_CLIENT_MEM_FRACTION=0.7
export XLA_FLAGS="--xla_gpu_enable_command_buffer="
export NUM_EVAL_SEQUENCES=10
python calvin_models/calvin_agent/evaluation/evaluate_policy_subgoal_diffusion.py --dataset_path mini_dataset --custom_model
# evaluate_policy_subgoal_diffusion.py 文件在开头添加的内容
import collections, collections.abc
collections.Mapping = collections.abc.Mapping
collections.Set = collections.abc.Set
collections.Iterable = collections.abc.Iterable
collections.Sequence = collections.abc.Sequence
import fractions, math
fractions.gcd = math.gcd
import numpy as np
np.int = int
np.float = float
np.bool = bool
np.object= object
# add more if other np.<alias> errors pop up
问题及解决办法
问题1: error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
# 解决办法
pip install setuptools==57.5.0
问题2:jax.tree_map
需要都改成jax.tree.map
问题3:np.bool
都改成np.bool_
运行结果图
运行成功后开始测试,大概测试了2个多小时
这是最后在每个任务上的结果,和原文中差不多。
最后会在calvin-sim/experiments中保存测试过程的视频,以及每个对应任务的指令。可以打开查看效果。