LITOperator / sandbox /lerobot_host /lit_robot_api.py
OzTianlu's picture
Duplicate from ReasoningKingdom/LITOperator
1ddfac5
Raw History Blame Contribute Delete
1.06 kB
#!/usr/bin/env python3
"""lit_robot_api.py — the LeRobot glue for lit_robot.LITOperator.
from lit_robot_api import default_operator
op = default_operator()
program = op(frame) # [action, ...] open-loop
A frame is the usual LeRobot observation dict: cameras, `observation.
state`, task. The community tree's canonical codec root is
`1g0rrr/demo3_frames_grab3`.
"""
import os
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
SANDBOX = os.path.dirname(HERE)
REPO = os.path.dirname(SANDBOX)
sys.path.insert(0, os.path.join(REPO, "lit_operator"))
sys.path.insert(0, SANDBOX)
from lit_robot import LITOperator # noqa: E402
REPO_ID = "lerobot/community_dataset_v3"
ROOT = "1g0rrr/demo3_frames_grab3"
TREE = os.path.join(REPO, "weights",
"LITOperator-community_open_selfboot.safetensors")
def lerobot_operator(tree=TREE, repo=REPO_ID, root=ROOT):
from lit_stream import make_codec
codec, _info = make_codec(repo, root)
return LITOperator(tree, codec)
default_operator = lerobot_operator