Deep Reinforcement Learning
Collection
Models created as part of the Deep Reinforcement Learning Course by Hugging Face.
•
10 items
•
Updated
This is a trained model of a PPO agent playing LunarLander-v2 using the stable-baselines3 library.
from huggingface_sb3 import load_from_hub
from stable_baselines3.common.env_util import make_vec_env
from stable_baselines3 import PPO
from stable_baselines3.common.evaluation import evaluate_policy
model_checkpoint = load_from_hub( # Download model from the hub
repo_id="mriusero/ppo-LunarLander-v2",
filename="ppo-LunarLander-v2.zip",
)
env = make_vec_env("LunarLander-v2", n_envs=1) # Create a vectorized environment
model = PPO.load(model_checkpoint, env=env) # Load the model
print("Evaluating model") # Evaluate the model
mean_reward, std_reward = evaluate_policy(
model,
env,
n_eval_episodes=10,
deterministic=True,
)
print(f"Mean reward = {mean_reward:.2f} +/- {std_reward}")