Skip to content

A gym interface for AI safety gridworlds created in pycolab.

License

Notifications You must be signed in to change notification settings

jvmncs/safe-grid-gym

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

safe-grid-gym

An OpenAI Gym interface for the AI safety gridworlds by DeepMind, which are implemented in pycolab.

This repository combines and extends two previous implementations which can be found at:

Features

safe_grid_gym additionally provides:

  • Additional features for the Gym environment:
    • A parameter that can be set to get the true hidden reward from the gridworld environments. This allows to test agents on the hidden reward as well as the observed reward.
    • Additional render modes ansi and rgb_array allowing for more automated experimentation
  • Easier dependency management by providing a setup.py
  • Unittests for the Gym environment using the demonstrations provided by in the ai-safety-gridworlds repository

To handle the dependency on the ai-safety-gridworlds we use a fork of the official repository that provides a setup.py.

You can use the code from the official ai-safety-gridworlds repository instead by adding it to your PYTHONPATH.

Usage

By using safe_grid_gym the AI safety gridworlds can by used like any other gym environment. For example to take 10 random actions in the boat race environment and render the gridworld, you can do:

from safe_grid_gym.envs import GridworldEnv

env = GridworldEnv("boat_race")
action_space = env.action_space

for i in range(10):
   action = action_space.sample()
   state, reward, done, info = env.step(action)
   env.render(mode="human")

About

A gym interface for AI safety gridworlds created in pycolab.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%