Instructions to use NoesisLab/LITOperator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LeRobot
How to use NoesisLab/LITOperator 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
Download demo/demo.py from NoesisLab/LITOperator: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/NoesisLab/LITOperator/resolve/main/demo/demo.py
- Command line
-
hf download hf://NoesisLab/LITOperator/demo/demo.py
-
curl -L -o demo.py https://huggingface.co/NoesisLab/LITOperator/resolve/main/demo/demo.py
1.92 kB
| #!/usr/bin/env python3 | |
| """demo.py — one open-set decision of the robot model. | |
| Builds the C core as a shared library (`make lib`), then runs the drive | |
| host on a tiny synthetic world: root = the current observation key, | |
| actions = one freshly sampled action (open set, one step), judge = one | |
| IF. The first action of the found path is printed. | |
| Run from the repo root: | |
| make demo | |
| """ | |
| import os | |
| import sys | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| sys.path.insert(0, os.path.join(ROOT, "sandbox", "lerobot_host")) | |
| from lit_codec import FeatureCodec # noqa: E402 | |
| from lit_drive import act # noqa: E402 | |
| def build_codec(): | |
| """Two action dims, two proprio dims; everything is 16-hex on the wire.""" | |
| return FeatureCodec( | |
| "demo", | |
| {"action": {"dtype": "float32", "shape": [2]}, | |
| "s0": {"dtype": "float32", "shape": [1]}, | |
| "s1": {"dtype": "float32", "shape": [1]}}, | |
| {"action": {"min": [0.0, 0.0], "max": [1.0, 1.0]}}, | |
| []) | |
| def main(): | |
| codec = build_codec() | |
| frame = {"s0": 0.5, "s1": 0.5, "action": [0.0, 0.0], | |
| "task_index": 0} | |
| # The task's one-line IF. This synthetic judge accepts the low | |
| # quarter of the first action bin; on a robot it is the real task IF. | |
| def judge(code, words): | |
| _ = words | |
| return 1 if (code & 0xFFFF) < 0x4000 else 0 | |
| # One open step per decision. If the single sampled action misses, | |
| # the next decision samples again; nothing is fabricated. | |
| for decision in range(32): | |
| action, rc, path_len = act(codec, frame, seed=decision, judge=judge) | |
| if action is not None: | |
| print("decision", decision, "rc", rc, "path", path_len) | |
| print("action", [round(float(x), 4) for x in action]) | |
| return 0 | |
| print("no one-step win in 32 decisions") | |
| return 1 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |