com.unity.ml-agents/Documentation~/Hugging-Face-Integration.md
The Hugging Face Hub π€ is a central place where anyone can share and download models.
It allows you to:
You can see the list of ml-agents models here.
We wrote a complete tutorial to learn to train your first agent using ML-Agents and publish it to the Hub:
You can simply download a model from the Hub using mlagents-load-from-hf.
You need to define two parameters:
--repo-id: the name of the Hugging Face repo you want to download.--local-dir: the path to download the model.For instance, I want to load the model with model-id "ThomasSimonini/MLAgents-Pyramids" and put it in the downloads directory:
mlagents-load-from-hf --repo-id="ThomasSimonini/MLAgents-Pyramids" --local-dir="./downloads"
You can simply upload a model to the Hub using mlagents-push-to-hf
You need to define four parameters:
--run-id: the name of the training run id.--local-dir: where the model was saved--repo-id: the name of the Hugging Face repo you want to create or update. Itβs always <your huggingface username>/<the repo name> If the repo does not exist it will be created automatically--commit-message: since HF repos are git repositories you need to give a commit message.For instance, I want to upload my model trained with run-id "SnowballTarget1" to the repo-id: ThomasSimonini/ppo-SnowballTarget:
mlagents-push-to-hf --run-id="SnowballTarget1" --local-dir="./results/SnowballTarget1" --repo-id="ThomasSimonini/ppo-SnowballTarget" --commit-message="First Push"
You can watch your agent playing directly in your browser (if the environment is from the ML-Agents official environments)