File size: 1,055 Bytes
1ddfac5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/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