Instructions to use AlexWortega/tinyvla with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LeRobot
How to use AlexWortega/tinyvla with LeRobot:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Upload tinyvla2/scripts/eval_robocasa_all.py with huggingface_hub
Browse files
tinyvla2/scripts/eval_robocasa_all.py
CHANGED
|
@@ -14,10 +14,12 @@ from lerobot.datasets.lerobot_dataset import LeRobotDataset, LeRobotDatasetMetad
|
|
| 14 |
from transformers import AutoTokenizer
|
| 15 |
|
| 16 |
from tinyvla.data.canonical import CanonicalChunkStore, quantile_normalize
|
|
|
|
| 17 |
from tinyvla.modeling_tinyvla import TinyVLAPolicy
|
| 18 |
from tinyvla.modules.embodiment import MORPH_FIELDS
|
| 19 |
|
| 20 |
-
|
|
|
|
| 21 |
_SC = {"arm_dof": 0.1, "reach_m": 2, "gripper_width_m": 10, "num_cameras": 1 / 3,
|
| 22 |
"control_hz": 1 / 30, "joint_lo_mean": 1 / 3.1416, "joint_hi_mean": 1 / 3.1416,
|
| 23 |
"workspace_x": 2, "workspace_y": 2, "workspace_z": 2, "payload_kg": 0.2}
|
|
@@ -52,6 +54,7 @@ def main():
|
|
| 52 |
ds = LeRobotDataset(name, root=root,
|
| 53 |
delta_timestamps={"action": [t / m.fps for t in range(50)]},
|
| 54 |
video_backend="torchcodec")
|
|
|
|
| 55 |
store = CanonicalChunkStore(name, src_fps=m.fps, chunk=50)
|
| 56 |
st = store.compute_stats()
|
| 57 |
q01, q99 = np.asarray(st["q01"]), np.asarray(st["q99"])
|
|
@@ -72,9 +75,7 @@ def main():
|
|
| 72 |
t = tok([item.get("task") or ""], padding=True, truncation=True,
|
| 73 |
max_length=48, return_tensors="pt")
|
| 74 |
img = torch.nn.functional.interpolate(item[prim][None], size=(256, 256), mode="bilinear")[0]
|
| 75 |
-
|
| 76 |
-
stt = torch.nn.functional.pad(sd[: min(len(sd), cfg.max_state_dim)],
|
| 77 |
-
(0, max(0, cfg.max_state_dim - len(sd))))
|
| 78 |
b = {"observation.images.cam0": img[None].cuda(),
|
| 79 |
"observation.images.cam1": torch.zeros_like(img)[None].cuda(),
|
| 80 |
"observation.state": stt[None].cuda(),
|
|
|
|
| 14 |
from transformers import AutoTokenizer
|
| 15 |
|
| 16 |
from tinyvla.data.canonical import CanonicalChunkStore, quantile_normalize
|
| 17 |
+
from tinyvla.data.eval_utils import StateAdapter
|
| 18 |
from tinyvla.modeling_tinyvla import TinyVLAPolicy
|
| 19 |
from tinyvla.modules.embodiment import MORPH_FIELDS
|
| 20 |
|
| 21 |
+
import sys
|
| 22 |
+
CKPT = sys.argv[1] if len(sys.argv) > 1 else "outputs/tv2_robocasa/final"
|
| 23 |
_SC = {"arm_dof": 0.1, "reach_m": 2, "gripper_width_m": 10, "num_cameras": 1 / 3,
|
| 24 |
"control_hz": 1 / 30, "joint_lo_mean": 1 / 3.1416, "joint_hi_mean": 1 / 3.1416,
|
| 25 |
"workspace_x": 2, "workspace_y": 2, "workspace_z": 2, "payload_kg": 0.2}
|
|
|
|
| 54 |
ds = LeRobotDataset(name, root=root,
|
| 55 |
delta_timestamps={"action": [t / m.fps for t in range(50)]},
|
| 56 |
video_backend="torchcodec")
|
| 57 |
+
_sa = StateAdapter(ds.meta, cfg.max_state_dim)
|
| 58 |
store = CanonicalChunkStore(name, src_fps=m.fps, chunk=50)
|
| 59 |
st = store.compute_stats()
|
| 60 |
q01, q99 = np.asarray(st["q01"]), np.asarray(st["q99"])
|
|
|
|
| 75 |
t = tok([item.get("task") or ""], padding=True, truncation=True,
|
| 76 |
max_length=48, return_tensors="pt")
|
| 77 |
img = torch.nn.functional.interpolate(item[prim][None], size=(256, 256), mode="bilinear")[0]
|
| 78 |
+
stt = _sa(item["observation.state"])
|
|
|
|
|
|
|
| 79 |
b = {"observation.images.cam0": img[None].cuda(),
|
| 80 |
"observation.images.cam1": torch.zeros_like(img)[None].cuda(),
|
| 81 |
"observation.state": stt[None].cuda(),
|