Skip to main content

Deep Reinforcement Learning for minimalists.

Project description

minRL: Deep Reinforcement Learning for minimalists

pip install minRL
from minRL.ppo import PPOClip, Recorder, gym, make_actor_critic, np, tc
from minRL.spin_ppo import ppo as spin_ppo

rec = Recorder()

for id in [
    "Acrobot-v1",
    "CartPole-v1",
    "MountainCarContinuous-v0",
    "MountainCar-v0",
    "Pendulum-v1",
]:
    print(id)
    tc.manual_seed(0)
    np.random.seed(0)
    env = gym.make(id)
    pi_net, V_net = make_actor_critic(env)
    ppo = PPOClip(pi_net, V_net)
    for e in range(50):
        loss_pi, loss_V = ppo.learn(ppo.get_D_from_env(env, rec, N=4000, max_L=1000))
    print(loss_pi, loss_V)

    # spin-up ppo
    spin_ppo(
        lambda: gym.make(id), rec, epochs=50, steps_per_epoch=4000, max_ep_len=1000
    )

    rec.save()

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

minrl-0.0.6.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

minRL-0.0.6-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file minrl-0.0.6.tar.gz.

File metadata

  • Download URL: minrl-0.0.6.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for minrl-0.0.6.tar.gz
Algorithm Hash digest
SHA256 024431938d03ecb338d79bfd2814287805a41dea4a7a760e31dea3f285edb63d
MD5 ce6ced924dd3c694d552089fc7c6dc2a
BLAKE2b-256 fd5c28cff6dd3e295b4dcd03868cedd59558f1d15af5fa7e84830fed023dec49

See more details on using hashes here.

File details

Details for the file minRL-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: minRL-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for minRL-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 509906e99326cf76f86fcb084b4ab955f171d4538ed639b0f597a5d61f03c23b
MD5 f26420cc25e0343cf370f249573258dc
BLAKE2b-256 4637336ffeea0bb8f0f1ca1a25a3ec1748f1ba31671986ff5966a1d7cd66effd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page