Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAC-discrete implementation #270

Merged
merged 42 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
18b643b
add draft of SAC discrete implementation
timoklein Aug 29, 2022
c3c98bd
run pre-commit
timoklein Aug 29, 2022
ec31dc4
Use log softmax instead of author's log-pi code
timoklein Aug 31, 2022
deb37e8
Revert to cleanrl SAC delay implementation (it's more stable)
timoklein Aug 31, 2022
a1fdd2b
Remove docstrings and duplicate code
timoklein Aug 31, 2022
977a83a
Use correct clipreward wrapper
timoklein Aug 31, 2022
f2ea3e6
fix bug in log softmax calculation
timoklein Sep 6, 2022
48af04c
adhere to cleanrl log_prob naming
timoklein Sep 6, 2022
b2a09a0
fix bug in entropy target calculation
timoklein Sep 6, 2022
89680c7
change layer initialization to match existing cleanrl codebase
timoklein Sep 6, 2022
b1d7d44
working minimal diff version
timoklein Sep 19, 2022
61e1c74
implement original learning update frequency
timoklein Sep 20, 2022
7cd1e3a
parameterize the entropy scale for autotuning
timoklein Oct 3, 2022
61c46fc
add benchmarking script
timoklein Oct 3, 2022
4915e4c
rename target entropy factor and set new default value
timoklein Oct 6, 2022
6f7251f
add docs draft
timoklein Nov 5, 2022
23b60ff
fix SAC-discrete links to work pre merge
timoklein Nov 10, 2022
10ee9f0
add preliminary result table for SAC-discrete
timoklein Nov 10, 2022
8430fd8
clean up todos and add header
timoklein Nov 10, 2022
a17768c
minimize diff between sac_atari and sac_continuous
timoklein Nov 11, 2022
d6a507c
add sac-discrete end2end test
timoklein Nov 11, 2022
a7ea6f4
SAC-discrete docs rework
timoklein Nov 11, 2022
9f6493c
Update SAC-discrete @100k results
timoklein Nov 12, 2022
59a6d00
Fix doc links and unify naming in code
timoklein Nov 12, 2022
1304b7a
update docs
vwxyzjn Nov 13, 2022
3a3f41b
fix target update frequency (see PR #323)
timoklein Nov 24, 2022
80187ad
clarify comment regarding CNN encoder sharing
timoklein Nov 24, 2022
e9cb494
Merge remote-tracking branch 'upstream/master' into sac-discrete
timoklein Nov 25, 2022
e199e39
fix benchmark installation
timoklein Nov 25, 2022
bb27fa1
fix eps in minimal diff version and improve code readability
timoklein Dec 3, 2022
6a46632
add docs for eps and finalize code
timoklein Dec 5, 2022
cad5fff
use no_grad for actor Q-vals and re-use action-probs & log-probs in a…
timoklein Dec 7, 2022
0cf47f1
update docs for new code and settings
timoklein Dec 14, 2022
61988c4
fix links to point to main branch
timoklein Dec 14, 2022
6e17005
update sac-discrete training plots
timoklein Dec 19, 2022
33b00f3
new sac-d training plots
timoklein Dec 19, 2022
5dabafb
update results table and fix link
timoklein Dec 19, 2022
90b2fd5
fix pong chart title
timoklein Dec 19, 2022
a763994
add Jimmy Ba name as exception to code spell check
timoklein Jan 13, 2023
071cdbb
change target_entropy_scale default value to same value as experiments
timoklein Jan 13, 2023
dcc2633
Merge remote-tracking branch 'upstream/master' into sac-discrete
timoklein Jan 13, 2023
c671a92
remove blank line at end of pre-commit
timoklein Jan 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ poetry install -E atari
python cleanrl/dqn_atari.py --env-id BreakoutNoFrameskip-v4
python cleanrl/c51_atari.py --env-id BreakoutNoFrameskip-v4
python cleanrl/ppo_atari.py --env-id BreakoutNoFrameskip-v4
python cleanrl/sac_atari.py --env-id BreakoutNoFrameskip-v4

# NEW: 3-4x side-effects free speed up with envpool's atari (only available to linux)
poetry install -E envpool
Expand Down Expand Up @@ -114,21 +115,22 @@ You may also use a prebuilt development environment hosted in Gitpod:
| Algorithm | Variants Implemented |
| ----------- | ----------- |
| ✅ [Proximal Policy Gradient (PPO)](https://arxiv.org/pdf/1707.06347.pdf) | [`ppo.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppopy) |
| | [`ppo_atari.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_ataripy)
| | [`ppo_continuous_action.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_continuous_action.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_continuous_actionpy)
| | [`ppo_atari_lstm.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari_lstm.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_atari_lstmpy)
| | [`ppo_atari_envpool.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari_envpool.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_atari_envpoolpy)
| | [`ppo_procgen.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_procgen.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_procgenpy)
| | [`ppo_atari_multigpu.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari_multigpu.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_atari_multigpupy)
| | [`ppo_atari.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_ataripy)
| | [`ppo_continuous_action.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_continuous_action.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_continuous_actionpy)
| | [`ppo_atari_lstm.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari_lstm.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_atari_lstmpy)
| | [`ppo_atari_envpool.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari_envpool.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_atari_envpoolpy)
| | [`ppo_procgen.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_procgen.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_procgenpy)
| | [`ppo_atari_multigpu.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari_multigpu.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_atari_multigpupy)
| | [`ppo_pettingzoo_ma_atari.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_pettingzoo_ma_atari.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_pettingzoo_ma_ataripy)
| | [`ppo_continuous_action_isaacgym.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_continuous_action_isaacgym/ppo_continuous_action_isaacgym.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_continuous_action_isaacgympy)
| ✅ [Deep Q-Learning (DQN)](https://web.stanford.edu/class/psych209/Readings/MnihEtAlHassibis15NatureControlDeepRL.pdf) | [`dqn.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/dqn.py), [docs](https://docs.cleanrl.dev/rl-algorithms/dqn/#dqnpy) |
| | [`dqn_atari.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/dqn_atari.py), [docs](https://docs.cleanrl.dev/rl-algorithms/dqn/#dqn_ataripy) |
| | [`dqn_atari.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/dqn_atari.py), [docs](https://docs.cleanrl.dev/rl-algorithms/dqn/#dqn_ataripy) |
| | [`dqn_jax.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/dqn_jax.py), [docs](https://docs.cleanrl.dev/rl-algorithms/dqn/#dqn_jaxpy) |
| | [`dqn_atari_jax.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/dqn_atari_jax.py), [docs](https://docs.cleanrl.dev/rl-algorithms/dqn/#dqn_atari_jaxpy) |
| ✅ [Categorical DQN (C51)](https://arxiv.org/pdf/1707.06887.pdf) | [`c51.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/c51.py), [docs](https://docs.cleanrl.dev/rl-algorithms/c51/#c51py) |
| | [`c51_atari.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/c51_atari.py), [docs](https://docs.cleanrl.dev/rl-algorithms/c51/#c51_ataripy) |
| ✅ [Soft Actor-Critic (SAC)](https://arxiv.org/pdf/1812.05905.pdf) | [`sac_continuous_action.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/sac_continuous_action.py), [docs](https://docs.cleanrl.dev/rl-algorithms/sac/#sac_continuous_actionpy) |
| | [`sac_atari.py`](https://github.com/timoklein/cleanrl/blob/sac-discrete/cleanrl/sac_atari.py), [docs](https://docs.cleanrl.dev/rl-algorithms/sac/#sac_atarinpy) |
| ✅ [Deep Deterministic Policy Gradient (DDPG)](https://arxiv.org/pdf/1509.02971.pdf) | [`ddpg_continuous_action.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ddpg_continuous_action.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ddpg/#ddpg_continuous_actionpy) |
| | [`ddpg_continuous_action_jax.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ddpg_continuous_action_jax.py), [docs](https://docs.cleanrl.dev/rl-algorithms/ddpg/#ddpg_continuous_action_jaxpy)
| ✅ [Twin Delayed Deep Deterministic Policy Gradient (TD3)](https://arxiv.org/pdf/1802.09477.pdf) | [`td3_continuous_action.py`](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/td3_continuous_action.py), [docs](https://docs.cleanrl.dev/rl-algorithms/td3/#td3_continuous_actionpy) |
Expand Down
6 changes: 6 additions & 0 deletions benchmark/sac_atari.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
poetry install -E atari
OMP_NUM_THREADS=1 python -m cleanrl_utils.benchmark \
--env-ids PongNoFrameskip-v4 BreakoutNoFrameskip-v4 BeamRiderNoFrameskip-v4 \
--command "poetry run python cleanrl/sac_atari.py --cuda True --track" \
--num-seeds 3 \
--workers 2
Loading