Add Policy Gradient to Reinforcement Learning examples (#1500)

* added policy_gradient, modified main, ddpg and README

* fixed typo in README

* removed unnecessary imports

* small refactor

* Use clap for picking up the subcommand to run.

---------

Co-authored-by: Laurent <laurent.mazare@gmail.com>
This commit is contained in:
s-casci
2023-12-30 09:01:29 +01:00
committed by GitHub
parent 0a245e6fa4
commit 51e577a682
4 changed files with 275 additions and 124 deletions

View File

@ -8,9 +8,16 @@ Python package with:
pip install "gymnasium[accept-rom-license]"
```
In order to run the example, use the following command. Note the additional
In order to run the examples, use the following commands. Note the additional
`--package` flag to ensure that there is no conflict with the `candle-pyo3`
crate.
For the Policy Gradient example:
```bash
cargo run --example reinforcement-learning --features=pyo3 --package candle-examples
cargo run --example reinforcement-learning --features=pyo3 --package candle-examples -- pg
```
For the Deep Deterministic Policy Gradient example:
```bash
cargo run --example reinforcement-learning --features=pyo3 --package candle-examples -- ddpg
```