araffin / a2c-LunarLander-v2

huggingface.co
Total runs: 2
24-hour runs: -9
7-day runs: -9
30-day runs: -3
Model's Last Updated: October 11 2022
reinforcement-learning

Introduction of a2c-LunarLander-v2

Model Details of a2c-LunarLander-v2

A2C Agent playing LunarLander-v2

This is a trained model of a A2C agent playing LunarLander-v2 using the stable-baselines3 library .

Usage (with Stable-Baselines3)
from huggingface_sb3 import load_from_hub
from stable_baselines3 import A2C
from stable_baselines3.common.env_util import make_vec_env
from stable_baselines3.common.evaluation import evaluate_policy

# Download checkpoint
checkpoint = load_from_hub("araffin/a2c-LunarLander-v2", "a2c-LunarLander-v2.zip")
# Load the model
model = A2C.load(checkpoint)

env = make_vec_env("LunarLander-v2", n_envs=1)

# Evaluate
print("Evaluating model")
mean_reward, std_reward = evaluate_policy(
    model,
    env,
    n_eval_episodes=20,
    deterministic=True,
)
print(f"Mean reward = {mean_reward:.2f} +/- {std_reward:.2f}")

# Start a new episode
obs = env.reset()

try:
    while True:
        action, _states = model.predict(obs, deterministic=True)
        obs, rewards, dones, info = env.step(action)
        env.render()
except KeyboardInterrupt:
    pass
Training code (with Stable-baselines3)
from stable_baselines3 import A2C
from stable_baselines3.common.env_util import make_vec_env
from stable_baselines3.common.callbacks import EvalCallback

# Create the environment
env_id = "LunarLander-v2"
n_envs = 8
env = make_vec_env(env_id, n_envs=n_envs)

# Create the evaluation envs
eval_envs = make_vec_env(env_id, n_envs=5)

# Adjust evaluation interval depending on the number of envs
eval_freq = int(1e5)
eval_freq = max(eval_freq // n_envs, 1)

# Create evaluation callback to save best model
# and monitor agent performance
eval_callback = EvalCallback(
    eval_envs,
    best_model_save_path="./logs/",
    eval_freq=eval_freq,
    n_eval_episodes=10,
)


# Instantiate the agent
# Hyperparameters from https://github.com/DLR-RM/rl-baselines3-zoo
linear_schedule = lambda progress_remaining: progress_remaining * 0.00083
model = A2C(
    "MlpPolicy",
    env,
    n_steps=5,
    gamma=0.995,
    learning_rate=linear_schedule,
    ent_coef=0.00001,
    verbose=1,
)

# Train the agent (you can kill it before using ctrl+c)
try:
    model.learn(total_timesteps=int(5e5), callback=eval_callback)
except KeyboardInterrupt:
    pass

# Load best model
model = A2C.load("logs/best_model.zip")

Runs of araffin a2c-LunarLander-v2 on huggingface.co

2
Total runs
-9
24-hour runs
-9
3-day runs
-9
7-day runs
-3
30-day runs

More Information About a2c-LunarLander-v2 huggingface.co Model

a2c-LunarLander-v2 huggingface.co

a2c-LunarLander-v2 huggingface.co is an AI model on huggingface.co that provides a2c-LunarLander-v2's model effect (), which can be used instantly with this araffin a2c-LunarLander-v2 model. huggingface.co supports a free trial of the a2c-LunarLander-v2 model, and also provides paid use of the a2c-LunarLander-v2. Support call a2c-LunarLander-v2 model through api, including Node.js, Python, http.

a2c-LunarLander-v2 huggingface.co Url

https://huggingface.co/araffin/a2c-LunarLander-v2

araffin a2c-LunarLander-v2 online free

a2c-LunarLander-v2 huggingface.co is an online trial and call api platform, which integrates a2c-LunarLander-v2's modeling effects, including api services, and provides a free online trial of a2c-LunarLander-v2, you can try a2c-LunarLander-v2 online for free by clicking the link below.

araffin a2c-LunarLander-v2 online free url in huggingface.co:

https://huggingface.co/araffin/a2c-LunarLander-v2

a2c-LunarLander-v2 install

a2c-LunarLander-v2 is an open source model from GitHub that offers a free installation service, and any user can find a2c-LunarLander-v2 on GitHub to install. At the same time, huggingface.co provides the effect of a2c-LunarLander-v2 install, users can directly use a2c-LunarLander-v2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

a2c-LunarLander-v2 install url in huggingface.co:

https://huggingface.co/araffin/a2c-LunarLander-v2

Url of a2c-LunarLander-v2

a2c-LunarLander-v2 huggingface.co Url

Provider of a2c-LunarLander-v2 huggingface.co

araffin
ORGANIZATIONS

Other API from araffin