From 5bcbf54811ec3f2562ffd47d99d201bfc8217c40 Mon Sep 17 00:00:00 2001 From: benellis3 Date: Tue, 5 Apr 2022 15:34:58 +0100 Subject: [PATCH] Add qmix updates --- install_dependencies.sh | 4 ++-- install_sc2.sh | 23 ++++++++++++++--------- run.sh | 2 +- run_docker.sh | 2 +- src/config/default.yaml | 2 +- src/utils/logging.py | 5 ++--- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index d40857d2..c24c28b0 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -4,6 +4,6 @@ # conda create -n pymarl python=3.7 -y # conda activate pymarl -conda install pytorch torchvision cudatoolkit=9.0 -c pytorch -y -pip install sacred numpy scipy gym==0.10.8 matplotlib seaborn pyyaml pygame pytest probscale imageio snakeviz tensorboard-logger +pip install --ignore-installed six +pip install sacred numpy scipy gym==0.10.8 matplotlib seaborn pyyaml pygame pytest probscale imageio snakeviz tensorboard-logger wandb pip install git+https://github.com/oxwhirl/smac.git diff --git a/install_sc2.sh b/install_sc2.sh index d7ff8d0d..59115c5c 100755 --- a/install_sc2.sh +++ b/install_sc2.sh @@ -1,18 +1,25 @@ #!/bin/bash # Install SC2 and add the custom maps -pymarl_dir=$HOME/src/pymarl2 -cd $pymarl_dir/3rdparty/ -smac_maps=$pymarl_dir/smac_maps +if [ -z "$EXP_DIR" ] +then + EXP_DIR=~ +fi + +echo "EXP_DIR: $EXP_DIR" +cd $EXP_DIR/pymarl + +mkdir 3rdparty +cd 3rdparty -export SC2PATH="$HOME/src/pymarl2/3rdparty/StarCraftII" +export SC2PATH=`pwd`'/StarCraftII' echo 'SC2PATH is set to '$SC2PATH if [ ! -d $SC2PATH ]; then echo 'StarCraftII is not installed. Installing now ...'; wget http://blzdistsc2-a.akamaihd.net/Linux/SC2.4.10.zip unzip -P iagreetotheeula SC2.4.10.zip - rm -f SC2.4.10.zip + rm -rf SC2.4.10.zip else echo 'StarCraftII is already installed.' fi @@ -28,10 +35,8 @@ fi cd .. wget https://github.com/oxwhirl/smac/releases/download/v0.1-beta1/SMAC_Maps.zip unzip SMAC_Maps.zip - -cp -r "$smac_maps/*.SC2Map" ./SMAC_Maps mv SMAC_Maps $MAP_DIR -rm -f SMAC_Maps.zip - +rm -rf SMAC_Maps.zip echo 'StarCraft II and SMAC are installed.' + diff --git a/run.sh b/run.sh index 6434de6f..a1bf578a 100755 --- a/run.sh +++ b/run.sh @@ -13,7 +13,7 @@ function onCtrlC () { config=$1 # qmix tag=$2 -maps=${3:-2c_vs_64zg,8m_vs_9m,3s_vs_5z,5m_vs_6m,3s5z_vs_3s6z,corridor,6h_vs_8z,27m_vs_30m} # MMM2 left out +maps=${3:-2c_vs_64zg,8m_vs_9m,3s_vs_5z,5m_vs_6m,3s5z_vs_3s6z,corridor,6h_vs_8z,27m_vs_30m,MMM2} # MMM2 left out threads=${4:-8} # 2 args=${5:-} # "" gpus=${6:-0,1,2,3,4,5,6,7} # 0,1 diff --git a/run_docker.sh b/run_docker.sh index 779402b8..84d5502f 100755 --- a/run_docker.sh +++ b/run_docker.sh @@ -1,6 +1,6 @@ #!/bin/bash HASH=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 4 | head -n 1) -WANDB_API_KEY=$(cat $HOME/.netrc | grep 'password' | awk '{print $2}') +WANDB_API_KEY=$(cat $WANDB_API_KEY_FILE) GPU=$1 name=${USER}_pymarl_GPU_${GPU}_${HASH} diff --git a/src/config/default.yaml b/src/config/default.yaml index 4fc1b1c1..ebaef292 100644 --- a/src/config/default.yaml +++ b/src/config/default.yaml @@ -19,7 +19,7 @@ buffer_cpu_only: True # If true we won't keep all of the replay buffer in vram # --- Logging options --- use_tensorboard: False # Log results to tensorboard use_wandb: true -project: "improve_smac" +project: "smac-v2" entity: "benellis3" group: "ungrouped" save_model: False # Save the models to disk diff --git a/src/utils/logging.py b/src/utils/logging.py index 2b93a367..bacaac1b 100644 --- a/src/utils/logging.py +++ b/src/utils/logging.py @@ -27,9 +27,9 @@ def setup_sacred(self, sacred_run_dict): self.use_sacred = True def setup_wandb(self, config): - wandb.init(project=config.project, entity=config.entity, group=config.group, name=config.tag) + wandb.init(project=config.project, entity=config.entity, group=config.group, name=config.tag, config=config.__dict__) wandb.config = config - # setup a custom step metric so that we can track + # setup a custom step metric so that we can track # environment steps instead of wandb internal episodes wandb.define_metric("train/step") wandb.define_metric("train/*", step_metric="train/step") @@ -85,4 +85,3 @@ def get_logger(): logger.setLevel('DEBUG') return logger -