dassum commited on
Commit
bb9d494
1 Parent(s): 19e5495

updating ReadMe

Browse files
Files changed (1) hide show
  1. README.md +29 -3
README.md CHANGED
@@ -26,12 +26,38 @@ This is a trained model of a **PPO** agent playing **LunarLander-v2**
26
  using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines3).
27
 
28
  ## Usage (with Stable-baselines3)
29
- TODO: Add your code
30
 
31
 
32
  ```python
33
- from stable_baselines3 import ...
34
- from huggingface_sb3 import load_from_hub
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  ...
37
  ```
 
26
  using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines3).
27
 
28
  ## Usage (with Stable-baselines3)
 
29
 
30
 
31
  ```python
32
+ import gym
33
+
34
+ from huggingface_sb3 import load_from_hub, package_to_hub, push_to_hub
35
+ from huggingface_hub import notebook_login # To log to our Hugging Face account to be able to upload models to the Hub.
36
+
37
+ from stable_baselines3 import PPO
38
+ from stable_baselines3.common.evaluation import evaluate_policy
39
+ from stable_baselines3.common.env_util import make_vec_env
40
+
41
+ # Create the environment
42
+ env = make_vec_env('LunarLander-v2', n_envs=16)
43
+
44
+ model = PPO(
45
+ policy = 'MlpPolicy',
46
+ env = env,
47
+ n_steps = 1024,
48
+ batch_size = 64,
49
+ n_epochs = 4,
50
+ gamma = 0.999,
51
+ gae_lambda = 0.98,
52
+ ent_coef = 0.01,
53
+ learning_rate=0.0004,
54
+ verbose=1)
55
+
56
+ # Train it for 3,000,000 timesteps
57
+ model.learn(total_timesteps=3000000)
58
+ # Save the model
59
+ model_name = "ppo-LunarLander-v2"
60
+ model.save(model_name)
61
 
62
  ...
63
  ```