Reinforcement Learning
stable-baselines3
deep-reinforcement-learning
sb3-contrib
mujoco
Hopper-v4
weight-editing
Eval Results (legacy)
Instructions to use erickvs/tqc-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/tqc-Hopper-v4-hand-edited with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="erickvs/tqc-Hopper-v4-hand-edited", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
Download example.py from erickvs/tqc-Hopper-v4-hand-edited: direct link, hf CLI and curl.
- Browser
- Download file 903 Bytes
-
https://huggingface.co/erickvs/tqc-Hopper-v4-hand-edited/resolve/main/example.py
- Command line
-
hf download hf://erickvs/tqc-Hopper-v4-hand-edited/example.py
-
curl -L -o example.py https://huggingface.co/erickvs/tqc-Hopper-v4-hand-edited/resolve/main/example.py
903 Bytes
| """Score the hand-edited TQC hopper on Hopper-v4. | |
| pip install "stable-baselines3>=2.9" "sb3-contrib>=2.9" "gymnasium[mujoco]>=1.0" | |
| python example.py tqc-Hopper-v4-hand-edited.zip 0 100 | |
| """ | |
| import sys | |
| import numpy as np | |
| import gymnasium as gym | |
| from sb3_contrib import TQC | |
| path, first, n = sys.argv[1], int(sys.argv[2]), int(sys.argv[3]) | |
| model = TQC.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}%)") | |