Views
No views yet
PandaReachJointsDense-v3 using the stable-baselines3 library.1import gymnasium as gym
2import panda_gym
3from huggingface_sb3 import load_from_hub
4from stable_baselines3 import A2C
5
6# Download the model from the Hub
7repo_id = "bsarmento/a2c-panda-reach-td1"
8filename = "a2c_panda_reach_model.zip"
9checkpoint = load_from_hub(repo_id, filename)
10
11# Load the model into memory
12model = A2C.load(checkpoint)
13
14# Create the environment in human render mode
15env = gym.make("PandaReachJointsDense-v3", render_mode="human")
16
17# Enjoy the trained agent
18obs, info = env.reset()
19for i in range(1000):
20 action, _states = model.predict(obs, deterministic=True)
21 obs, reward, terminated, truncated, info = env.step(action)
22 if terminated or truncated:
23 obs, info = env.reset()