Skip to main content

A collection of Reinforcement Learning algorithms to train autonomous agents in different environments.

Project description

EnvQuest

Train and evaluate your autonomous agents in different environments using a collection of RL algorithms.

Installation

To install the EnvQuest library, use pip install envquest.

Usage

Run a simple gym environment

import envquest as eq

# Instantiate an environment
env = eq.envs.gym.make_env("LunarLander-v3")

# Instantiate an agent
agent = eq.agents.simple.RandomAgent(env.observation_space, env.action_space)

# Execute an MDP
timestep = env.reset()

while not timestep.last():
    observation = timestep.observation
    action = agent.act(observation=observation)
    timestep = env.step(action)

# Render the environment
frame = env.render(256, 256)

Train a DQN Agent in a gym environment

First, set up a WandB logging environment

# Install wandb
pip install wandb

# Start a wandb local server
wandb server start

Then, train a DQN agent in a gym's CartPole-v1 environment.

import envquest as eq

# Training arguments
arguments = eq.arguments.TrainingArguments(
    env=eq.arguments.EnvArguments(task="CartPole-v1"),
    agent=eq.arguments.DQNAgentArguments(), 
    logging=eq.arguments.LoggingArguments(save_agent_snapshots=False)
)

# Instantiate an environment
env = eq.envs.gym.make_env(task=arguments.env.task, max_episode_length=arguments.env.max_episode_length)

# Instantiate a DQN Agent
agent = eq.agents.dqn.DiscreteQNetAgent(
    mem_capacity=arguments.agent.mem_capacity,
    discount=arguments.agent.discount,
    n_steps=arguments.agent.n_steps,
    lr=arguments.agent.lr,
    tau=arguments.agent.tau,
    eps_start=arguments.agent.eps_start,
    eps_end=arguments.agent.eps_end,
    eps_step_duration=arguments.agent.eps_step_duration,
    eps_decay=arguments.agent.eps_decay,
    observation_space=env.observation_space,
    action_space=env.action_space,
)

# Instantiate a trainer
trainer = eq.trainers.Trainer(env, agent, arguments)

# Start training
trainer.train()

Track the performances of your agent on wandb: http://localhost:8080/

Examples

See some examples in the examples folder.

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

envquest-0.0.7.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

envquest-0.0.7-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file envquest-0.0.7.tar.gz.

File metadata

  • Download URL: envquest-0.0.7.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for envquest-0.0.7.tar.gz
Algorithm Hash digest
SHA256 9408775199b1c4d647638ee15108a17c49426158a4223cedd2730f3e508c4add
MD5 49637b591da471e4ef96c8281e147250
BLAKE2b-256 e75ddd217cf8030a85696ee389a0bf9d910a4ac8c1c0f5623f0e498fe1fea7e4

See more details on using hashes here.

File details

Details for the file envquest-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: envquest-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for envquest-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a535fde45ec5e18be08eb402f18b7487ddb4e96c8e81f770b970865862f49936
MD5 090cb4d581d8db5ed994cb7842bdf190
BLAKE2b-256 8d66a2a30aa4b7da2be5cf85196698518f5d86bccba326909ff28a4def61bbe8

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