在docker下进行ETH并行训练和在本机下进行ETH并行训练

1. 拉取anaconda3镜像并新建和启动一个容器(注意:若本地无此镜像,会自动拉取), --gpus=all意思是让docker使用主机的GPU.

docker run -it --gpus=all continuumio/anaconda3:latest /bin/bash
docker cp <压缩包的绝对路径> <CONTAINER ID>:<容器内地址(自己选择)>

示例: 
02cc是容器缩写, 完整的是02cc89101bda,缩写取多长看自己开心,02也是可以的
docker cp /home/binghong/Downloads/AMP_for_hardware-main.zip 02cc:/home/

2. 对传入的压缩包解压

1. tar.gz后缀的
tar -zxvf FileName.tar.gz 

2. zip后缀的
unzip FileName.zip
若报错提示找不到unzip,那么用下面命令安装unzip
apt-get update
apt-get install unzip

完整的解压和压缩命令参考:Ubuntu 常用解压与压缩命令_蕉叉熵的博客-CSDN博客_ubuntu zip

3. 然后按照README.md进行安装各个依赖

4. 在进行isaacgym安装时会遇到以下报错:

        i) 提示找不到libpython3.8.so.1.0, 假如官方提供的方法行不通,那么按以下操作

官方的方法:
sudo apt install libpython3.8

若官方的行不通,那么执行下列代码:
# 先来到本机的conda的amp_hw环境包里
cd opt/conda/envs/amp_hw/lib  (amp_hw是conda的环境名)
# 找到libpython3.8.so.1.0, 并传送到docker容器内
docker cp libpython3.8.so.1.0 <CONTAINER ID>:/usr/local/lib/
docker cp libpython3.8.so.1.0 <CONTAINER ID>:/usr/lib/

        ii) 运行isaacgym里的examples报下列错误:

Importing module 'gym_38' (/home/isaacgym/python/isaacgym/_bindings/linux-x86_64/gym_38.so)
Setting GYM_USD_PLUG_INFO_PATH to /home/isaacgym/python/isaacgym/_bindings/linux-x86_64/usd/plugInfo.json
WARNING: Forcing CPU pipeline.
Not connected to PVD
+++ Using GPU PhysX
Physics Engine: PhysX
Physics Device: cuda:0
GPU Pipeline: disabled
Segmentation fault (core dumped)

解决办法: 添加--headless, 因为docker里好像启动不了图形界面,所以会报错. 不过在本机上是可以的.

5. 在docker里运行AMP_for_hardware-main/legged_gym/scripts/train.py时,需要改以下内容(在本机上运行不需要):

/AMP_for_hardware-main/legged_gym/envs/base/legged_robot.py 第111行self.render()注释掉, 以及命令上添上--headless,

6. 把docker容器导出和导入,镜像存出和载入

容器导出

docker export -o test_for_run.tar ce5  (ce5是容器ID)
或者
docker export e81 >test_for_stop.tar

容器导入

docker import test_for_run.tar test/ubuntu:v1.0

镜像存出

docker save -o ubuntu_18.04.tar ubuntu:18.04

镜像载入

docker load -i ubuntu_18.04.tar
或者:
docker load < ubuntu_18.04.tar

若压缩包太大,传不进服务器内,可以考虑分割压缩包,传入之后,再进行合并

# split .tar
split -b 3G -d -a 1 20190816.tar 20190816.tar.
 
# 合并分割后压缩包,并解压
cat 20190816.tar.* >new_20190816.tar

7. 把docker容器导出再导入服务器内,运行AMP_for_hardware-main/legged_gym/scripts/train.py时可能出现下面错误:

1. subprocess.CalledProcessError: Command ‘[‘which‘, ‘c++‘]‘ returned non-zero exit status 1.

解决办法:

sudo apt-get install build-essential

2. AttributeError: module ‘distutils’ has no attribute ‘version’

解决办法:

pip uninstall setuptools
pip install setuptools==59. 5.0 //需要比你之前的低

3. 
/usr/lib/x86_64-linux-gnu/libcuda.so.1: file too short
Traceback (most recent call last):
  File "legged_gym/scripts/train.py", line 47, in <module>
    train(args)
  File "legged_gym/scripts/train.py", line 41, in train
    env, env_cfg = task_registry.make_env(name=args.task, args=args)
  File "/root/AMP_for_hardware-main/legged_gym/utils/task_registry.py", line 97, in make_env
    env = task_class(   cfg=env_cfg,
  File "/root/AMP_for_hardware-main/legged_gym/envs/base/legged_robot.py", line 81, in __init__
    super().__init__(self.cfg, sim_params, physics_engine, sim_device, headless)
  File "/root/AMP_for_hardware-main/legged_gym/envs/base/base_task.py", line 44, in __init__
    self.gym = gymapi.acquire_gym()
RuntimeError: Failed to acquire interface: carb::gym::Gym (pluginName: nullptr)

解决办法:

i) 先参考此链接:/usr/lib/x86_64-linux-gnu/libcuda.so.1: file too short_七爷OK的博客-CSDN博客

ii)然后,与cuda版本有关, 训练的程序用的是pytorch1.10.0,那么需要安装cuda11.3. 安装cuda请看下面链接:

Ubuntu下安装CUDA_CC977的博客-CSDN博客_ubuntu安装cuda


在本机上出现的问题

1. 按照README.md进行安装各个依赖

2. AttributeError: module ‘distutils’ has no attribute ‘version’

        解决办法:pip uninstall setuptools
                               pip install setuptools==59. 5.0 //需要比你之前的低

3. ModuleNotFoundError: No module named 'lxml'

        pip install lxml

4. ModuleNotFoundError: No module named 'transformations'
        pip install transformations

5. No module named 'attr'

        pip install attr

6. AttributeError: module 'attr' has no attribute 's'

        pip install attrs

7. ModuleNotFoundError: No module named 'gym'

        pip install gym

8. ModuleNotFoundError: No module named 'filterpy'

        pip install filterpy

1.在本机运行上述代码本来运行成功了,但是隔天出现了这个错误: Segmentation fault (core dumped)

解决办法是: (以下操作都在本机上执行)在本机上删除现有的conda环境amp_hw, 并对conda内缓存做清理: ???

清理anaconda缓存:
conda clean -p  # 删除没用的包
conda clean -t  # 删除tar包
conda clean -y -all #删除所有的安装包以及cache

然后, 删除已经解压的AMP_for_hardware-main和isaacgym文件夹, 并重新解压这两个压缩包. 并按照README重新安装相关依赖包, 错误消失.

2. 在第8点之后, 出现新错误:

i) [Error] [carb.gym.plugin] Gym cuda error: no kernel image is available for execution on the device:

错误说明本机的gpu算力(仅有3.0)不满足当前torch版本所要求的算力(3.7起)

ii) RuntimeError: vstack expects a non-empty TensorList

必须在AMP_for_hardware目录下输入训练命令,不能进入到train.py所在目录去启动。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值