giansimone commited on
Commit
74b7254
·
verified ·
1 Parent(s): 33361b5

Upload folder using huggingface_hub

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. README.md +75 -0
  3. config.json +1 -0
  4. model.pt +3 -0
  5. replay.mp4 +3 -0
  6. results.json +1 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ replay.mp4 filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - HalfCheetah-v5
4
+ - reinforcement-learning
5
+ - ppo
6
+ - halfcheetah
7
+ - mujoco
8
+ - gymnasium
9
+ - pytorch
10
+ model-index:
11
+ - name: PPO-MuJoCo-HalfCheetah-v5
12
+ results:
13
+ - task:
14
+ type: reinforcement-learning
15
+ name: reinforcement-learning
16
+ dataset:
17
+ name: HalfCheetah-v5
18
+ type: HalfCheetah-v5
19
+ metrics:
20
+ - type: mean_reward
21
+ value: 1244.04 +/- 36.99
22
+ name: mean_reward
23
+ verified: false
24
+ ---
25
+
26
+ # Proximal Policy Optimization (PPO) Agent playing HalfCheetah-v5
27
+
28
+ This is a trained Proximal Policy Optimization (PPO) agent for the MuJoCo HalfCheetah-v5 environment.
29
+
30
+ ## Model Details
31
+
32
+ The model was trained using the code available [here](https://github.com/giansimone/ppo-mujoco-halfcheetah/).
33
+
34
+ ## Usage
35
+ To load and use this model for inference:
36
+
37
+ ```python
38
+ import torch
39
+ import json
40
+ import gymnasium as gym
41
+
42
+ from agent import SimpleAgent
43
+ from environment import make_env
44
+
45
+ #Load the configuration
46
+ with open("config.json", "r") as f:
47
+ config = json.load(f)
48
+
49
+ env_id = config["env_id"]
50
+ hidden_dim = config["hidden_dim"]
51
+
52
+ # Create environment. Get action and space dimensions
53
+ env, state_size, action_size = make_env(
54
+ env_id,
55
+ render_mode="human",
56
+ )
57
+
58
+ # Instantiate the agent and load the trained policy network
59
+ agent = SimpleAgent(state_size, action_size, hidden_dim)
60
+ agent.policy.load_state_dict(torch.load("model.pt"))
61
+
62
+ # Enjoy the agent!
63
+ state, _ = env.reset()
64
+ done = False
65
+
66
+ while not done:
67
+ action = agent.select_action(state, deterministic=True)
68
+ state, reward, terminated, truncated, _ = env.step(action)
69
+
70
+ done = terminated or truncated
71
+
72
+ env.render()
73
+
74
+ env.close()
75
+ ```
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"env_id": "HalfCheetah-v5", "num_envs": 8, "hidden_dim": 256, "total_timesteps": 1000000, "n_steps": 1024, "batch_size": 64, "learning_rate": 0.0003, "gamma": 0.99, "gae_lambda": 0.95, "clip_epsilon": 0.2, "value_coef": 0.5, "entropy_coef": 0.01, "max_grad_norm": 0.5, "ppo_epochs": 10, "log_dir": "runs/", "seed": 42}
model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a624ceabc3f753c2fa13d3fd139c10619c6e6dc9b5a39e07a85a112fb03e4d8
3
+ size 298661
replay.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a50239636139bd0bece27cf5edc0a953532f46611fdca931443c501cf839a0a
3
+ size 1784791
results.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"env_id": "HalfCheetah-v5", "mean_reward": 1244.0386862126802, "n_eval_episodes": 10, "eval_datetime": "2025-11-10T18:00:50.269012"}