Then, you can load the model using the following Python code:
import gymnasium as gym
from sb3_contrib import TQC
from stable_baselines3.common.env_util import make_vec_env
gymnasium.register_envs(gymnasium_robotics)
# Load the trained model
model = TQC.load("best-model.zip")
# Create the environment
env = make_vec_env("FetchPushDense-v4", n_envs=1)
# Reset the environment
obs, info = env.reset()
# Enjoy the trained agentfor _ inrange(1000):
action, _states = model.predict(obs, deterministic=True)
obs, rewards, terminated, truncated, info = env.step(action)
if terminated or truncated:
obs, info = env.reset()
env.render()
env.close()
Hugging Face Hub
You can also use the Hugging Face Hub to load the model. First, you need to install the Hugging Face Hub library:
pip install huggingface_hub
Then, you can load the model from the hub using the following code:
from huggingface_hub import hf_hub_download
import torch as th
from sb3_contrib import TQC
from stable_baselines3.common.env_util import make_vec_env
gymnasium.register_envs(gymnasium_robotics)
# Download the model from the Hub
model_path = hf_hub_download(repo_id="kuds/fetch-push-dense-tqc", filename="best-model.zip")
# Load the model
model = TQC.load(model_path)
# Create the environment
env = make_vec_env("FetchPushDense-v4", n_envs=1)
# Enjoy the trained agent
obs = env.reset()
for i inrange(1000):
action, _states = model.predict(obs, deterministic=True)
obs, rewards, dones, info = env.step(action)
env.render("human")
Runs of kuds fetch-push-dense-tqc on huggingface.co
9
Total runs
0
24-hour runs
1
3-day runs
0
7-day runs
2
30-day runs
More Information About fetch-push-dense-tqc huggingface.co Model
fetch-push-dense-tqc huggingface.co is an AI model on huggingface.co that provides fetch-push-dense-tqc's model effect (), which can be used instantly with this kuds fetch-push-dense-tqc model. huggingface.co supports a free trial of the fetch-push-dense-tqc model, and also provides paid use of the fetch-push-dense-tqc. Support call fetch-push-dense-tqc model through api, including Node.js, Python, http.
fetch-push-dense-tqc huggingface.co is an online trial and call api platform, which integrates fetch-push-dense-tqc's modeling effects, including api services, and provides a free online trial of fetch-push-dense-tqc, you can try fetch-push-dense-tqc online for free by clicking the link below.
kuds fetch-push-dense-tqc online free url in huggingface.co:
fetch-push-dense-tqc is an open source model from GitHub that offers a free installation service, and any user can find fetch-push-dense-tqc on GitHub to install. At the same time, huggingface.co provides the effect of fetch-push-dense-tqc install, users can directly use fetch-push-dense-tqc installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
fetch-push-dense-tqc install url in huggingface.co: