Downloads · 30 days
1
1% of all-time downloads
Vishand03/lunarlander-ppo
lunarlander-ppo is a reinforcement learning model from Vishand03. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. It is set up for stable-baselines3.
This is a trained PPO agent for the LunarLander-v2 environment using Stable-Baselines3.
Downloads · 30 days
1
1% of all-time downloads
All-time downloads
90
Public
Repo size
452 KB
Likes
0
Public
Click a slice to open those files.
.gif278 KB · 59%
From the Hugging Face model README
This is a trained PPO agent for the LunarLander-v2 environment using Stable-Baselines3.
Vishand S (@Vishand03)

import gymnasium as gym
from stable_baselines3 import PPO
from stable_baselines3.common.monitor import Monitor
from stable_baselines3.common.evaluation import evaluate_policy
from huggingface_hub import hf_hub_download
# -------------------------
# Environment Setup
# -------------------------
env = gym.make("LunarLander-v2", render_mode="human") # Human render
eval_env = Monitor(gym.make("LunarLander-v2")) # Evaluation (no render)
# -------------------------
# Load pretrained model
# -------------------------
model_path = hf_hub_download("Vishand03/lunarlander-ppo", "model.zip")
model = PPO.load(model_path)
# -------------------------
# Run one episode
# -------------------------
obs, _ = env.reset()
done = False
while not done:
action, _ = model.predict(obs, deterministic=True)
obs, reward, terminated, truncated, _ = env.step(action)
done = terminated or truncated
# -------------------------
# Evaluate policy
# -------------------------
mean_reward, std_reward = evaluate_policy(model, eval_env, n_eval_episodes=10, deterministic=True)
print(f"Mean Reward: {mean_reward:.2f} +/- {std_reward:.2f}")