From 6784d95c90f06ca7bf8fe9d7c34a13fb8924336f Mon Sep 17 00:00:00 2001 From: Toby Boyd Date: Tue, 17 Aug 2021 10:51:47 -0700 Subject: [PATCH] Require pillow and use KellyCoinflip instead of FrozenLake for gym test. These changes need to go together because the build is broke due to both reasons in the past 12-24 hours. - Pillow was likely (I have not looked into that yet) being installed by another required package and is no longer a dependency of that package and thus the failure began. - OpenAI Gym is not longer loading FrozenLake-v0 and FrozenLake-v1 is new and might not be available to all users. Moving the kwargs test to use KellyCoinflip resolves the problem. Here is what happened with FrozenLake-v0: https://github.com/openai/gym/pull/2205 and https://github.com/openai/gym/pull/2315 PiperOrigin-RevId: 391328529 Change-Id: I09e6e962a32330b24b1fc44ebe222fb1d842d5c3 --- setup.py | 1 + tf_agents/environments/suite_gym_test.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index a41dc12aa..12af2fa6c 100644 --- a/setup.py +++ b/setup.py @@ -174,6 +174,7 @@ def get_required_packages(): 'gin-config >= 0.4.0', 'gym >= 0.17.0', 'numpy >= 1.13.3', + 'pillow', 'six >= 1.10.0', 'protobuf >= 3.11.3', 'wrapt >= 1.11.1', diff --git a/tf_agents/environments/suite_gym_test.py b/tf_agents/environments/suite_gym_test.py index 1d057d8a7..877717778 100644 --- a/tf_agents/environments/suite_gym_test.py +++ b/tf_agents/environments/suite_gym_test.py @@ -69,11 +69,12 @@ def testGinConfig(self): self.assertIsInstance(env, wrappers.TimeLimit) def test_gym_kwargs_argument(self): - env = suite_gym.load('FrozenLake-v0', gym_kwargs={'map_name': '4x4'}) - self.assertTupleEqual(env.unwrapped.desc.shape, (4, 4)) + env = suite_gym.load('KellyCoinflip-v0', gym_kwargs={'initial_wealth': 21}) + self.assertEqual(env.unwrapped.initial_wealth, 21) - env = suite_gym.load('FrozenLake-v0', gym_kwargs={'map_name': '8x8'}) - self.assertTupleEqual(env.unwrapped.desc.shape, (8, 8)) + env = suite_gym.load('KellyCoinflip-v0', + gym_kwargs={'initial_wealth': 50}) + self.assertEqual(env.unwrapped.initial_wealth, 50) def test_load_gym_render_kwargs(self): env = suite_gym.load('CartPole-v1',