Skip to main content

gym-dmc is a gym wrapper around DeepMind Control Suite domains.

Project description

Link to other OpenAI Gym Plugins:

  • gym-sawyer

  • gym-toy-nav

Update Log

  • 2024-03-25: Return np.Array from env.render() function

  • 2022-01-13: Add space_dtype for overriding the dtype for the state and action spaces. Default to None, need to set to float/np.float32 for pytorch_SAC implementation.

  • 2022-01-11: Added a env._get_obs() method to allow one to obtain the observation after resetting the environment. Version: ``v0.2.1``

Installation

The dm_control dependency relies on lower versions of setuptools and wheel. Downgrade to fix the installation error.

pip install setuptools==65.5.0
pip install wheel==0.38.4
pip install gym-dmc

How To Use

Usage pattern:

import gym

env = gym.make("dmc:Pendulum-swingup-v1")

For the full list of environments, you can print:

from dm_control.suite import ALL_TASKS

print(*ALL_TASKS, sep="\n")

# Out[2]: ('acrobot', 'swingup')
#         ('acrobot', 'swingup_sparse')
...

We register all of these environments using the following pattern:

acrobot task “swingup_sparse” becomes dmc:Acrobot-swingup_sparse-v1

You can see the usage pattern in https://github.com/geyang/gym_dmc/blob/master/specs/test_gym_dmc.py:

env = gym.make('dmc:Walker-walk-v1', frame_skip=4, space_dtype=np.float32)
assert env.action_space.dtype is np.float32
assert env.observation_space.dtype is np.float32

env = gym.make('dmc:Walker-walk-v1', frame_skip=4)
assert env._max_episode_steps == 250
assert env.reset().shape == (24,)

env = gym.make('dmc:Walker-walk-v1', from_pixels=True, frame_skip=4)
assert env._max_episode_steps == 250

env = gym.make('dmc:Cartpole-balance-v1', from_pixels=True, frame_skip=8)
assert env._max_episode_steps == 125
assert env.reset().shape == (3, 84, 84)

env = gym.make('dmc:Cartpole-balance-v1', from_pixels=True, frame_skip=8, channels_first=False)
assert env._max_episode_steps == 125
assert env.reset().shape == (84, 84, 3)

env = gym.make('dmc:Cartpole-balance-v1', from_pixels=True, frame_skip=8, channels_first=False, gray_scale=True)
assert env._max_episode_steps == 125
assert env.reset().shape == (84, 84, 1)

Note, the ``max_episode_steps`` is calculated based on the ``frame_skip``. All DeepMind control domains terminate after 1000 simulation steps. So for frame_skip=4, the max_episode_steps should be 250.

Built with :heart: by Ge Yang

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gym_dmc-0.3.2-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file gym_dmc-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: gym_dmc-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.17

File hashes

Hashes for gym_dmc-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ccf645786c25d35f11a7a0d04cf8c08fcca61293cf4900c16ac0255098e407e2
MD5 4a0c143757c705c7eb00e5e41e86b992
BLAKE2b-256 82c9aa42163e392b5360c92ef0b815dca39aeabc58457483e1013584074035b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page