from huggingface_sb3 import load_from_hub
from sb3_contrib import TQC
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/tqc-BipedalWalker-v3", "tqc-BipedalWalker-v3.zip")
# Load the model
model = TQC.load(checkpoint)
env = make_vec_env("BipedalWalker-v3", n_envs=1)
# Evaluateprint("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:
whileTrue:
action, _states = model.predict(obs, deterministic=True)
obs, rewards, dones, info = env.step(action)
env.render()
except KeyboardInterrupt:
pass
Training code (with SB3)
from sb3_contrib import TQC
from stable_baselines3.common.env_util import make_vec_env
from stable_baselines3.common.callbacks import EvalCallback
# Create the environment
env_id = "BipedalWalker-v3"
n_envs = 2
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
model = TQC(
"MlpPolicy",
env,
learning_starts=10000,
batch_size=256,
buffer_size=300000,
learning_rate=7.3e-4,
# gSDE is from https://proceedings.mlr.press/v164/raffin22a.html
use_sde=True,
train_freq=8,
gradient_steps=8,
gamma=0.98,
tau=0.02,
policy_kwargs=dict(log_std_init=-3, net_arch=[400, 300]),
verbose=1,
)
# Train the agent (you can kill it before using ctrl+c)try:
model.learn(total_timesteps=int(5e5), callback=eval_callback, log_interval=10)
except KeyboardInterrupt:
pass
Runs of araffin tqc-BipedalWalker-v3 on huggingface.co
7
Total runs
0
24-hour runs
-9
3-day runs
-11
7-day runs
-18
30-day runs
More Information About tqc-BipedalWalker-v3 huggingface.co Model
tqc-BipedalWalker-v3 huggingface.co
tqc-BipedalWalker-v3 huggingface.co is an AI model on huggingface.co that provides tqc-BipedalWalker-v3's model effect (), which can be used instantly with this araffin tqc-BipedalWalker-v3 model. huggingface.co supports a free trial of the tqc-BipedalWalker-v3 model, and also provides paid use of the tqc-BipedalWalker-v3. Support call tqc-BipedalWalker-v3 model through api, including Node.js, Python, http.
tqc-BipedalWalker-v3 huggingface.co is an online trial and call api platform, which integrates tqc-BipedalWalker-v3's modeling effects, including api services, and provides a free online trial of tqc-BipedalWalker-v3, you can try tqc-BipedalWalker-v3 online for free by clicking the link below.
araffin tqc-BipedalWalker-v3 online free url in huggingface.co:
tqc-BipedalWalker-v3 is an open source model from GitHub that offers a free installation service, and any user can find tqc-BipedalWalker-v3 on GitHub to install. At the same time, huggingface.co provides the effect of tqc-BipedalWalker-v3 install, users can directly use tqc-BipedalWalker-v3 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
tqc-BipedalWalker-v3 install url in huggingface.co: