Downloads · 30 days
9
10% of all-time downloads
kinkpunk/Lunar-Landing-Program
Lunar-Landing-Program is a reinforcement learning model from kinkpunk. 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 model of a PPO agent playing LunarLander-v2 using the stable-baselines3 library.
Downloads · 30 days
9
10% of all-time downloads
All-time downloads
93
Public
Repo size
282 KB
Likes
0
Public
Click a slice to open those files.
.mp4218 KB · 40%
From the Hugging Face model README
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 import PPO
from stable_baselines3.common.evaluation import evaluate_policy
from stable_baselines3.common.env_util import make_vec_env
repo_id = "kinkpunk/Lunar-Landing-Program"
filename = "LunarProgram-PPO.zip"
custom_objects = {
"learning_rate": 0.0,
"lr_schedule": lambda _: 0.0,
"clip_range": lambda _: 0.0,
}
checkpoint = load_from_hub(repo_id, filename)
model = PPO.load(checkpoint,
custom_objects=custom_objects,
print_system_info=True)
env = make_vec_env('LunarLander-v2', n_envs=1)
# Evaluate the model
mean_reward, std_reward = evaluate_policy(model, env,
n_eval_episodes=10,
deterministic=True)
# Print the results
print('mean_reward={:.2f} +/- {:.2f}'.format(mean_reward, std_reward))
from huggingface_sb3 import load_from_hub
from stable_baselines3 import PPO
from stable_baselines3.common.evaluation import evaluate_policy
from stable_baselines3.common.env_util import make_vec_env
# Create the evaluation envs
env = make_vec_env('LunarLander-v2', n_envs=16)
env = gym.make('LunarLander-v2')
# Instantiate the agent
model = PPO(
policy = 'MlpPolicy',
env = env,
n_steps = 1024,
batch_size = 32,
n_epochs = 8,
gamma = 0.99,
gae_lambda = 0.95,
ent_coef = 0.01,
verbose=1,
seed=2022)
# Train
model.learn(total_timesteps=1500000)
# Save model
model_name = "Any-Name"
model.save(model_name)