Skip to content

Commit 5b96f77

Browse files
committed
Update the readme with usage information
1 parent 98fc96a commit 5b96f77

1 file changed

Lines changed: 49 additions & 6 deletions

File tree

README.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,56 @@ Paired with environments that support JIT, high performance is possible using th
77

88
I'm working on this in my free time, so it may take a while to get to a usable state. I'm also mainly developing this for personal research, so it may not be suitable for all use cases.
99

10-
## Code Style
11-
12-
This code is written to follow the [Equinox's abstract/final pattern](https://docs.kidger.site/equinox/pattern/) for code structure and [Black formatting](https://black.readthedocs.io/en/stable/index.html#).
13-
This is intended to make the code more readable and maintainable, and to ensure that it is consistent with the Equinox library.
14-
If you want to contribute, please follow these conventions.
15-
1610
## Credit
1711

1812
A ton of the code is a slight translation of the code found in the [Stable Baselines 3](https://github.com/DLR-RM/stable-baselines3) and [Gymnasium](https://github.com/Farama-Foundation/Gymnasium) libraries which are both under the MIT license.
1913
The developers of these excellent libraries have done a great job of creating a solid foundation for reinforcement learning in Python, and I have learned a lot from their code.
2014

2115
In addition, the NDE code is heavily inspired by the work of [Patrick Kidger](https://kidger.site/publications/) and the entire library is based on his excellent [Equinox library](https://github.com/patrick-kidger/equinox) along with some use of [Diffrax](https://github.com/patrick-kidger/diffrax) and [jaxtyping](https://github.com/patrick-kidger/jaxtyping).
2216

17+
## Usage
18+
19+
### Installation
20+
21+
Install via pip:
22+
23+
```bash
24+
pip install lerax@git+https://github.com/RunnersNum40/lerax.git
25+
```
26+
27+
Or clone the repo and install in editable mode:
28+
29+
```bash
30+
git clone https://github.com/RunnersNum40/lerax.git
31+
```
32+
```bash
33+
cd lerax
34+
```
35+
```bash
36+
pip install -e .
37+
```
38+
39+
### Running an example
40+
41+
```bash
42+
python examples/ppo.py
43+
```
44+
45+
### Running TensorBoard
46+
47+
```bash
48+
tensorboard --logdir runs
49+
```
50+
51+
Then open your browser to `http://localhost:6006`.
52+
53+
### Creating your own models and environments
54+
55+
Check out the [MLP Actor Critic](lerax/policy/mlp_actor_critic.py) for a simple example of how to create your own actor critic model.
56+
Check out the [PPO example](examples/ppo.py) for how to use your model in training.
57+
Check out the [CartPole environment](lerax/env/cartpole.py) for how to create your own environment.
58+
Check out the [Gymnasium wrapper](lerax/compatibility/gym.py) for how to wrap Gymnasium environments (this will be slower to run than a fully Jax environment).
59+
2360
## TODO
2461

2562
- Expand support beyond Box and Discrete spaces
@@ -44,3 +81,9 @@ In addition, the NDE code is heavily inspired by the work of [Patrick Kidger](ht
4481
- Rendering support
4582
- Expand RL variants to include more algorithms
4683
- Create a more comprehensive set of environments
84+
85+
## Code Style
86+
87+
This code is written to follow the [Equinox's abstract/final pattern](https://docs.kidger.site/equinox/pattern/) for code structure and [Black formatting](https://black.readthedocs.io/en/stable/index.html#).
88+
This is intended to make the code more readable and maintainable, and to ensure that it is consistent with the Equinox library.
89+
If you want to contribute, please follow these conventions.

0 commit comments

Comments
 (0)