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.2.tar.gz (12.5 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.2-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: async_gym_agents-0.2.2.tar.gz
  • Upload date:
  • Size: 12.5 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.2.tar.gz
Algorithm Hash digest
SHA256 c4984ee6d98adb947200d3dcca76d3d704a73145eab4435b26d545e599a7466b
MD5 903c02637ecf172b4604c013e000bb50
BLAKE2b-256 22030bf294e330af1d1628707f0d573e3c2e9e77771d7cda60b980a5760a160d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: async_gym_agents-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 18.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be616ce75c72b7da89681a8008a27d5cd24ff5189aff3ad50861a7aaf7de1965
MD5 6a5b96bc02f10fcfe830c98afe22cc27
BLAKE2b-256 af9d4b056df2c1c6156d92eff54168db6b0fac32cab19f01845a054a7cc366ed

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