panda-gym: Open-source goal-conditioned environments for robotic learning
Paper • 2106.13687 • Published • 3
How to use arjun80892/a2c-PandaReachDense-v3 with stable-baselines3:
from huggingface_sb3 import load_from_hub
checkpoint = load_from_hub(
repo_id="arjun80892/a2c-PandaReachDense-v3",
filename="{MODEL FILENAME}.zip",
)This is a trained model of an A2C (Advantage Actor-Critic) agent playing PandaReachDense-v3 using the stable-baselines3 and panda-gym libraries.
PandaReachDense-v3-0.21910.1138-0.22 +/- 0.11-0.3329>= -3.5The video below shows the robotic arm successfully reaching the target coordinates:
import gymnasium as gym
import panda_gym
from stable_baselines3 import A2C
from stable_baselines3.common.vec_env import DummyVecEnv, VecNormalize
from huggingface_sb3 import load_from_hub
# 1. Download and load the trained model & normalization stats
checkpoint = load_from_hub(
repo_id="arjun80892/a2c-PandaReachDense-v3",
filename="a2c-PandaReachDense-v3.zip",
)
vec_norm_path = load_from_hub(
repo_id="arjun80892/a2c-PandaReachDense-v3",
filename="vec_normalize.pkl",
)
# 2. Re-create the environment with VecNormalize stats
eval_env = DummyVecEnv([lambda: gym.make("PandaReachDense-v3")])
eval_env = VecNormalize.load(vec_norm_path, eval_env)
eval_env.training = False
eval_env.norm_reward = False
model = A2C.load(checkpoint)
# 3. Run inference
obs = eval_env.reset()
for _ in range(1000):
action, _states = model.predict(obs, deterministic=True)
obs, rewards, dones, info = eval_env.step(action)
eval_env.render()
Panda Gym reference: arxiv.org/abs/2106.13687