【記錄】強化學習環境legged_gym配置

ilxT發表於2024-07-14

legged_gym 配置

legged_gym程式碼倉庫為:https://github.com/leggedrobotics/legged_gym
rsl_rl程式碼倉庫為:https://github.com/leggedrobotics/rsl_rl

conda環境:Python3.8

pip換源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
阿里雲: https://mirrors.aliyun.com/pypi/simple/
清華大學: https://pypi.tuna.tsinghua.edu.cn/simple/
中國科學技術大學: https://pypi.mirrors.ustc.edu.cn/simple/
如果需要換回來 pip config unset global.index-url

pip install numpy==1.23.5
pip install tensorboard

## 建立新的conda環境
conda activate Issac_Gym38 python=3.8

## 安裝torch1.13.1+cu117
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117

## 在https://developer.nvidia.com/isaac-gym/download安裝Preview4
cd isaacgym/python && pip install -e .

## 測試安裝是否成功
cd examples && python 1080_balls_of_solitude.py

## 使用rsl_rl庫
mkdir Env_Pkg
cd Env_Pkg
git clone https://github.com/leggedrobotics/rsl_rl.git
cd rsl_rl
git checkout v1.0.2
pip install -e .

## 安裝legged_gym
cd legged_gym
pip install -e .

問題:pytorch安裝慢!
解決方案:換pytorch國內映象站用瀏覽器的多執行緒工具下載 https://mirrors.aliyun.com/pytorch-wheels/
效果:20kb/s -> 300kb/s -> 5mb/s,節約了幾個鐘頭(如果pip可以多執行緒下載包的話直接掛梯子用原來的url下應該也行)
原命令:
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
解決方案(我的效果:200kb/s -> 2mb/s):把這個命令的包,用Ctrl+F在 https://mirror.sjtu.edu.cn/pytorch-wheels/cu117 手動尋找下列三個檔案
torchaudio-0.13.1+cu117-cp38-cp38-linux_x86_64.whl
torchvision-0.14.1+cu117-cp38-cp38-linux_x86_64.whl
torch-1.13.1+cu117-cp38-cp38-linux_x86_64.whl
下載存到對應環境,執行pip install torchaudio-0.13.1+cu117-cp38-cp38-linux_x86_64.whl torchvision-0.14.1+cu117-cp38-cp38-linux_x86_64.whl torch-1.13.1+cu117-cp38-cp38-linux_x86_64.whl 將它們安裝

測試:安裝是否成功
cd examples && python 1080_balls_of_solitude.py

git clone https://github.com/leggedrobotics/legged_gym.git

相關文章