Reinforcement Learning
stable-baselines3
deep-reinforcement-learning
mujoco
Hopper-v4
weight-editing
Eval Results (legacy)
Instructions to use erickvs/sac-Hopper-v4-hand-edited with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use erickvs/sac-Hopper-v4-hand-edited with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="erickvs/sac-Hopper-v4-hand-edited", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
File size: 890 Bytes
56ff781 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | """Score the hand-edited SAC hopper on Hopper-v4.
pip install "stable-baselines3>=2.9" "gymnasium[mujoco]>=1.0"
python example.py sac-Hopper-v4-hand-edited.zip 0 100
"""
import sys
import numpy as np
import gymnasium as gym
from stable_baselines3 import SAC
path, first, n = sys.argv[1], int(sys.argv[2]), int(sys.argv[3])
model = SAC.load(path, device="cpu")
env = gym.make("Hopper-v4")
returns, falls = [], 0
for seed in range(first, first + n):
obs, _ = env.reset(seed=seed)
total = 0.0
for _ in range(1000):
action, _ = model.predict(obs, deterministic=True)
obs, reward, terminated, truncated, _ = env.step(action)
total += reward
if terminated or truncated:
break
returns.append(total)
falls += int(terminated)
print(f"{n} episodes: mean return {np.mean(returns):.1f}, falls {falls} ({100 * falls / n:.1f}%)")
|