Update README.md
Browse files
README.md
CHANGED
@@ -32,5 +32,26 @@ TODO: Add your code
|
|
32 |
from stable_baselines3 import ...
|
33 |
from huggingface_sb3 import load_from_hub
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
```
|
|
|
32 |
from stable_baselines3 import ...
|
33 |
from huggingface_sb3 import load_from_hub
|
34 |
|
35 |
+
# Create the environment
|
36 |
+
env = make_vec_env("LunarLander-v2", n_envs=16)
|
37 |
+
|
38 |
+
# Defining the model, we use MultiLayerPerceptron (MLPPolicy) because the input is a vector,
|
39 |
+
# if we had frames as input we would use CnnPolicy
|
40 |
+
model = PPO(
|
41 |
+
policy="MlpPolicy",
|
42 |
+
env=env,
|
43 |
+
n_steps=1024,
|
44 |
+
batch_size=64,
|
45 |
+
n_epochs=4,
|
46 |
+
gamma=0.999,
|
47 |
+
gae_lambda=0.98,
|
48 |
+
ent_coef=0.01,
|
49 |
+
verbose=1,
|
50 |
+
)
|
51 |
+
|
52 |
+
# Training the model for 3,000,000 timesteps
|
53 |
+
model.learn(total_timesteps=3000000)
|
54 |
+
# Save the model
|
55 |
+
model_name = "ppo-LunarLander-v2"
|
56 |
+
model.save(model_name)
|
57 |
```
|