The Hugging Face Hub π€ is now officially integrated in the ML-Agents official repository.
The documentation π https://huggingface.co/docs/hub/ml-agents
This is a Fork of the Unity ML-Agents toolkit. This version allows you to publish your trained agents in one line of code to the Hugging Face Hub, download powerful agents from the community, and watch a replay of your agent without using the Unity Editor.
β‘οΈ We wrote a complete tutorial to learn to train your first agent using ML-Agents and publish it to the Hub π https://link.medium.com/KOpvPdyz4qb
# Clone the repository
git clone https://github.com/huggingface/ml-agents/
# Go inside the repository and install the package
cd ml-agents
pip3 install -e ./ml-agents-envs
pip3 install -e ./ml-agents
In the meantime, if you have a Mac or a Linux, you can replace step 2 with: https://github.com/Unity-Technologies/ml-agents/blob/main/docs/Learning-Environment-Executable.md#building-the-3dball-environment
Download executable zip from here: https://drive.google.com/drive/folders/1HrvHNRLCKwQRWv-JkhhMPTHCwu_iHxZj?usp=sharing
Unzip it and place it inside the MLAgents cloned repo in a new folder called trained-envs-executables/windows
.
For instance with Pyramids:
mlagents-learn config/ppo/PyramidsRND.yaml --env=training-envs-executables/windows/Pyramids --run-id="First Training" --no-graphics
We define four parameters:
mlagents-learn <config>
: the path where the hyperparameter config file is.--env
: where the environment executable is.--run_id
: the name you want to give to your training run id.--no-graphics
: to not launch the visualization during the training (you can remove this parameter, but that might slow the training).
mlagents-push-to-hf --run-id="First Training" --local-dir="results/First Training" --repo-id="ThomasSimonini/MLAgents-Pyramids" --commit-message="Pyramids"
We define four parameters:
--run-id
: the name of the training run id.--local-dir
: where the agent was saved, itβs results/<run_id name>, so in my case results/First Training.-- repo-id
: the name of the Hugging Face repo you want to create or update. Itβs always<your huggingface username>/<the repo name>
--commit-message
ML-Agent Environment | Windows Executable | Mac Executable | Linux Executable | Visualize your agent online with Hugging Face Spaces | |
---|---|---|---|---|---|
Pyramids | βοΈ | [βοΈ] | ποΈ | βοΈ https://huggingface.co/spaces/unity/ML-Agents-Pyramids | |
Walker | βοΈ | [βοΈ] | ποΈ | βοΈ https://huggingface.co/spaces/unity/ML-Agents-Walker | |
Worm | βοΈ | [βοΈ] | ποΈ | βοΈ https://huggingface.co/spaces/unity/ML-Agents-Worm | |
Push Block | βοΈ | [βοΈ] | ποΈ | βοΈ https://huggingface.co/spaces/unity/ML-Agents-Push-Block | |
Basic | ποΈ | ποΈ | ποΈ | ποΈ | |
Crawler | ποΈ | ποΈ | ποΈ | ποΈ | |
Wall Jump | ποΈ | ποΈ | ποΈ | ποΈ | |
PushBlock | ποΈ | ποΈ | ποΈ | ποΈ | |
3DBall: 3D Balance Ball | ποΈ | ποΈ | ποΈ | ποΈ | |
GridWorld | ποΈ | ποΈ | ποΈ | ποΈ | |
Wall Jump | ποΈ | ποΈ | ποΈ | ποΈ | |
Food Collector | ποΈ | ποΈ | ποΈ | ποΈ | |
Hallway | ποΈ | ποΈ | ποΈ | ποΈ | |
Soccer Twos | ποΈ | ποΈ | ποΈ | ποΈ | |
Strikers Vs. Goalie | ποΈ | ποΈ | ποΈ | ποΈ | |
Match 3 | ποΈ | ποΈ | ποΈ | ποΈ | |
Sorter | ποΈ | ποΈ | ποΈ | ποΈ | |
Cooperative Push Block | ποΈ | ποΈ | ποΈ | ποΈ | |
Dungeon Escape | ποΈ | ποΈ | ποΈ | ποΈ |