-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matteo Bettini <[email protected]>
- Loading branch information
1 parent
7c738c0
commit 3990fdc
Showing
3 changed files
with
46 additions
and
4 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
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" |
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() |
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