with-RL
강화 학습 / ML-Agent2024년 2월 12일

Unity ML-Agent 설치하기

이번 포스팅은 가상공간에서 강화학습을 이용해 인공지능을 학습할 수 있는 환경을 제공하는 Unity ML-Agent를 설치하는 과정입니다.

이 포스트는 아래 내용을 참고했습니다.

이 포스트의 실행 환경은 아래와 같습니다.

1. ML-Agent 소스코드 다운로드

$ git clone --branch release_20 https://github.com/Unity-Technologies/ml-agents.git
$ cd ml-agents

2. Python 환경 설정 (Windows)

$ conda create -n robot python=3.9 $ conda activate robot
$ pip install torch -f https://download.pytorch.org/whl/torch_stable.html
$ pip install -e ./ml-agents-envs $ pip install -e ./ml-agents
$ pip install --upgrade "protobuf<=3.20.1"

3. Python 환경 설정 (M1 Mac)

$ conda create -n robot python=3.9 $ conda activate robot
$ pip install torch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1
$ brew install hdf5
$ export HDF5_DIR=/opt/homebrew/Cellar/hdf5/1.14.1/
$ pip install --no-binary=h5py h5py
"torch>=1.8.0,<=2.0.1;(platform_system!='Windows' and python_version>='3.9')",
$ pip install -e ./ml-agents-envs
$ pip install -e ./ml-agents
$ pip install --upgrade "protobuf<=3.20.1"
$ conda install grpcio

4. Unity에서 ML-Agent Project 열기

5. 3DBall 예제 실행해 보기

6. 3DBall 모델 학습하기

$ mlagents-learn config/ppo/3DBall.yaml --run-id=first3DBallRun