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

Feature/jax abstract system class #405

Merged
merged 25 commits into from
Feb 25, 2022
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2ecac5d
feat: abstract class for system in jax
arnupretorius Feb 10, 2022
27460a9
style: changed doc string formatting style to remove types
arnupretorius Feb 10, 2022
448ef22
test: almost done with test, did wrong way around though
arnupretorius Feb 10, 2022
cb43bd4
test: done with basic test for abstract system class
arnupretorius Feb 10, 2022
26f849d
feat: done with abstract system class - all tests passing
arnupretorius Feb 10, 2022
786e671
Merge branch 'develop' into feature/jax-abstract-system-class
arnupretorius Feb 10, 2022
dc756c9
fix: remove incomplete class test
arnupretorius Feb 10, 2022
d615ef5
chore: pull latest updates
arnupretorius Feb 10, 2022
e9d3a51
style: separate out distribute from launch in systems
arnupretorius Feb 16, 2022
2b305a1
chore: add reminder to use mava config for tests
arnupretorius Feb 17, 2022
10ae662
feat: simplify abstract class
arnupretorius Feb 17, 2022
3a4e271
fix: remove config input to launcher
arnupretorius Feb 18, 2022
16ca2db
style: update abstract to include system design method
arnupretorius Feb 21, 2022
12c8f8e
feat: add configure method to abstract class for setting hyperparameters
arnupretorius Feb 21, 2022
7f5eb5e
Merge branch 'develop' into feature/jax-abstract-system-class
KaleabTessera Feb 21, 2022
20f3d53
Merge branch 'develop' into feature/jax-abstract-system-class
arnupretorius Feb 23, 2022
1f04771
fix: sync code with branches upstream
arnupretorius Feb 24, 2022
71641f2
chore: merge with remote branch
arnupretorius Feb 24, 2022
751d6f2
chore: change local to single process for better clarity
arnupretorius Feb 24, 2022
968b43f
Merge branch 'develop' into feature/jax-abstract-system-class
arnupretorius Feb 24, 2022
bc053dc
test: all abstract function overwritten
arnupretorius Feb 24, 2022
2a644b0
chore: merge with remote
arnupretorius Feb 24, 2022
ab596fb
chore: remove unneeded test
arnupretorius Feb 25, 2022
be82a86
fix: remove unused component constant
arnupretorius Feb 25, 2022
3f40508
Merge branch 'develop' into feature/jax-abstract-system-class
arnupretorius Feb 25, 2022
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
Next Next commit
feat: abstract class for system in jax
  • Loading branch information
arnupretorius committed Feb 10, 2022
commit 2ecac5db08753247cdf87f5c970c1b07a01ee693
71 changes: 71 additions & 0 deletions mava/core_jax.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# python3
# Copyright 2021 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.


"""Core Mava interfaces for Jax systems."""

import abc
from types import SimpleNamespace
from typing import Any, List


class BaseSystem(abc.ABC):
"""Abstract system object."""

@abc.abstractmethod
def configure(self, config: Any) -> SimpleNamespace:
"""[summary]

Args:
config ([type]): [description]

Returns:
[type]: [description]
"""

@abc.abstractmethod
def update(self, component: Any, name: str) -> None:
"""[summary]

Args:
component (Any): [description]
name (str): [description]
"""

@abc.abstractmethod
def add(self, component: Any, name: str) -> None:
"""[summary]

Args:
component (Any): [description]
name (str): [description]
"""

@abc.abstractmethod
def launch(
self,
num_executors: int,
multi_process: str,
nodes_on_gpu: List[str],
name: str,
):
"""[summary]

Args:
num_executors (int): [description]
multi_process (str): [description]
nodes_on_gpu (List[str]): [description]
name (str): [description]
"""