A Diambra image that can be easily used to train. Should be able to submit too.
290
This Docker image provides a training environment for DIAMBRA Arena with Stable Baselines 3 (SB3) and PyTorch support. It includes TensorBoard for real-time monitoring of your reinforcement learning training and uses Docker-in-Docker (DinD) to support multiple environments.
Before running the container, you need to set up your directories and provide DIAMBRA credentials. You can either use an existing credentials file or generate a new one inside the Docker container.
You will need the following directories on your host machine, which will be mounted into the Docker container:
ROMs Directory: Contains your game ROMs.
mkdir -p /path/to/roms
Scripts Directory: Contains your training scripts (e.g., train.py).
mkdir -p /path/to/scripts
DIAMBRA Credentials: You can either copy an existing credentials file or generate one inside the container.
mkdir -p /path/to/diambra
Output Directory: Stores trained models and logs.
mkdir -p /path/to/output
If you already have a DIAMBRA credentials file, follow these steps:
Copy your credentials file into the diambra directory on your host machine:
cp /your/credentials/file /path/to/diambra/credentials
When running the container, mount the credentials file by adding the -v /path/to/diambra:/workspace/diambra option to your Docker command.
If you don’t have a credentials file, the container will enter Setup Mode when it doesn’t detect the file. Follow these steps inside the container to generate the credentials:
Start the container (If you haven't already):
docker run --privileged -v /path/to/diambra:/workspace/diambra -it mscrnt/diambra-trainer:latest
Inside the container, start the Docker daemon:
sudo dockerd > /dev/null 2>&1 &
Generate the credentials file using the DIAMBRA CLI:
diambra run -n --path.credentials "/workspace/diambra/credentials"
Once the credentials file is generated, you can either run the training script manually or restart the container with the saved credentials.
Do not place untrusted code in the mounted
scriptsfolder.The container runs with privileged access, which could pose a security risk if untrusted scripts are executed.
You can pull the pre-built image from Docker Hub:
docker pull mscrnt/diambra-trainer:latest
Use the following command to run the Docker container:
docker run --privileged \
-v /path/to/roms:/workspace/roms \
-v /path/to/scripts:/workspace/scripts \
-v /path/to/diambra:/workspace/diambra \
-v /path/to/output:/workspace/output \
-e SCALE=2 \
-e EXTRA_ARGS="--batch-size 64" \
-e TRAINING_SCRIPT="/path/to/your_training_script.py" \
-p 7007:6006 \
--name diambra-trainer \
-it mscrnt/diambra-trainer:latest
--privileged: Required for DinD to function properly.-v): Mounts your host directories into the container.-e): Sets the number of DIAMBRA environments, additional arguments, and specifies the training script.-p): Exposes TensorBoard on port 6006 and maps it to 7007 on the host.SCALE: Adjust to change the number of parallel environments (default: 1).
-e SCALE=4
EXTRA_ARGS: Pass additional arguments to your training script (default: "").
-e EXTRA_ARGS="--learning-rate 0.0001 --batch-size 64"
TRAINING_SCRIPT: Specify a custom path for the training script (default: /workspace/scripts/train.py).
-e TRAINING_SCRIPT="/path/to/your_training_script.py"
AUTO: Automatically run the training script on startup (default: true).
-e AUTO="true"
STOP_AFTER_RUN: Stop the container after the training script completes (default: false).
-e STOP_AFTER_RUN="true"
DIAMBRAROMSPATH: Path to the directory containing game ROMs (default: /workspace/roms).6006: TensorBoard web interface.After starting the container, you can access TensorBoard by navigating to:
http://localhost:7007
You can monitor your training progress with real-time visualizations of metrics like loss and reward.
This project is licensed under the MIT License.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or suggestions.
Content type
Image
Digest
sha256:dc4a65b35…
Size
9 GB
Last updated
about 2 years ago
docker pull mscrnt/diambra-trainer