Skip to content

Turn on Github CI for coordinator_test (a rough approximation to running whole package E2E) #24

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/core_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
pip freeze
- name: Test with pytest # TODO(team): Fix tensorflow version conflict.
run: |
# pytest -n auto iris
pytest -n auto iris/coordinator_test.py
36 changes: 4 additions & 32 deletions iris/coordinator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
from typing import cast

from absl.testing import absltest
import gym
from iris import checkpoint_util
from iris import coordinator
from iris.algorithms import ars_algorithm
from iris.policies import nn_policy
from iris.workers import rl_worker
from iris.workers import simple_worker
import launchpad as lp
from ml_collections import config_dict
import numpy as np
Expand All @@ -35,29 +33,6 @@
_TEST_CHECKPOINT = "./testdata/test_checkpoint.pkl"


class TestEnv(gym.Env):

def __init__(self):
self._ac_dim = 6
self._ob_dim = 14
self.action_space = gym.spaces.Box(
-1 * np.ones(self._ac_dim), np.ones(self._ac_dim), dtype=np.float32
)
self.observation_space = gym.spaces.Box(
-1 * np.ones(self._ob_dim), np.ones(self._ob_dim), dtype=np.float32
)

def step(self, action):
del action
return np.zeros(self._ob_dim), 1.0, False, {}

def reset(self):
return np.zeros(self._ob_dim)

def render(self, mode: str = "rgb_array"):
return np.zeros((16, 16))


def make_bb_program(
num_workers: int,
num_eval_workers: int,
Expand Down Expand Up @@ -154,17 +129,14 @@ def setUp(self):
eval_rate=1,
num_iterations=400,
num_evals_per_suggestion=1,
record_video_during_eval=True,
)
),
worker=config_dict.ConfigDict(
dict(
worker_class=rl_worker.RLWorker,
worker_class=simple_worker.SimpleWorker,
worker_args=dict(
env=TestEnv,
policy=nn_policy.FullyConnectedNeuralNetworkPolicy,
policy_args=dict(hidden_layer_sizes=[64, 64]),
rollout_length=20,
blackbox_function=np.sum,
initial_params=np.zeros(shape=(10,)),
),
)
),
Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
typing # Version dependent on Python version.
absl-py>=1.0.0
numpy>=1.21.5
numpy>=1.21.5,<2.0.0

jax>=0.4.34 # TODO:remove
jaxlib>=0.4.34 # TODO:remove

# Distributed systems libraries.
# NOTE: Requires tensorflow~=2.8.0 to avoid proto issues.
Expand Down
Loading