Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: anakin and sebulba folders #1090

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
adc2114
feat: gym wrapper
Louay-Ben-nessir Jun 10, 2024
ce86d09
chore : pre-commit hooks
Louay-Ben-nessir Jun 10, 2024
d5edf45
fix: merged the observations and action mask
Louay-Ben-nessir Jun 14, 2024
f891be5
fix: Create the gym wrappers directly
Louay-Ben-nessir Jun 14, 2024
15f4867
chore: pre-commit
Louay-Ben-nessir Jun 14, 2024
82ea827
fix: fixed the async env creation
Louay-Ben-nessir Jun 14, 2024
4e94df5
fix: gymV26 compatability wrapper
Louay-Ben-nessir Jun 14, 2024
8a86be9
fix: various minor fixes
Louay-Ben-nessir Jun 15, 2024
1da5c15
fix: handling rware reset function
Louay-Ben-nessir Jun 15, 2024
4466044
feat: async env wrapper , changed the gym wrapper to rware wrapper
Louay-Ben-nessir Jun 16, 2024
24d8aae
fix: fixed the async env wrapper
Louay-Ben-nessir Jun 16, 2024
a6deae2
fix: info only contains the action_mask and reformated (n_agents, n_e…
Louay-Ben-nessir Jun 18, 2024
1475bd0
chore: removed async gym wrapper
Louay-Ben-nessir Jun 22, 2024
9fce9c6
feat: gym metric tracker wrapper
Louay-Ben-nessir Jun 22, 2024
c3b405d
chore: clean up & updated the code to match the sebulba-ff-ippo branch
Louay-Ben-nessir Jul 10, 2024
e40c5d4
chore : pre-commits and some comments
Louay-Ben-nessir Jul 10, 2024
4b17c15
chore: removed unused config file
Louay-Ben-nessir Jul 10, 2024
d694498
chore: created the anakin and sebulba folders
Louay-Ben-nessir Jul 16, 2024
cb8111f
fix: imports and config paths in systems
Louay-Ben-nessir Jul 16, 2024
f1adc31
chore: pre-commits
Louay-Ben-nessir Jul 16, 2024
3850591
feat: LBF and reproducibility
Louay-Ben-nessir Jul 16, 2024
133a250
fix: added missing lbf import
Louay-Ben-nessir Jul 17, 2024
a368476
fix: config and imports for anakin q_learning and sac
Louay-Ben-nessir Jul 17, 2024
32433ff
chore: arch_name for anakin
Louay-Ben-nessir Jul 17, 2024
a68c8e9
fix: sum the rewards when using a shared reward
Louay-Ben-nessir Jul 17, 2024
8cee7ac
fix: configs revamp
Louay-Ben-nessir Jul 17, 2024
e199f3a
chore: pre-commits
Louay-Ben-nessir Jul 17, 2024
2b71d3b
fix: more config changes
Louay-Ben-nessir Jul 17, 2024
e87ad28
chore: pre-commits
Louay-Ben-nessir Jul 17, 2024
2b587c0
chore: renamed arch_name to architecture_name
Louay-Ben-nessir Jul 18, 2024
5ad4d2f
chore: config files rename
Louay-Ben-nessir Jul 18, 2024
432071e
fix; moved from gym to gymnasium
Louay-Ben-nessir Jul 18, 2024
77e6e12
feat: generic gym wrapper
Louay-Ben-nessir Jul 18, 2024
43511fd
feat: using gymnasium async worker
Louay-Ben-nessir Jul 18, 2024
eaf9a1c
chore: pre-commits and annotaions
Louay-Ben-nessir Jul 18, 2024
16c0ac3
fix: config file fixes
Louay-Ben-nessir Jul 18, 2024
18b928d
fix: rware import
Louay-Ben-nessir Jul 18, 2024
19a7765
fix: better agent ids wrapper?
Louay-Ben-nessir Jul 18, 2024
c4a05d6
chore: bunch of minor changes
Louay-Ben-nessir Jul 18, 2024
5595818
chore : annotation
Louay-Ben-nessir Jul 18, 2024
29b1303
chore: comments
Louay-Ben-nessir Jul 19, 2024
669dfbd
feat: restructured the folders
Louay-Ben-nessir Jul 19, 2024
2a6452d
fix: config file fixes
Louay-Ben-nessir Jul 19, 2024
e2f36f9
fix: LBF import
Louay-Ben-nessir Jul 19, 2024
29396c9
fix: Async worker auto-resetting
Louay-Ben-nessir Jul 19, 2024
6de0b1e
chore: minor changes
Louay-Ben-nessir Jul 19, 2024
7584ce5
fixed: annotations and add agent id spaces
Louay-Ben-nessir Jul 22, 2024
e638e9f
fix: fixed the logging deadlock for sebulba
Louay-Ben-nessir Jul 22, 2024
81b0a89
Merge pull request #4 from Louay-Ben-nessir/feat-sebulba-gym-wrapper
Louay-Ben-nessir Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mava/configs/arch/anakin.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# --- Anakin config ---
architecture_name: anakin

# --- Training ---
num_envs: 16 # Number of vectorised environments per device.
Expand Down
19 changes: 19 additions & 0 deletions mava/configs/arch/sebulba.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# --- Sebulba config ---
architecture_name: sebulba

# --- Training ---
num_envs: 32 # number of environments per thread.

# --- Evaluation ---
evaluation_greedy: False # Evaluate the policy greedily. If True the policy will select
# an action which corresponds to the greatest logit. If false, the policy will sample
# from the logits.
num_eval_episodes: 32 # Number of episodes to evaluate per evaluation.
num_evaluation: 200 # Number of evenly spaced evaluations to perform during training.
absolute_metric: True # Whether the absolute metric should be computed. For more details
# on the absolute metric please see: https://arxiv.org/abs/2209.10485

# --- Sebulba devices config ---
n_threads_per_executor: 1 # num of different threads/env batches per actor
executor_device_ids: [0] # ids of actor devices
learner_device_ids: [0] # ids of learner devices
19 changes: 19 additions & 0 deletions mava/configs/env/lbf_gym.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ---Environment Configs---
defaults:
- _self_
- scenario: gym-lbf-2s-8x8-2p-2f-coop # [gym-lbf-2s-8x8-2p-2f-coop, gym-lbf-8x8-2p-2f-coop, gym-lbf-2s-10x10-3p-3f, gym-lbf-10x10-3p-3f, gym-lbf-15x15-3p-5f, gym-lbf-15x15-4p-3f, gym-lbf-15x15-4p-5f]

env_name: LevelBasedForaging # Used for logging purposes.

# Defines the metric that will be used to evaluate the performance of the agent.
# This metric is returned at the end of an experiment and can be used for hyperparameter tuning.
eval_metric: episode_return

# Whether the add agents IDs to the observations returned by the environment.
add_agent_id : False

# Whether or not to log the winrate of this environment.
log_win_rate: False

# Weather or not to sum the returned rewards over all of the agents.
use_shared_rewards: True
19 changes: 19 additions & 0 deletions mava/configs/env/rware_gym.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ---Environment Configs---
defaults:
- _self_
- scenario: gym-rware-tiny-2ag # [gym-rware-tiny-2ag, gym-rware-tiny-4ag, gym-rware-tiny-4ag-easy, gym-rware-small-4ag]

env_name: RobotWarehouse # Used for logging purposes.

# Defines the metric that will be used to evaluate the performance of the agent.
# This metric is returned at the end of an experiment and can be used for hyperparameter tuning.
eval_metric: episode_return

# Whether the add agents IDs to the observations returned by the environment.
add_agent_id : False

# Whether or not to log the winrate of this environment.
log_win_rate: False

# Weather or not to sum the returned rewards over all of the agents.
use_shared_rewards: True
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-lbf-10x10-3p-3f.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the 10x10-3p-3f scenario with the VectorObserver set as default
name: LevelBasedForaging
task_name: 10x10-3p-3f

task_config:
field_size: [10,10]
sight: 10
players: 3
max_num_food: 3
max_player_level: 2
force_coop: False
max_episode_steps: 100
min_player_level : 1
min_food_level : null
max_food_level : null

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-lbf-15x15-3p-5f.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the 15x15-3p-5f scenario with the VectorObserver set as default
name: LevelBasedForaging
task_name: 15x15-3p-5f

task_config:
field_size: [15, 15]
sight: 15
players: 3
max_num_food: 5
max_player_level: 2
force_coop: False
max_episode_steps: 100
min_player_level : 1
min_food_level : null
max_food_level : null

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-lbf-15x15-4p-3f.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the 15x15-4p-3f scenario with the VectorObserver set as default
name: LevelBasedForaging
task_name: 15x15-4p-3f

task_config:
field_size: [15, 15]
sight: 15
players: 4
max_num_food: 3
max_player_level: 2
force_coop: False
max_episode_steps: 100
min_player_level : 1
min_food_level : null
max_food_level : null

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-lbf-15x15-4p-5f.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the 15x15-4p-5f scenario with the VectorObserver set as default
name: LevelBasedForaging
task_name: 15x15-4p-5f

task_config:
field_size: [15, 15]
sight: 15
players: 4
max_num_food: 5
max_player_level: 2
force_coop: False
max_episode_steps: 100
min_player_level : 1
min_food_level : null
max_food_level : null

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-lbf-2s-10x10-3p-3f.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the 2s10x10-3p-3f scenario with the VectorObserver set as default
name: LevelBasedForaging
task_name: 2s-10x10-3p-3f

task_config:
field_size: [10, 10]
sight: 2
players: 3
max_num_food: 3
max_player_level: 2
force_coop: False
max_episode_steps: 100
min_player_level : 1
min_food_level : null
max_food_level : null

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-lbf-2s-8x8-2p-2f-coop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the 2s-8x8-2p-2f-coop scenario with the VectorObserver set as default.
name: LevelBasedForaging
task_name: 2s-8x8-2p-2f-coop

task_config:
field_size: [8, 8] # size of the grid to generate.
sight: 2 # field of view of an agent.
players: 2 # number of agents on the grid.
max_num_food: 2 # number of food in the environment.
max_player_level: 2 # maximum level of the agents (inclusive).
force_coop: True # force cooperation between agents.
max_episode_steps: 100 # max number of steps per episode.
min_player_level : 1 # minimum level of the agents (inclusive).
min_food_level : null
max_food_level : null

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-lbf-8x8-2p-2f-coop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the 8x8-2p-2f-coop scenario with the VectorObserver set as default
name: LevelBasedForaging
task_name: 8x8-2p-2f-coop

task_config:
field_size: [8, 8]
sight: 8
players: 2
max_num_food: 2
max_player_level: 2
force_coop: True
max_episode_steps: 100
min_player_level : 1
min_food_level : null
max_food_level : null

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-rware-small-4ag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the small-4ag environment
name: RobotWarehouse
task_name: small-4ag

task_config:
column_height: 8
shelf_rows: 2
shelf_columns: 3
n_agents: 4
sensor_range: 1
request_queue_size: 4
msg_bits : 0
max_inactivity_steps : null
max_steps : 500
reward_type : 0

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-rware-tiny-2ag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the tiny-2ag environment
name: RobotWarehouse
task_name: tiny-2ag

task_config:
column_height: 8
shelf_rows: 1
shelf_columns: 3
n_agents: 2
sensor_range: 1
request_queue_size: 2
msg_bits : 0
max_inactivity_steps : null
max_steps : 500
reward_type : 0

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-rware-tiny-4ag-easy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the tiny-4ag-easy environment
name: RobotWarehouse
task_name: tiny-4ag-easy

task_config:
column_height: 8
shelf_rows: 1
shelf_columns: 3
n_agents: 4
sensor_range: 1
request_queue_size: 8
msg_bits : 0
max_inactivity_steps : null
max_steps : 500
reward_type : 0

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
18 changes: 18 additions & 0 deletions mava/configs/env/scenario/gym-rware-tiny-4ag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The config of the tiny_4ag environment
name: RobotWarehouse
task_name: tiny-4ag

task_config:
column_height: 8
shelf_rows: 1
shelf_columns: 3
n_agents: 4
sensor_range: 1
request_queue_size: 4
msg_bits : 0
max_inactivity_steps : null
max_steps : 500
reward_type : 0

env_kwargs:
{} # there are no scenario specific env_kwargs for this env
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def run_experiment(_config: DictConfig) -> float:
return eval_performance


@hydra.main(config_path="../../configs", config_name="default_ff_ippo.yaml", version_base="1.2")
@hydra.main(config_path="../../../configs", config_name="default_ff_ippo.yaml", version_base="1.2")
def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def run_experiment(_config: DictConfig) -> float:
return eval_performance


@hydra.main(config_path="../../configs", config_name="default_ff_mappo.yaml", version_base="1.2")
@hydra.main(config_path="../../../configs", config_name="default_ff_mappo.yaml", version_base="1.2")
def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def run_experiment(_config: DictConfig) -> float: # noqa: CCR001
return eval_performance


@hydra.main(config_path="../../configs", config_name="default_rec_ippo.yaml", version_base="1.2")
@hydra.main(config_path="../../../configs", config_name="default_rec_ippo.yaml", version_base="1.2")
def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,9 @@ def run_experiment(_config: DictConfig) -> float: # noqa: CCR001
return eval_performance


@hydra.main(config_path="../../configs", config_name="default_rec_mappo.yaml", version_base="1.2")
@hydra.main(
config_path="../../../configs", config_name="default_rec_mappo.yaml", version_base="1.2"
)
def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
Expand Down
13 changes: 13 additions & 0 deletions mava/systems/ppo/sebulba/ff_ippo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2022 InstaDeep Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def run_experiment(cfg: DictConfig) -> float:
return float(eval_performance)


@hydra.main(config_path="../../configs", config_name="default_rec_iql.yaml", version_base="1.2")
@hydra.main(config_path="../../../configs", config_name="default_rec_iql.yaml", version_base="1.2")
def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def run_experiment(cfg: DictConfig) -> float:
return eval_performance


@hydra.main(config_path="../../configs", config_name="default_ff_isac.yaml", version_base="1.2")
@hydra.main(config_path="../../../configs", config_name="default_ff_isac.yaml", version_base="1.2")
def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def run_experiment(cfg: DictConfig) -> float:
return eval_performance


@hydra.main(config_path="../../configs", config_name="default_ff_masac.yaml", version_base="1.2")
@hydra.main(config_path="../../../configs", config_name="default_ff_masac.yaml", version_base="1.2")
def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
Expand Down
5 changes: 4 additions & 1 deletion mava/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,11 @@ class NeptuneLogger(BaseLogger):
def __init__(self, cfg: DictConfig, unique_token: str) -> None:
tags = list(cfg.logger.kwargs.neptune_tag)
project = cfg.logger.kwargs.neptune_project
mode = (
"async" if cfg.arch.architecture_name == "anakin" else "sync"
) # async logging leads to deadlocks in sebulba

self.logger = neptune.init_run(project=project, tags=tags)
self.logger = neptune.init_run(project=project, tags=tags, mode=mode)

self.logger["config"] = stringify_unsupported(cfg)
self.detailed_logging = cfg.logger.kwargs.detailed_neptune_logging
Expand Down
Loading
Loading