Update README.md with virtual environment installation requirements
Browse files
README.md
CHANGED
@@ -23,10 +23,38 @@ model-index:
|
|
23 |
|
24 |
# **PPO** Agent playing **LunarLander-v2**
|
25 |
This is a trained model of a **PPO** agent playing **LunarLander-v2**
|
26 |
-
using the [
|
27 |
|
28 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
```python
|
31 |
import gymnasium as gym
|
32 |
import torch
|
@@ -68,4 +96,4 @@ print("Video saved as 'lunar_lander.mp4'. Open it to watch!")
|
|
68 |
|
69 |
|
70 |
...
|
71 |
-
```
|
|
|
23 |
|
24 |
# **PPO** Agent playing **LunarLander-v2**
|
25 |
This is a trained model of a **PPO** agent playing **LunarLander-v2**
|
26 |
+
using the [Stable-Baselines3](https://github.com/DLR-RM/stable-baselines3) library.
|
27 |
|
28 |
+
## Installation
|
29 |
+
Before running the model, follow these steps to set up a **virtual environment**, install dependencies, and run the model.
|
30 |
+
|
31 |
+
### 1️⃣ Create and activate a virtual environment
|
32 |
+
|
33 |
+
```bash
|
34 |
+
# Create a virtual environment named "py_env_lunar_lander"
|
35 |
+
python3 -m venv py_env_lunar_lander
|
36 |
+
|
37 |
+
# Activate the virtual environment
|
38 |
+
# On macOS/Linux:
|
39 |
+
source py_env_lunar_lander/bin/activate
|
40 |
+
```
|
41 |
|
42 |
+
### 2️⃣ Install dependencies
|
43 |
+
```bash
|
44 |
+
# Update package list and install system dependencies
|
45 |
+
sudo apt-get update
|
46 |
+
sudo apt-get install -y python3-opengl swig
|
47 |
+
apt install ffmpeg
|
48 |
+
apt install xvfb
|
49 |
+
|
50 |
+
# Install required Python packages
|
51 |
+
pip install --upgrade pip
|
52 |
+
pip install pyvirtualdisplay imageio huggingface_sb3 torch
|
53 |
+
pip install stable-baselines3==2.0.0a5 gymnasium[box2d]
|
54 |
+
```
|
55 |
+
|
56 |
+
## Usage (with Stable-baselines3)
|
57 |
+
After installing dependencies, run the following script to load the trained model, run an episode, and generate a video.
|
58 |
```python
|
59 |
import gymnasium as gym
|
60 |
import torch
|
|
|
96 |
|
97 |
|
98 |
...
|
99 |
+
```
|