Skip to content

Commit

Permalink
[Examples] Add smac script
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Bettini <[email protected]>
  • Loading branch information
matteobettini committed Oct 3, 2023
1 parent 7c738c0 commit 3990fdc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
18 changes: 18 additions & 0 deletions premade_scripts/smacv2/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
defaults:
- experiment: base_experiment
- algorithm: ???
- task: ???
- model: layers/mlp
- model@critic_model: layers/mlp
- _self_

hydra:
searchpath:
# Tells hydra to add the default benchmarl configuration to its path
- pkg://benchmarl/conf

seed: 0

experiment:
sampling_device: "cuda"
train_device: "cuda"
24 changes: 24 additions & 0 deletions premade_scripts/smacv2/smacv2_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import hydra
from benchmarl.experiment import Experiment

from benchmarl.hydra_config import load_experiment_from_hydra
from hydra.core.hydra_config import HydraConfig
from omegaconf import DictConfig, OmegaConf


@hydra.main(version_base=None, config_path=".", config_name="config")
def hydra_experiment(cfg: DictConfig) -> None:
hydra_choices = HydraConfig.get().runtime.choices
task_name = hydra_choices.task
algorithm_name = hydra_choices.algorithm

print(f"\nAlgorithm: {algorithm_name}, Task: {task_name}")
print("\nLoaded config:\n")
print(OmegaConf.to_yaml(cfg))

experiment: Experiment = load_experiment_from_hydra(cfg, task_name=task_name)
experiment.run()


if __name__ == "__main__":
hydra_experiment()
8 changes: 4 additions & 4 deletions premade_scripts/vmas/config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
defaults:
- experiment: base_experiment
- algorithm: mappo
- task: vmas/balance
- algorithm: ???
- task: ???
- model: layers/mlp
- model@critic_model: layers/mlp
- _self_

seed: 0

hydra:
searchpath:
# Tells hydra to add the default benchmarl configuration to its path
- pkg://benchmarl/conf

seed: 0

experiment:
sampling_device: "cuda"
train_device: "cuda"
Expand Down

0 comments on commit 3990fdc

Please sign in to comment.