PPO Agent playing LunarLander-v3

This is a trained model of a PPO (Proximal Policy Optimization) agent playing LunarLander-v3 using the Stable-Baselines3 library.

Project Description

The goal of this project is to train an autonomous agent to land a lunar module safely on a designated landing pad. The agent must control the main, left, and right engines to stabilize its descent, manage fuel efficiency, and ensure a soft landing between the flags.

Technical Details

  • Algorithm: PPO (Proximal Policy Optimization)
  • Policy: MlpPolicy (Multi-Layer Perceptron)
  • Environment: Gymnasium LunarLander-v3
  • Total Timesteps: 200,000

Evaluation Results

The model was evaluated over 10 episodes with the following results:

  • Mean Reward: 82.17
  • Standard Deviation: 101.84

Note: While the agent is showing progress, the high standard deviation suggests it is still refining its landing consistency!

Usage (with Stable-Baselines3)

To use this model locally, ensure you have the necessary libraries installed:

pip install stable-baselines3 huggingface_sb3 gymnasium[box2d]

Then, you can load and run the model with this snippet:

import gymnasium as gym
from stable_baselines3 import PPO
from huggingface_sb3 import load_from_hub

# 1. Load the model from the Hub
repo_id = "PaperCode/ppo-LunarLander-v3"
filename = "PPO_lunarv3.zip"

checkpoint = load_from_hub(repo_id, filename)
model = PPO.load(checkpoint, print_system_info=True)

# 2. Test the agent
env = gym.make("LunarLander-v3", render_mode="human")
obs, info = env.reset()

for _ in range(1000):
    action, _states = model.predict(obs, deterministic=True)
    obs, reward, terminated, truncated, info = env.step(action)
    if terminated or truncated:
        obs, info = env.reset()

env.close()

Training Configuration

model = PPO(
    policy="MlpPolicy",
    env=env,
    verbose=1,
)

Why this is better:

  1. Usage Section: It gives the user a ready-to-use Python script to download and run your specific model.
  2. Visual Structure: Uses emojis and clear headings to make it readable on the Hugging Face UI.
  3. Honest Evaluation: It mentions that the agent is still learning (since a score of 82 isn't a "perfect" 200+ yet), which shows you understand the metrics.
Downloads last month
-
Video Preview
loading

Evaluation results