lerobot/examples/pretrained.ipynb

66 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-03-17 00:36:13 +08:00
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"from IPython.display import Video\n",
"\n",
"from examples.notebook_utils import config_notebook\n",
"from lerobot.scripts.eval import eval\n",
"\n",
2024-03-20 22:52:34 +08:00
"# Select policy and env\n",
"POLICY = \"act\" # \"tdmpc\" | \"diffusion\"\n",
"ENV = \"aloha\" # \"pusht\" | \"simxarm\"\n",
"\n",
"# Select device\n",
"DEVICE = \"mps\" # \"cpu\" | \"cuda\"\n",
"\n",
"# Generated videos will be written here\n",
2024-03-17 00:36:13 +08:00
"OUT_DIR = Path(\"./outputs\")\n",
2024-03-20 22:52:34 +08:00
"OUT_EXAMPLE = OUT_DIR / \"eval\" / \"eval_episode_0.mp4\"\n",
2024-03-17 00:36:13 +08:00
"\n",
2024-03-20 22:52:34 +08:00
"# Setup config\n",
"cfg = config_notebook(policy=POLICY, env=ENV, device=DEVICE, print_config=False)\n",
"print(cfg.env.episode_length)\n",
"print(cfg.n_action_steps)"
2024-03-17 00:36:13 +08:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"eval(cfg, out_dir=OUT_DIR)\n",
2024-03-20 22:52:34 +08:00
"Video(OUT_EXAMPLE, embed=True)"
2024-03-17 00:36:13 +08:00
]
}
],
"metadata": {
"kernelspec": {
"display_name": "lerobot",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
}