Skip to content

Commit

Permalink
Add qmix updates
Browse files Browse the repository at this point in the history
  • Loading branch information
benellis3 committed Apr 5, 2022
1 parent dae8a04 commit 5bcbf54
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 14 additions & 9 deletions install_sc2.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.'

2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion run_docker.sh
Original file line number Diff line number Diff line change
@@ -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}

Expand Down
2 changes: 1 addition & 1 deletion src/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -85,4 +85,3 @@ def get_logger():
logger.setLevel('DEBUG')

return logger

0 comments on commit 5bcbf54

Please sign in to comment.