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_qwenmorph_lekiwi.py with huggingface_hub
Browse files
tinyvla2/scripts/eval_qwenmorph_lekiwi.py
CHANGED
|
@@ -13,6 +13,7 @@ from lerobot.datasets.lerobot_dataset import LeRobotDataset, LeRobotDatasetMetad
|
|
| 13 |
from transformers import AutoTokenizer
|
| 14 |
|
| 15 |
from tinyvla.data.canonical import CanonicalChunkStore, quantile_normalize
|
|
|
|
| 16 |
from tinyvla.modeling_tinyvla import TinyVLAPolicy
|
| 17 |
|
| 18 |
CKPT = "outputs/tv2_C_qwen_morph/final"
|
|
@@ -30,6 +31,7 @@ def main():
|
|
| 30 |
m = LeRobotDatasetMetadata(DS, root=ROOT)
|
| 31 |
ds = LeRobotDataset(DS, root=ROOT, delta_timestamps={"action": [t / m.fps for t in range(50)]},
|
| 32 |
video_backend="torchcodec")
|
|
|
|
| 33 |
store = CanonicalChunkStore(DS, src_fps=m.fps, chunk=50)
|
| 34 |
st = store.compute_stats()
|
| 35 |
q01, q99 = np.asarray(st["q01"]), np.asarray(st["q99"])
|
|
@@ -66,7 +68,7 @@ def main():
|
|
| 66 |
task = item.get("task") or ""
|
| 67 |
t = tok([task], padding=True, truncation=True, max_length=48, return_tensors="pt")
|
| 68 |
img = torch.nn.functional.interpolate(item[prim][None], size=(256, 256), mode="bilinear")[0]
|
| 69 |
-
stt =
|
| 70 |
b = {"observation.images.cam0": img[None].cuda(),
|
| 71 |
"observation.images.cam1": torch.zeros_like(img)[None].cuda(),
|
| 72 |
"observation.state": stt[None].cuda(),
|
|
|
|
| 13 |
from transformers import AutoTokenizer
|
| 14 |
|
| 15 |
from tinyvla.data.canonical import CanonicalChunkStore, quantile_normalize
|
| 16 |
+
from tinyvla.data.eval_utils import StateAdapter
|
| 17 |
from tinyvla.modeling_tinyvla import TinyVLAPolicy
|
| 18 |
|
| 19 |
CKPT = "outputs/tv2_C_qwen_morph/final"
|
|
|
|
| 31 |
m = LeRobotDatasetMetadata(DS, root=ROOT)
|
| 32 |
ds = LeRobotDataset(DS, root=ROOT, delta_timestamps={"action": [t / m.fps for t in range(50)]},
|
| 33 |
video_backend="torchcodec")
|
| 34 |
+
_sa = StateAdapter(ds.meta, cfg.max_state_dim)
|
| 35 |
store = CanonicalChunkStore(DS, src_fps=m.fps, chunk=50)
|
| 36 |
st = store.compute_stats()
|
| 37 |
q01, q99 = np.asarray(st["q01"]), np.asarray(st["q99"])
|
|
|
|
| 68 |
task = item.get("task") or ""
|
| 69 |
t = tok([task], padding=True, truncation=True, max_length=48, return_tensors="pt")
|
| 70 |
img = torch.nn.functional.interpolate(item[prim][None], size=(256, 256), mode="bilinear")[0]
|
| 71 |
+
stt = _sa(item["observation.state"])
|
| 72 |
b = {"observation.images.cam0": img[None].cuda(),
|
| 73 |
"observation.images.cam1": torch.zeros_like(img)[None].cuda(),
|
| 74 |
"observation.state": stt[None].cuda(),
|