EDIT: I realize that SB3-Rl-Zoo does this already. You can also refer to that https://rl-baselines3-zoo.readthedocs.io/en/master/guide/quickstart.html
This will become handy if you do not know which will be a better choice for your environment. With argument parsing and a little bit bash scripting one can achieve this easily
The training/testing script allows fast run for different Rl algorithms at once
python train_test_rl.py --mode <train/test> --algorithm <PPO/A2C/DQN> --model_name <MODEL_NAME> [--config_name <CONFIG_NAME>] [--total_timesteps <TIMESTEPS>]Arguments
- --mode: Required. Choose train to train a new model or test to test an existing model.
- --algorithm: Required. Specify the RL algorithm to use. Options are PPO, A2C, or DQN.
- --model_name: Required. Name to assign to the model. This name is used for saving/loading the model and logging in TensorBoard.
- --config_name: Optional. Name of the hyperparameter configuration to use. Default is default. Other options depend on the configurations defined in the script.
- --total_timesteps: Optional. Number of timesteps to train the model. Default is 1e7
You can run multiple training sessions in parallel using the provided bash script, run_all.sh. This script will open each configuration in a new terminal window or tab, automatically activating the virtual environment. Make the script executable:
chmod +x run_all.shrun the script
./run_all.shThis will open new terminal windows (or tabs) for each training configuration specified in the script, allowing you to run experiments in parallel.
then you can start a Tensorboard session and watch the values.
tensorboard --logdir rl/