Reinforcement Learning
stable-baselines3
deep-reinforcement-learning
LunarLander-v2
LunarLander-v3
Eval Results (legacy)
Instructions to use roshana1s/ppo-LunarLander-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use roshana1s/ppo-LunarLander-v3 with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="roshana1s/ppo-LunarLander-v3", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
PPO Agent playing LunarLander-v3
This is a trained model of a PPO agent playing LunarLander-v3 using the stable-baselines3 library.
Usage (with Stable-Baselines3)
Install the required libraries:
pip install stable-baselines3 huggingface-sb3 "gymnasium[box2d]"
Load the trained PPO agent from the Hugging Face Hub:
import os
import gymnasium as gym
from stable_baselines3 import PPO
from stable_baselines3.common.evaluation import evaluate_policy
from huggingface_sb3 import load_from_hub
# Required by huggingface_sb3 when loading the model
# Only enable this for repositories you trust
os.environ["TRUST_REMOTE_CODE"] = "True"
# Download the trained model
checkpoint = load_from_hub(
repo_id="roshana1s/ppo-LunarLander-v3",
filename="ppo-LunarLander-v3.zip",
)
# Load the PPO model
model = PPO.load(checkpoint)
# Create the LunarLander environment
env = gym.make("LunarLander-v3")
# Evaluate the agent
mean_reward, std_reward = evaluate_policy(
model,
env,
n_eval_episodes=10,
deterministic=True
)
print(f"Mean reward: {mean_reward:.2f} +/- {std_reward:.2f}")
env.close()
Run the Agent
env = gym.make("LunarLander-v3", render_mode="human")
obs, info = env.reset()
terminated = False
truncated = False
while not (terminated or truncated):
action, _ = model.predict(obs, deterministic=True)
obs, reward, terminated, truncated, info = env.step(action)
env.close()
- Downloads last month
- 28
Evaluation results
- mean_reward on LunarLander-v3self-reported246.63 +/- 22.23