lagom

lagom: A light PyTorch infrastructure to quickly prototype reinforcement learning algorithms.

Github星跟踪图

lagom is a 'magic' word in Swedish, inte för mycket och inte för lite, enkelhet är bäst (not too much and not too little, simplicity is often the best). It is the philosophy on which this library was designed.

Why to use lagom ?

lagom balances between the flexibility and the usability when developing reinforcement learning (RL) algorithms. The library is built on top of PyTorch and provides modular tools to quickly prototype RL algorithms. However, it does not go overboard, because too low level is often time consuming and prone to potential bugs, while too high level degrades the flexibility which makes it difficult to try out some crazy ideas fast.

We are continuously making lagom more 'self-contained' to set up and run experiments quickly. It internally supports base classes for multiprocessing (master-worker framework) for parallelization (e.g. experiments and evolution strategies). It also supports hyperparameter search by defining configurations either as grid search or random search.

Table of Contents

Installation

We highly recommand using an Miniconda environment:

conda create -n lagom python=3.7

Install dependencies

pip install -r requirements.txt

We also provide some bash scripts in scripts/ directory to automatically set up the system configurations, conda environment and dependencies.

Install lagom from source

git clone https://github.com/zuoxingdong/lagom.git
cd lagom
pip install -e .

Installing from source allows to flexibly modify and adapt the code as you pleased, this is very convenient for research purpose.

Documentation

The documentation hosted by ReadTheDocs is available online at http://lagom.readthedocs.io

RL Baselines

We implemented a collection of standard reinforcement learning algorithms at baselines using lagom.

How to use lagom

A common pipeline to use lagom can be done as following:

  1. Define your RL agent
  2. Define your environment
  3. Define your engine for training and evaluating the agent in the environment.
  4. Define your Configurations for hyperparameter search
  5. Define run(config, seed, device) for your experiment pipeline
  6. Call run_experiment(run, config, seeds, num_worker) to parallelize your experiments

A graphical illustration is coming soon.

Examples

We provide a few simple examples.

Test

We are using pytest for tests. Feel free to run via

pytest test -v

What's new

  • 2019-03-04 (v0.0.3)

    • Much easier and cleaner APIs
  • 2018-11-04 (v0.0.2)

    • More high-level API designs
    • More unit tests
  • 2018-09-20 (v0.0.1)

    • Initial release

Reference

This repo is inspired by OpenAI Gym, OpenAI baselines, OpenAI Spinning Up

Please use this bibtex if you want to cite this repository in your publications:

@misc{lagom,
      author = {Zuo, Xingdong},
      title = {lagom: A PyTorch infrastructure for rapid prototyping of reinforcement learning algorithms},
      year = {2018},
      publisher = {GitHub},
      journal = {GitHub repository},
      howpublished = {\url{https://github.com/zuoxingdong/lagom}},
    }

主要指标

概览
名称与所有者zuoxingdong/lagom
主编程语言Jupyter Notebook
编程语言Python (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2017-12-21 09:51:28
推送于2022-11-19 05:52:37
最后一次提交2019-11-24 23:04:55
发布数6
最新版本名称v0.1.2 (发布于 )
第一版名称v0.0.1 (发布于 )
用户参与
星数375
关注者数15
派生数30
提交数703
已启用问题?
问题数82
打开的问题数14
拉请求数123
打开的拉请求数2
关闭的拉请求数6
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?