File size: 1,224 Bytes
9d8d25c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # SPDX-License-Identifier: Apache-2.0
"""Quickstart: one action chunk of RDT2-FM on a Tenstorrent Blackhole p150 from the shipped sample.
pip install -e . # from the repo root, in a tt-metal environment with the patches in patches/
python examples/quickstart.py
The first run downloads the pinned weights (about 11 GB) into the Hugging Face cache and JIT-compiles the kernels.
"""
import numpy as np
from tt_rdt2 import RDT2FM, load_sample
sample = load_sample() # two 384x384 wrist cameras (left_stereo, right_stereo), the instruction, a zero state
with RDT2FM.from_pretrained() as model: # weights -> device (ETH dispatch) -> every prompt bucket traced and warm
out = model(sample["images"], sample["instruction"], state=sample["state"], seed=0)
print(f"instruction: {sample['instruction']!r} -> bucket {out.prompt_bucket} ({out.num_tokens} tokens)")
print(f"actions {out.actions.shape} (24 steps at 30 Hz; right arm cols 0-9, left arm 10-19)")
np.set_printoptions(precision=4, suppress=True)
print("first step, right arm position (m):", out.actions[0, 0:3], " gripper width (m):", out.actions[0, 9])
print("timing_ms:", {k: round(v, 1) for k, v in out.timing_ms.items()})
|