Reinforcement Learning
stable-baselines3
Safetensors
halfcheetah
mujoco
sb3
sac
control
Eval Results (legacy)
Instructions to use lucasschott/HalfCheetah-v5-SAC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use lucasschott/HalfCheetah-v5-SAC with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="lucasschott/HalfCheetah-v5-SAC", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -30,6 +30,20 @@ This is a Soft Actor Critic (SAC) agent trained on the `HalfCheetah-v5` environm
|
|
| 30 |
|
| 31 |
See `config.json` for details.
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
## How to Load
|
| 34 |
|
| 35 |
```python
|
|
|
|
| 30 |
|
| 31 |
See `config.json` for details.
|
| 32 |
|
| 33 |
+
|
| 34 |
+
## Requirements
|
| 35 |
+
|
| 36 |
+
- **Python:** 3.10
|
| 37 |
+
|
| 38 |
+
### Dependencies
|
| 39 |
+
|
| 40 |
+
```txt
|
| 41 |
+
gymnasium==1.0.0
|
| 42 |
+
gymnasium[mujoco]
|
| 43 |
+
torch==2.4.0
|
| 44 |
+
stable_baselines3==2.4.1
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
## How to Load
|
| 48 |
|
| 49 |
```python
|
record.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gymnasium as gym
|
| 2 |
+
from stable_baselines3 import SAC
|
| 3 |
+
import imageio
|
| 4 |
+
|
| 5 |
+
if __name__ == "__main__":
|
| 6 |
+
|
| 7 |
+
env = gym.make("HalfCheetah-v5", render_mode="rgb_array")
|
| 8 |
+
|
| 9 |
+
agent = SAC.load("model.zip")
|
| 10 |
+
|
| 11 |
+
frames = []
|
| 12 |
+
|
| 13 |
+
obs, _ = env.reset()
|
| 14 |
+
for _ in range(1000):
|
| 15 |
+
action, _ = agent.predict(obs)
|
| 16 |
+
obs, _, done, _, _ = env.step(action)
|
| 17 |
+
frame = env.render()
|
| 18 |
+
frames.append(frame)
|
| 19 |
+
if done:
|
| 20 |
+
break
|
| 21 |
+
|
| 22 |
+
env.close()
|
| 23 |
+
|
| 24 |
+
# Save as video
|
| 25 |
+
imageio.mimsave("replay.mp4", frames, fps=30)
|