Skip to content

MRzNone/VectorGym

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VectorGym

Multi-process any(most) gym environment. Automatically parallel the given gym environment using multiprocessing; VectorGym forwards all properties and function (not starting with __) of the underlying gym to you.

Quick Start

Check this demo for a skeleton for training using VectorSim. It deals with only running unfinished environments during trajectory collection.

Run gym environment in parallel.

from VectorGym import VectorGym

if __name__ == '__main__':
    envs = VectorGym('CartPole-v1', 2)

    print(envs.action_space)
    print(envs.observation_space)

    envs.reset()

    for _ in range(500):
        envs.render()
        actions = envs.action_space.sample()
        res = envs.step(actions)
        dones = [r[-2] for r in res]

        envs.reset(select=dones)

    envs.close()

Install

git clone git@github.com:MRzNone/VectorGym.git
cd VectorGym
pip install -e .