lucen-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lucen/__init__.py +72 -0
- lucen/errors.py +141 -0
- lucen/hub.py +889 -0
- lucen/progress.py +96 -0
- lucen/py.typed +0 -0
- lucen/results.py +885 -0
- lucen_cli/__init__.py +3 -0
- lucen_cli/checkpoint_dir.py +226 -0
- lucen_cli/checkpoint_publisher.py +269 -0
- lucen_cli/client.py +1730 -0
- lucen_cli/cmd_auth.py +256 -0
- lucen_cli/cmd_datasets.py +190 -0
- lucen_cli/cmd_holds.py +76 -0
- lucen_cli/cmd_hub.py +245 -0
- lucen_cli/cmd_model.py +175 -0
- lucen_cli/cmd_org.py +154 -0
- lucen_cli/cmd_quickstart.py +320 -0
- lucen_cli/cmd_repo.py +87 -0
- lucen_cli/cmd_robot.py +784 -0
- lucen_cli/cmd_rollout.py +576 -0
- lucen_cli/cmd_runs.py +615 -0
- lucen_cli/cmd_serve.py +438 -0
- lucen_cli/cmd_worker.py +135 -0
- lucen_cli/config.py +268 -0
- lucen_cli/context.py +43 -0
- lucen_cli/contract_derive.py +491 -0
- lucen_cli/embodiment.py +522 -0
- lucen_cli/errors.py +210 -0
- lucen_cli/gate_scorer.py +168 -0
- lucen_cli/group.py +104 -0
- lucen_cli/hf_dataset.py +696 -0
- lucen_cli/live.py +189 -0
- lucen_cli/local.py +160 -0
- lucen_cli/main.py +277 -0
- lucen_cli/model_card.py +523 -0
- lucen_cli/offscreen.py +52 -0
- lucen_cli/onnx_manifest.py +121 -0
- lucen_cli/onnx_writer.py +313 -0
- lucen_cli/ort_quiet.py +75 -0
- lucen_cli/output.py +868 -0
- lucen_cli/progress.py +133 -0
- lucen_cli/pull.py +158 -0
- lucen_cli/push.py +384 -0
- lucen_cli/rl/__init__.py +8 -0
- lucen_cli/rl/ppo.py +316 -0
- lucen_cli/rl/tasks.py +298 -0
- lucen_cli/rl/vecenv.py +246 -0
- lucen_cli/robot/__init__.py +66 -0
- lucen_cli/robot/checks.py +1416 -0
- lucen_cli/robot/confine.py +176 -0
- lucen_cli/robot/draft.py +523 -0
- lucen_cli/robot/hf.py +218 -0
- lucen_cli/robot/hub.py +227 -0
- lucen_cli/robot/intake.py +590 -0
- lucen_cli/robot/model.py +334 -0
- lucen_cli/robot/pose.py +132 -0
- lucen_cli/robot/publish.py +197 -0
- lucen_cli/robot/refs.py +212 -0
- lucen_cli/robot/thumbnail.py +586 -0
- lucen_cli/robot/urdf.py +435 -0
- lucen_cli/robot/worker.py +599 -0
- lucen_cli/robot_assets.py +127 -0
- lucen_cli/rollout/__init__.py +12 -0
- lucen_cli/rollout/assets.py +135 -0
- lucen_cli/rollout/conditions.py +486 -0
- lucen_cli/rollout/contract.py +314 -0
- lucen_cli/rollout/engine.py +1808 -0
- lucen_cli/rollout/harness.py +201 -0
- lucen_cli/rollout/obs.py +262 -0
- lucen_cli/rollout/plant.py +456 -0
- lucen_cli/rollout/posture.py +96 -0
- lucen_cli/rollout/video.py +548 -0
- lucen_cli/rollout/worker.py +505 -0
- lucen_cli/serve/__init__.py +22 -0
- lucen_cli/serve/lerobot_backend.py +337 -0
- lucen_cli/serve/msgpack_numpy.py +59 -0
- lucen_cli/serve/policy.py +276 -0
- lucen_cli/serve/server.py +474 -0
- lucen_cli/serve/session.py +142 -0
- lucen_cli/serve/stub_skill.py +264 -0
- lucen_cli/serve/vla.py +788 -0
- lucen_cli/serve/worker.py +578 -0
- lucen_cli/sim_words.py +55 -0
- lucen_cli/state.py +237 -0
- lucen_cli/templates/__init__.py +94 -0
- lucen_cli/templates/ppo_isaac.py +914 -0
- lucen_cli/templates/ppo_mujoco.py +664 -0
- lucen_cli/templates/smolvla_lora.py +986 -0
- lucen_cli/templates/stub_ppo.py +597 -0
- lucen_cli/templates/stub_skill.py +180 -0
- lucen_cli/tfevents.py +323 -0
- lucen_cli/training_curve.py +70 -0
- lucen_cli/transfer.py +209 -0
- lucen_cli/vla_manifest.py +322 -0
- lucen_cli/worker.py +1433 -0
- lucen_cli-0.1.0.dist-info/METADATA +113 -0
- lucen_cli-0.1.0.dist-info/RECORD +100 -0
- lucen_cli-0.1.0.dist-info/WHEEL +4 -0
- lucen_cli-0.1.0.dist-info/entry_points.txt +3 -0
- lucen_cli-0.1.0.dist-info/licenses/LICENSE +202 -0
lucen/progress.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Progress for a script: silent by default, the CLI's lines on request, or a callback.
|
|
2
|
+
|
|
3
|
+
The CLI's engine reports through :class:`lucen_cli.progress.Reporter` —
|
|
4
|
+
milestones (`step`) and byte counters (`bytes`) on stderr. A script wants one
|
|
5
|
+
of three things, and :func:`make_reporter` builds the reporter for each:
|
|
6
|
+
|
|
7
|
+
- **silent** (the default): nothing is written anywhere; the result object is
|
|
8
|
+
the whole answer,
|
|
9
|
+
- ``progress=True``: exactly what `lucen push` prints — a rich bar on a
|
|
10
|
+
terminal, one plain line per decile in a log,
|
|
11
|
+
- ``on_progress=callback``: every milestone and byte count as a
|
|
12
|
+
:class:`ProgressEvent`, for a notebook widget or a log line of your own.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import threading
|
|
18
|
+
from collections.abc import Callable, Iterator
|
|
19
|
+
from contextlib import contextmanager
|
|
20
|
+
from dataclasses import dataclass
|
|
21
|
+
from typing import Literal
|
|
22
|
+
|
|
23
|
+
from lucen_cli.progress import ByteTask, Reporter
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
class ProgressEvent:
|
|
28
|
+
"""One thing the engine did.
|
|
29
|
+
|
|
30
|
+
`kind` is ``step`` (a milestone: `message`), ``bytes`` (a byte counter
|
|
31
|
+
`label` moved to `done` of `total`), or ``log`` (a line of a run's log
|
|
32
|
+
while it is followed: `message`, with `stream` ``stdout`` for the
|
|
33
|
+
trainer's own output and ``stderr`` for a notice the hub wrote).
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
kind: Literal["step", "bytes", "log"]
|
|
37
|
+
message: str = ""
|
|
38
|
+
label: str | None = None
|
|
39
|
+
done: int = 0
|
|
40
|
+
total: int = 0
|
|
41
|
+
stream: str | None = None
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def fraction(self) -> float | None:
|
|
45
|
+
"""`done / total` for a byte event with a known total, else None."""
|
|
46
|
+
if self.kind != "bytes" or self.total <= 0:
|
|
47
|
+
return None
|
|
48
|
+
return min(1.0, self.done / self.total)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
ProgressCallback = Callable[[ProgressEvent], None]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class _CallbackTask:
|
|
55
|
+
def __init__(self, callback: ProgressCallback, label: str, total: int) -> None:
|
|
56
|
+
self._callback = callback
|
|
57
|
+
self._label = label
|
|
58
|
+
self._total = total
|
|
59
|
+
self._done = 0
|
|
60
|
+
self._lock = threading.Lock()
|
|
61
|
+
|
|
62
|
+
def advance(self, count: int) -> None:
|
|
63
|
+
with self._lock:
|
|
64
|
+
self._done += count
|
|
65
|
+
done = self._done
|
|
66
|
+
self._callback(ProgressEvent("bytes", label=self._label, done=done, total=self._total))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class CallbackReporter(Reporter):
|
|
70
|
+
"""A :class:`Reporter` whose every milestone and byte count is one callback call."""
|
|
71
|
+
|
|
72
|
+
def __init__(self, callback: ProgressCallback) -> None:
|
|
73
|
+
super().__init__(quiet=True)
|
|
74
|
+
self._callback = callback
|
|
75
|
+
|
|
76
|
+
def step(self, message: str) -> None:
|
|
77
|
+
self._callback(ProgressEvent("step", message=message))
|
|
78
|
+
|
|
79
|
+
@contextmanager
|
|
80
|
+
def bytes(self, label: str, total: int) -> Iterator[ByteTask]:
|
|
81
|
+
task = _CallbackTask(self._callback, label, total)
|
|
82
|
+
self._callback(ProgressEvent("bytes", label=label, done=0, total=total))
|
|
83
|
+
yield task
|
|
84
|
+
|
|
85
|
+
def log(self, line: str, *, stream: str) -> None:
|
|
86
|
+
self._callback(ProgressEvent("log", message=line, stream=stream))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def make_reporter(*, progress: bool, on_progress: ProgressCallback | None) -> Reporter:
|
|
90
|
+
"""The reporter for one call: a callback wins, then the CLI's own lines, then silence."""
|
|
91
|
+
if on_progress is not None:
|
|
92
|
+
return CallbackReporter(on_progress)
|
|
93
|
+
return Reporter(quiet=not progress)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
__all__ = ["CallbackReporter", "ProgressCallback", "ProgressEvent", "make_reporter"]
|
lucen/py.typed
ADDED
|
File without changes
|