From ef828e0ac2b947bb022c4de64615226861cf79f8 Mon Sep 17 00:00:00 2001 From: mscrnt Date: Tue, 14 Jan 2025 09:08:17 -0800 Subject: [PATCH 1/6] Exposing engine port in WIndows example --- content/gettingStarted/_index.en.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/gettingStarted/_index.en.md b/content/gettingStarted/_index.en.md index 148f460f..227dea4d 100755 --- a/content/gettingStarted/_index.en.md +++ b/content/gettingStarted/_index.en.md @@ -216,7 +216,8 @@ echo > %userprofile%/.diambra/credentials docker run --rm -ti --name engine ^ -v %userprofile%/.diambra/credentials:/tmp/.diambra/credentials ^ -v %userprofile%/.diambra/roms:/opt/diambraArena/roms ^ - --net=host docker.io/diambra/engine:latest + -p 127.0.0.1:50051:50051 ^ + docker.io/diambra/engine:latest ``` {{% /tab %}} From afc899f14e2a2772b42aae726a7b684fef1bdbd6 Mon Sep 17 00:00:00 2001 From: mscrnt Date: Tue, 14 Jan 2025 22:50:38 -0800 Subject: [PATCH 2/6] Update Docker run commands to expose engine port --- content/gettingStarted/_index.en.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/gettingStarted/_index.en.md b/content/gettingStarted/_index.en.md index 227dea4d..3fc03977 100755 --- a/content/gettingStarted/_index.en.md +++ b/content/gettingStarted/_index.en.md @@ -203,7 +203,8 @@ touch ~/.diambra/credentials docker run -d --rm --name engine \ -v $HOME/.diambra/credentials:/tmp/.diambra/credentials \ -v /absolute/path/to/roms/folder/:/opt/diambraArena/roms \ - --net=host docker.io/diambra/engine:latest + -p 127.0.0.1:50051:50051 \ + docker.io/diambra/engine:latest ``` {{% /tab %}} @@ -230,7 +231,8 @@ echo "" > $Env:userprofile/.diambra/credentials docker run --rm -ti --name engine ` -v $Env:userprofile/.diambra/credentials:/tmp/.diambra/credentials ` -v $Env:userprofile/.diambra/roms:/opt/diambraArena/roms ` - --net=host docker.io/diambra/engine:latest + -p 127.0.0.1:50051:50051 ` + docker.io/diambra/engine:latest ``` {{% /tab %}} {{< /tabs >}} From 4337092a8a1cc18ca41ad24e7b36217ba8ae0b65 Mon Sep 17 00:00:00 2001 From: mscrnt Date: Mon, 27 Jan 2025 06:39:43 -0800 Subject: [PATCH 3/6] Updated submission process to include DIAMBRA CLI --- .../submitYourOwnAgent/_index.en.md | 86 ++++++++++++++++++- 1 file changed, 82 insertions(+), 4 deletions(-) diff --git a/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md b/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md index 00a1a156..28f20670 100644 --- a/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md +++ b/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md @@ -4,21 +4,99 @@ weight: 50 math: true --- -We support all types of git sources and we also included Hugging Face libraries for model download in the base image. These are the two recommended methods to host and submit your agents: +We support all types of git sources and we also include Hugging Face libraries for model download in the base image. Here’s a streamlined method to create, train, and submit your agent locally using the DIAMBRA CLI, followed by the recommended hosting options:
+- 🖥️ Local CLI - 🤗 Hugging Face -- GitHub +- GitHub GitHub
{{% notice tip %}} -To favor an easy start, we provide example agents files (scripts and weights) that work out-of-the-box (but are only minimally trained) in our DIAMBRA Agents repository, for both Stable Baselines 3 and Ray RLlib. +To favor an easy start, we provide example agent files (scripts and weights) that work out-of-the-box (but are only minimally trained) in our DIAMBRA Agents repository, for both Stable Baselines 3 and Ray RLlib. {{% /notice %}} +### 🖥️ Local CLI + +This method uses the DIAMBRA CLI to generate, build, and submit an agent directly from your local machine. + +#### Steps to Submit Your Agent + +1. **Initialize the Agent**: + Run the `diambra agent init` command, specifying the path to the directory where your model is located (not the model itself). This will generate the required files for your agent. + + ```bash + diambra agent init path/to/agent + ``` + + Example: + ```bash + diambra agent init ./output/models/ + ``` + + This command creates the following files: + - `agent.py`: A sample script for your agent. + - `requirements.txt`: Lists the dependencies for your agent. + - `Dockerfile`: Defines how to build the container for your agent. + - `README.md`: A quick reference for your agent. + +2. **Customize the `agent.py` Script**: + Replace the sample logic in the `agent.py` file with your own pretrained agent logic. Here’s an example of how the script should look: + + ```python + import diambra.arena + from stable_baselines3 import PPO # Import your RL framework + + # Model path and game ID + MODEL_PATH = "./model.zip" + GAME_ID = "doapp" + + # Load the trained agent + agent = PPO.load(MODEL_PATH) + + # Environment settings setup and environment creation + env = diambra.arena.make(GAME_ID) + + # Agent-Environment loop + obs, info = env.reset() + + while True: + # Predict the next action using the trained agent + action, _ = agent.predict(obs, deterministic=True) + + obs, reward, terminated, truncated, info = env.step(action) + + if terminated or truncated: + obs, info = env.reset() + if info["env_done"]: + break + + # Close the environment + env.close() + ``` + +3. **Submit Your Agent**: + Submit your agent directly from the directory where the files are located. The DIAMBRA CLI will build and push the directory to DIAMBRA’s registry automatically. + + ```bash + diambra agent submit . + ``` + + +4. **Track Your Submission**: + After submission, you’ll receive a link to monitor your agent’s evaluation. For example: + ```bash + 🖥️ logged in + ... + 🖥️ (####) Agent submitted: https://diambra.ai/submission/#### + ``` + Visit the link to review your agent’s progress and results. + + {{% notice warning %}} -Do not add your tokens directly in the submission YAML file, they will be publicly visible. +Do not add your tokens directly in the submission YAML file, as they will be publicly visible. {{% /notice %}} ### 🤗 Hugging Face From 71b3de64117c6e1f16cfd2bd201375ebd98308ee Mon Sep 17 00:00:00 2001 From: mscrnt Date: Mon, 27 Jan 2025 06:46:33 -0800 Subject: [PATCH 4/6] Update submission instructions to include Dockerfile and requirements.txt modifications --- .../submitYourOwnAgent/_index.en.md | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md b/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md index 28f20670..7167edd5 100644 --- a/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md +++ b/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md @@ -77,15 +77,45 @@ This method uses the DIAMBRA CLI to generate, build, and submit an agent directl env.close() ``` -3. **Submit Your Agent**: +3. **Update the `Dockerfile` and `requirements.txt` (If Necessary)**: + If your agent requires additional dependencies or custom setups, update the following files: + + - **`requirements.txt`**: + Add any Python packages your agent relies on. For example: + ```plaintext + diambra-arena==2.2.7 + stable-baselines3 + torch + numpy + ``` + + - **`Dockerfile`**: + Ensure the Dockerfile installs all required dependencies. If you add new packages to `requirements.txt`, no further changes are needed unless specific system-level dependencies are required. + + Example: + ```dockerfile + FROM ghcr.io/diambra/arena-base-on3.10-bullseye:main + + RUN apt-get -qy update && \ + apt-get -qy install libgl1 && \ + rm -rf /var/lib/apt/lists/* + + WORKDIR /app + COPY requirements.txt . + RUN pip install -r requirements.txt + + COPY . . + ENTRYPOINT [ "python", "/app/agent.py" ] + ``` + +4. **Submit Your Agent**: Submit your agent directly from the directory where the files are located. The DIAMBRA CLI will build and push the directory to DIAMBRA’s registry automatically. ```bash diambra agent submit . ``` - -4. **Track Your Submission**: +5. **Track Your Submission**: After submission, you’ll receive a link to monitor your agent’s evaluation. For example: ```bash 🖥️ logged in @@ -94,7 +124,6 @@ This method uses the DIAMBRA CLI to generate, build, and submit an agent directl ``` Visit the link to review your agent’s progress and results. - {{% notice warning %}} Do not add your tokens directly in the submission YAML file, as they will be publicly visible. {{% /notice %}} From 3e1ff194d24de3a6af5871bfb1a56cf8b7e2e83f Mon Sep 17 00:00:00 2001 From: mscrnt Date: Mon, 27 Jan 2025 07:10:09 -0800 Subject: [PATCH 5/6] Mark GitHub and Hugging Face submission methods as deprecated --- .../submitYourOwnAgent/_index.en.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md b/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md index f7b6393b..2d72708c 100644 --- a/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md +++ b/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md @@ -9,8 +9,9 @@ We support all types of git sources and we also include Hugging Face libraries f @@ -124,11 +125,16 @@ This method uses the DIAMBRA CLI to generate, build, and submit an agent directl ``` Visit the link to review your agent’s progress and results. +{{% notice warning %}} +The GitHub and Hugging Face submission methods are deprecated and not recommended. Use the **DIAMBRA CLI** method instead for a more streamlined and efficient workflow. +{{% /notice %}} + + {{% notice warning %}} Do not add your tokens directly in the submission YAML file, as they will be publicly visible. {{% /notice %}} -### 🤗 Hugging Face +### 🤗 Hugging Face Deprecated These are the steps to submit your own agent hosted on Hugging Face: @@ -305,7 +311,7 @@ diambra agent submit --submission.secrets-from=huggingface --submission.manifest This will automatically retrieve the Hugging Face token you saved earlier. -### GitHub +### GitHub GitHub Deprecated These are the steps to submit your own agent hosted on GitHub: From c07bf835fad50863c76185447c6d56faddb726b5 Mon Sep 17 00:00:00 2001 From: mscrnt Date: Mon, 27 Jan 2025 07:17:20 -0800 Subject: [PATCH 6/6] Updated intro --- .../howToSubmitAnAgent/submitYourOwnAgent/_index.en.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md b/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md index 2d72708c..11223dfa 100644 --- a/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md +++ b/content/competitionPlatform/howToSubmitAnAgent/submitYourOwnAgent/_index.en.md @@ -4,7 +4,9 @@ weight: 50 math: true --- -We support all types of git sources and we also include Hugging Face libraries for model download in the base image. Here’s a streamlined method to create, train, and submit your agent locally using the DIAMBRA CLI, followed by the recommended hosting options: +We recommend using the **DIAMBRA CLI** method to create, train, and submit your agent locally. This streamlined approach eliminates the need for external hosting services and simplifies the submission process. + +While we still provide legacy support for GitHub and Hugging Face, these methods are **deprecated**. Please use the DIAMBRA CLI for a more efficient and modern workflow.