Skip to main content

Simple multiprocess tool for gym environments

Project description

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 .

Project details


Download files

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

Source Distribution

VectorGym-0.1.2.linux-x86_64.tar.gz (9.2 kB view hashes)

Uploaded Source

Supported by

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