Skip to content

Commit

Permalink
Merge branch 'develop' into feat/unified-gae
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDuToit authored Nov 25, 2024
2 parents 3778a3a + c6f4f5d commit aab272b
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Tests and Linters 🧪
name: CI 🧪

on: [ pull_request ]

jobs:
tests-and-linters:
linters:
name: "Python ${{ matrix.python-version }} on ubuntu-latest"
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 5

strategy:
matrix:
Expand All @@ -19,7 +19,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.26"
version: "0.5.4"
enable-cache: true
cache-dependency-glob: "requirements/requirements**.txt" # invalidate cache when requirements file changes

Expand All @@ -34,6 +34,3 @@ jobs:

- name: Run linters 🖌️
run: pre-commit run --all-files --verbose

- name: Run tests 🧪
run: pytest -p no:warnings
35 changes: 35 additions & 0 deletions .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Integration Tests 🧪

on:
push:
branches:
- develop

jobs:
integration-tests:
name: "Python ${{ matrix.python-version }} on ubuntu-latest"
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- name: Checkout mava
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.5.4"
enable-cache: true
cache-dependency-glob: "requirements/requirements**.txt" # invalidate cache when requirements file changes

- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"

- name: Install python dependencies 🔧
run: uv pip install .[dev]
env:
UV_SYSTEM_PYTHON: 1

- name: Run integration tests 🧪
run: pytest test/integration_test.py -p no:warnings
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y git build-essential pkg-config libhdf5-

# Add uv and use the system python (no need to make venv)
USER root
COPY --from=ghcr.io/astral-sh/uv:0.4.20 /uv /bin/uv
COPY --from=ghcr.io/astral-sh/uv:0.5.4 /uv /bin/uv
ENV UV_SYSTEM_PYTHON=1

WORKDIR /home/app/mava
Expand Down
2 changes: 1 addition & 1 deletion mava/advanced_usage/ff_ippo_store_experience.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> None:
"""Runs experiment."""
_config.logger.system_name = "ff_ippo"
# Logger setup
config = copy.deepcopy(_config)
logger = MavaLogger(config)
Expand Down Expand Up @@ -674,7 +675,6 @@ def hydra_entry_point(cfg: DictConfig) -> None:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "ff_ippo"

# Run experiment.
run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/mat/anakin/mat.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> float:
"""Runs experiment."""
_config.logger.system_name = "mat"
config = copy.deepcopy(_config)

n_devices = len(jax.devices())
Expand Down Expand Up @@ -586,7 +587,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "mat"

eval_performance = run_experiment(cfg)
jax.block_until_ready(eval_performance)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/ppo/anakin/ff_ippo.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> float:
"""Runs experiment."""
_config.logger.system_name = "ff_ippo"
config = copy.deepcopy(_config)

n_devices = len(jax.devices())
Expand Down Expand Up @@ -563,7 +564,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "ff_ippo"

# Run experiment.
eval_performance = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/ppo/anakin/ff_mappo.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> float:
"""Runs experiment."""
_config.logger.system_name = "ff_mappo"
config = copy.deepcopy(_config)

n_devices = len(jax.devices())
Expand Down Expand Up @@ -546,7 +547,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "ff_mappo"

# Run experiment.
eval_performance = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/ppo/anakin/rec_ippo.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> float:
"""Runs experiment."""
_config.logger.system_name = "rec_ippo"
config = copy.deepcopy(_config)

n_devices = len(jax.devices())
Expand Down Expand Up @@ -715,7 +716,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "rec_ippo"

# Run experiment.
eval_performance = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/ppo/anakin/rec_mappo.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> float:
"""Runs experiment."""
_config.logger.system_name = "rec_mappo"
config = copy.deepcopy(_config)

n_devices = len(jax.devices())
Expand Down Expand Up @@ -709,7 +710,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "rec_mappo"

# Run experiment.
eval_performance = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/ppo/sebulba/ff_ippo.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> float:
"""Runs experiment."""
_config.logger.system_name = "ff_ippo_sebulba"
config = copy.deepcopy(_config)

local_devices = jax.local_devices()
Expand Down Expand Up @@ -739,7 +740,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "ff_ippo_sebulba"

# Run experiment.
eval_performance = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/q_learning/anakin/rec_iql.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def update_step(

def run_experiment(cfg: DictConfig) -> float:
# Add runtime variables to config
cfg.logger.system_name = "rec_iql"
cfg.arch.n_devices = len(jax.devices())
cfg = check_total_timesteps(cfg)

Expand Down Expand Up @@ -627,7 +628,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "rec_iql"

# Run experiment.
eval_performance = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/q_learning/anakin/rec_qmix.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ def update_step(


def run_experiment(cfg: DictConfig) -> float:
cfg.logger.system_name = "rec_qmix"
cfg.arch.n_devices = len(jax.devices())
cfg = check_total_timesteps(cfg)

Expand Down Expand Up @@ -676,7 +677,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "rec_qmix"
# Run experiment.
eval_performance = run_experiment(cfg)

Expand Down
2 changes: 1 addition & 1 deletion mava/systems/sable/anakin/ff_sable.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> float:
"""Runs experiment."""
_config.logger.system_name = "ff_sable"
config = copy.deepcopy(_config)

n_devices = len(jax.devices())
Expand Down Expand Up @@ -655,7 +656,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "ff_sable"

# Run experiment.
eval_performance = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/sable/anakin/rec_sable.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ def learner_setup(

def run_experiment(_config: DictConfig) -> float:
"""Runs experiment."""
_config.logger.system_name = "rec_sable"
config = copy.deepcopy(_config)

n_devices = len(jax.devices())
Expand Down Expand Up @@ -685,7 +686,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "rec_sable"

# Run experiment.
eval_performance = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/sac/anakin/ff_hasac.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ def update_step(carry: LearnerState, _: Any) -> Tuple[LearnerState, Tuple[Metric

def run_experiment(cfg: DictConfig) -> float:
# Add runtime variables to config
cfg.logger.system_name = "ff_hasac"
cfg.arch.n_devices = len(jax.devices())
cfg = check_total_timesteps(cfg)

Expand Down Expand Up @@ -715,7 +716,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "ff_hasac"

# Run experiment.
final_return = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/sac/anakin/ff_isac.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ def update_step(carry: LearnerState, _: Any) -> Tuple[LearnerState, Tuple[Metric

def run_experiment(cfg: DictConfig) -> float:
# Add runtime variables to config
cfg.logger.system_name = "ff_isac"
cfg.arch.n_devices = len(jax.devices())
cfg = check_total_timesteps(cfg)

Expand Down Expand Up @@ -614,7 +615,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "ff_isac"

# Run experiment.
final_return = run_experiment(cfg)
Expand Down
2 changes: 1 addition & 1 deletion mava/systems/sac/anakin/ff_masac.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ def update_step(carry: LearnerState, _: Any) -> Tuple[LearnerState, Tuple[Metric

def run_experiment(cfg: DictConfig) -> float:
# Add runtime variables to config
cfg.logger.system_name = "ff_masac"
cfg.arch.n_devices = len(jax.devices())
cfg = check_total_timesteps(cfg)

Expand Down Expand Up @@ -627,7 +628,6 @@ def hydra_entry_point(cfg: DictConfig) -> float:
"""Experiment entry point."""
# Allow dynamic attributes.
OmegaConf.set_struct(cfg, False)
cfg.logger.system_name = "ff_masac"

# Run experiment.
final_return = run_experiment(cfg)
Expand Down

0 comments on commit aab272b

Please sign in to comment.