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 functools import partial
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 (Also supports VecEnvs)
env = IndexableMultiEnv([partial(gym.make, "Pendulum-v1") for i in range(8)])

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

# 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.2.6.tar.gz (12.9 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.2.6-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: async_gym_agents-0.2.6.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.8 Windows/10

File hashes

Hashes for async_gym_agents-0.2.6.tar.gz
Algorithm Hash digest
SHA256 2795b840a0302ecea431279a95f75295d8c0155012c9c82e662d992c91ab1143
MD5 f958db453d57eed6ec91f0ed8a4d99d8
BLAKE2b-256 b9d47b850a7af48fa96838fd227cd0dd60b5bbcfd15174a14344b8be792ca082

See more details on using hashes here.

File details

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

File metadata

  • Download URL: async_gym_agents-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.8 Windows/10

File hashes

Hashes for async_gym_agents-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4270a859d02cd280690abb6f0e6e2b8ae3676d61db4f664fb8cd8997ea7939b4
MD5 49756feb7e6c1cb061841c71f90f4a24
BLAKE2b-256 18357920c2282d05c82ca16eb356b602784891005bd7f92bd0768bac02822902

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