-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Example] Made available premade example script
Signed-off-by: Matteo Bettini <[email protected]>
- Loading branch information
1 parent
944d562
commit fd57ae9
Showing
4 changed files
with
50 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defaults: | ||
- experiment: base_experiment | ||
- algorithm: mappo | ||
- task: vmas/balance | ||
- 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 | ||
|
||
experiment: | ||
sampling_device: "cuda" | ||
train_device: "cuda" | ||
collected_frames_per_batch: 60_000 | ||
n_envs_per_worker: 600 | ||
on_policy_minibatch_size: 4096 | ||
evaluation_episodes: 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |