Giter VIP home page Giter VIP logo

dsac's Introduction

DSAC

Implementation of Distributional Soft Actor Critic (DSAC). This repository is based on RLkit, a reinforcement learning framework implemented by PyTorch. The core algorithm of DSAC is in rlkit/torch/dsac/

Requirements

  • python 3.6+
  • pytorch 1.0+
  • gym[all] 0.15+
  • scipy 1.0+
  • numpy
  • matplotlib
  • gtimer
  • pyyaml

Usage

You can write your experiment settings in YAML and run with

python dsac.py --config your_config.yaml --gpu 0 --seed 0

To run our implementation of SAC/TD3/TD4, please replace dsac.py with sac.py/td3.py/td4.py. Set --gpu -1, your program will run on CPU.

The experimental configurations of the paper are in config/. A typical configuration in YAML is given as follow:

env: Hopper-v2
version: normal-iqn-neutral # version for logging
eval_env_num: 10 # # of paralleled environments for evaluation
expl_env_num: 10 # of paralleled environments for exploration
layer_size: 256 # hidden size of networks
num_quantiles: 32
replay_buffer_size: 1000000
algorithm_kwargs:
  batch_size: 256
  max_path_length: 1000
  min_num_steps_before_training: 10000
  num_epochs: 1000
  num_eval_paths_per_epoch: 10
  num_expl_steps_per_train_loop: 1000
  num_trains_per_train_loop: 1000
trainer_kwargs:
  alpha: 0.2
  discount: 0.99
  policy_lr: 0.0003
  zf_lr: 0.0003
  soft_target_tau: 0.005
  tau_type: iqn # quantile fraction generation method, choices: fix, iqn, fqf
  use_automatic_entropy_tuning: false

Learning under risk measures is available for DSAC and TD4. We provide 6 choices of risk metrics: neutral, std, VaR, cpw, wang, cvar. You can change the risk preference by add two additional items in your YAML config:

...

trainer_kwargs:
  ...
  risk_type: std
  risk_param: 0.1

dsac's People

Contributors

xtma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dsac's Issues

Why _n_train_steps_total in class DSACTrainer is set to 0?

In rlkit/torch/dsac/dsac.py, the _n_train_steps_total in line 127 is set to 0, which will cause risk_param in line 220 to 0.
Then,
line 237: q1_new_actions -= risk_param * q1_std.sum(dim=1, keepdims=True).sqrt()
line 238: q2_new_actions -= risk_param * q2_std.sum(dim=1, keepdims=True).sqrt()
won't work any more.

Distorted Expectation

Hi, I wonder whether you should sort the action value when you compute the distorted expectation. Since if we consider risk-seeking policy, the larger tau corresponds to a higher weight on action value at tau.

evaluation/env_infos/average/failed Mean = 0.0

Thanks your great work.
I'm facing a problem of getting the information of evaluation/env_infos/average/failed Mean.
I found that the output of evaluation/env_infos/average/failed Mean always equal to 0.0.
It never changed.

evaluation/env_infos/sum/failed Mean          0
evaluation/env_infos/sum/failed Std           0
evaluation/env_infos/sum/failed Max           0
evaluation/env_infos/sum/failed Min           0
evaluation/env_infos/average/failed Mean      0
evaluation/env_infos/average/failed Std       0
evaluation/env_infos/average/failed Max       0
evaluation/env_infos/average/failed Min       0

Can you give some suggestions?

Thanks a lot!

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.