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.4.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.4-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: async_gym_agents-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a6943f7391d1f2a2209525807e3176565af877a6ecc256c078a2839672ce6784
MD5 a0e48fffb539e6fd04c64564296ce6a6
BLAKE2b-256 621250c6b1f980a660c6c1b840733a657d1587515cc293045271353a3da3e97f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: async_gym_agents-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 14.5 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0dce60152e5671a7f1ecfc75424e043473c2e0731ea2a33ea6e724f77f8d8720
MD5 70bad07567c84d17ec7ecbb043c95d98
BLAKE2b-256 9616f76fa34be7f5ad87ccfe46cb74c15a619ee0b0d32ed7b87b03f235d25553

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