Skip to main content

Async agents for Stable Baselines 3

Project description

Async Gym Agents

Wrapper environments and agent injectors to allow for drop-in async training.

import gymnasium as gym
from stable_baselines3 import TD3

from async_gym_agents.agents.async_agent import get_injected_agent
from async_gym_agents.envs.multi_env import IndexableMultiEnv

# Create env with 8 parallel envs
env = IndexableMultiEnv([lambda: gym.make("Pendulum-v1") for i in range(8)])

# Create the model, injected with async capabilities
model = get_injected_agent(TD3)("MlpPolicy", env)

# Train the model
model.learn(total_timesteps=10)

# Shut down workers
model.shutdown()

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

async_gym_agents-0.1.2.tar.gz (40.1 kB view details)

Uploaded Source

Built Distribution

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

async_gym_agents-0.1.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file async_gym_agents-0.1.2.tar.gz.

File metadata

  • Download URL: async_gym_agents-0.1.2.tar.gz
  • Upload date:
  • Size: 40.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.6 Windows/10

File hashes

Hashes for async_gym_agents-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d759940a7388437e9c28ec238afc825975ed2bf1f7bc67cc04994c14a1c011b0
MD5 eee3b4ec589a3c70590a17256050163e
BLAKE2b-256 04d622f0271e24ac20f5c278f9d9d721130e3c7756bbc1d5ca0bdf6b2b8653c5

See more details on using hashes here.

File details

Details for the file async_gym_agents-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: async_gym_agents-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.6 Windows/10

File hashes

Hashes for async_gym_agents-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5f873e7f9bd8cb47fe1a3c04bb322c2d5adfcd28b00de923b480b570c83ba521
MD5 e0c84e83a6d57845d8daf0a78bbc343f
BLAKE2b-256 914d93efcf647ef81d87e37ace325479a0164e93d6198e20f16d6055a9cf0dd0

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