Code Monkey home page Code Monkey logo

cnf's Introduction

Conservative Normalizing Flows

An official implementation for Conservative Normalizing Flows (CNF).


cnf scheme

How to use

Clone the repo, run docker and install requirements:

cd docker/
./docker_run.sh
docker exec -it flows bash
cd docker/
install.sh

Single model runs:

  1. To pre-train single Normalizing Flow model on the offline dataset:
python configs/run_flow.py --env_name <env_name to train on>
  1. Select the best checkpoint from Normalizing Flow pre-training and copy it to flow_checkpoints/ directory using environment name: flow_checkpoints/halfcheetah-medium-expert-v2.pt for example.
  2. To run single RL CNF training run:
python configs/run_rl.py --env_name <env_name to train on>

Hyperparameter search

  1. To pre-train NF models run
python configs/sweep_flow.py --env_name <env_name to train on> --n_epoch <number of training epochs>

This command print sweep id into the terminal. Copy and paste it into configs/run_sweep_flow.py as sweep_id parameter and run

python configs/run_sweep_flow.py
  1. Select the best checkpoint from Normalizing Flow pre-training and place it to flow_checkpoints/ directory.
  2. Run following command, it will print RL sweep it. Copy and paste it into configs/run_sweep_rl.py as sweep_id parameter
python configs/sweep_rl.py
  1. Run
python configs/run_sweep_rl.py

Expected results

Halfcheetah environment

Citing

If you find this code useful, please cite our paper:

@article{akimov2022let,
  title={Let Offline RL Flow: Training Conservative Agents in the Latent Space of Normalizing Flows},
  author={Akimov, Dmitriy and Kurenkov, Vladislav and Nikulin, Alexander and Tarasov, Denis and Kolesnikov, Sergey},
  journal={arXiv preprint arXiv:2211.11096},
  year={2022}
}

Note

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.