edgeos 0.6.0__tar.gz
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.
- edgeos-0.6.0/LICENSE +10 -0
- edgeos-0.6.0/PKG-INFO +89 -0
- edgeos-0.6.0/README.md +46 -0
- edgeos-0.6.0/edgeos.egg-info/PKG-INFO +89 -0
- edgeos-0.6.0/edgeos.egg-info/SOURCES.txt +18 -0
- edgeos-0.6.0/edgeos.egg-info/dependency_links.txt +1 -0
- edgeos-0.6.0/edgeos.egg-info/entry_points.txt +2 -0
- edgeos-0.6.0/edgeos.egg-info/requires.txt +12 -0
- edgeos-0.6.0/edgeos.egg-info/top_level.txt +1 -0
- edgeos-0.6.0/edgeos_cli/__init__.py +1 -0
- edgeos-0.6.0/edgeos_cli/auto.py +143 -0
- edgeos-0.6.0/edgeos_cli/deploy.py +940 -0
- edgeos-0.6.0/edgeos_cli/frames.py +69 -0
- edgeos-0.6.0/edgeos_cli/image_tarball.py +250 -0
- edgeos-0.6.0/edgeos_cli/lerobot_export.py +202 -0
- edgeos-0.6.0/edgeos_cli/main.py +3534 -0
- edgeos-0.6.0/edgeos_cli/signing.py +162 -0
- edgeos-0.6.0/edgeos_cli/simple.py +150 -0
- edgeos-0.6.0/pyproject.toml +48 -0
- edgeos-0.6.0/setup.cfg +4 -0
edgeos-0.6.0/LICENSE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Copyright (c) 2026 EdgeOS. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This software is provided to customers and evaluators of EdgeOS for use with an EdgeOS server. You may install and
|
|
4
|
+
run it, unmodified, for that purpose. Any other use, copying, modification or distribution requires written
|
|
5
|
+
permission from EdgeOS.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
8
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
9
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
10
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
edgeos-0.6.0/PKG-INFO
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: edgeos
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: EdgeOS: put AI models on robot fleets and keep them updated, from the command line.
|
|
5
|
+
Author: EdgeOS
|
|
6
|
+
License: Copyright (c) 2026 EdgeOS. All rights reserved.
|
|
7
|
+
|
|
8
|
+
This software is provided to customers and evaluators of EdgeOS for use with an EdgeOS server. You may install and
|
|
9
|
+
run it, unmodified, for that purpose. Any other use, copying, modification or distribution requires written
|
|
10
|
+
permission from EdgeOS.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
13
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
14
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
15
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
|
+
|
|
17
|
+
Project-URL: Homepage, https://edge-os.tech
|
|
18
|
+
Keywords: robotics,jetson,onnx,tensorrt,ota,fleet,mlops,edge-ai
|
|
19
|
+
Classifier: Development Status :: 4 - Beta
|
|
20
|
+
Classifier: Environment :: Console
|
|
21
|
+
Classifier: Intended Audience :: Developers
|
|
22
|
+
Classifier: Intended Audience :: Science/Research
|
|
23
|
+
Classifier: License :: Other/Proprietary License
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
|
26
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
28
|
+
Classifier: Topic :: System :: Software Distribution
|
|
29
|
+
Requires-Python: >=3.9
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Requires-Dist: typer<1.0,>=0.12
|
|
33
|
+
Requires-Dist: rich>=13.7
|
|
34
|
+
Requires-Dist: httpx<1.0,>=0.27
|
|
35
|
+
Requires-Dist: certifi
|
|
36
|
+
Provides-Extra: datasets
|
|
37
|
+
Requires-Dist: numpy; extra == "datasets"
|
|
38
|
+
Requires-Dist: pillow; extra == "datasets"
|
|
39
|
+
Provides-Extra: lerobot
|
|
40
|
+
Requires-Dist: numpy; extra == "lerobot"
|
|
41
|
+
Requires-Dist: lerobot[dataset]>=0.4; extra == "lerobot"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# EdgeOS
|
|
45
|
+
|
|
46
|
+
Put AI models on your robots and keep them updated. Upload an ONNX model once; each robot builds it for its own
|
|
47
|
+
hardware, one robot gets it first, the rest follow in batches, and it rolls back by itself if robots fail.
|
|
48
|
+
|
|
49
|
+
This package is the `edgeos` command. It talks to an EdgeOS server: an EdgeOS Cloud invite, or your team's own.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install edgeos
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Four commands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
edgeos login https://app.example.com # once: your server's address
|
|
59
|
+
edgeos add-robot # once per robot: prints one line to run on it
|
|
60
|
+
edgeos deploy pallet-detector.onnx # every time you have a new model
|
|
61
|
+
edgeos status # robots, the models they run, updates in progress, what to do next
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Something wrong after an update? `edgeos rollback pallet-detector` puts the previous version back.
|
|
65
|
+
|
|
66
|
+
## What you need
|
|
67
|
+
|
|
68
|
+
| | |
|
|
69
|
+
|---|---|
|
|
70
|
+
| **Robots** | NVIDIA Jetson (JetPack 4.6 to 6.x, e.g. Jetson Nano, Orin) or Raspberry Pi 4/5 with a 64-bit OS, with internet access and `sudo` |
|
|
71
|
+
| **Your computer** | Python 3.9 or newer |
|
|
72
|
+
| **An EdgeOS server** | Its address and a way to sign in (`edgeos login`: a browser sign-in on EdgeOS Cloud, a token on your own server) |
|
|
73
|
+
| **A model** | An ONNX file, e.g. `yolo export model=best.pt format=onnx` |
|
|
74
|
+
|
|
75
|
+
## More than the four commands
|
|
76
|
+
|
|
77
|
+
- `edgeos check MODEL` and `edgeos tune MODEL --versions …`: which robots can run a model, and which version and
|
|
78
|
+
precision is fastest on each robot group, measured on real hardware before anything moves.
|
|
79
|
+
- `edgeos deploy … --shadow 10m --min-agreement 95%`: the new version runs next to the old one on copies of live
|
|
80
|
+
requests before it serves.
|
|
81
|
+
- `edgeos hard-cases`, `edgeos dataset`, `edgeos replay`: the frames your robots found hard, labelled and kept as
|
|
82
|
+
versioned datasets, and a check of the next version against them before release.
|
|
83
|
+
- `edgeos release show MODEL VERSION`: one sealed record per version, from its training data to its rollouts.
|
|
84
|
+
- `edgeos --help` lists everything; every command has `--help`.
|
|
85
|
+
|
|
86
|
+
Optional extras: `pip install "edgeos[datasets]"` (dataset downloads as images, COCO or YOLO) and
|
|
87
|
+
`pip install "edgeos[lerobot]"` (episodes exported as LeRobot datasets).
|
|
88
|
+
|
|
89
|
+
https://edge-os.tech
|
edgeos-0.6.0/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# EdgeOS
|
|
2
|
+
|
|
3
|
+
Put AI models on your robots and keep them updated. Upload an ONNX model once; each robot builds it for its own
|
|
4
|
+
hardware, one robot gets it first, the rest follow in batches, and it rolls back by itself if robots fail.
|
|
5
|
+
|
|
6
|
+
This package is the `edgeos` command. It talks to an EdgeOS server: an EdgeOS Cloud invite, or your team's own.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install edgeos
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Four commands
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
edgeos login https://app.example.com # once: your server's address
|
|
16
|
+
edgeos add-robot # once per robot: prints one line to run on it
|
|
17
|
+
edgeos deploy pallet-detector.onnx # every time you have a new model
|
|
18
|
+
edgeos status # robots, the models they run, updates in progress, what to do next
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Something wrong after an update? `edgeos rollback pallet-detector` puts the previous version back.
|
|
22
|
+
|
|
23
|
+
## What you need
|
|
24
|
+
|
|
25
|
+
| | |
|
|
26
|
+
|---|---|
|
|
27
|
+
| **Robots** | NVIDIA Jetson (JetPack 4.6 to 6.x, e.g. Jetson Nano, Orin) or Raspberry Pi 4/5 with a 64-bit OS, with internet access and `sudo` |
|
|
28
|
+
| **Your computer** | Python 3.9 or newer |
|
|
29
|
+
| **An EdgeOS server** | Its address and a way to sign in (`edgeos login`: a browser sign-in on EdgeOS Cloud, a token on your own server) |
|
|
30
|
+
| **A model** | An ONNX file, e.g. `yolo export model=best.pt format=onnx` |
|
|
31
|
+
|
|
32
|
+
## More than the four commands
|
|
33
|
+
|
|
34
|
+
- `edgeos check MODEL` and `edgeos tune MODEL --versions …`: which robots can run a model, and which version and
|
|
35
|
+
precision is fastest on each robot group, measured on real hardware before anything moves.
|
|
36
|
+
- `edgeos deploy … --shadow 10m --min-agreement 95%`: the new version runs next to the old one on copies of live
|
|
37
|
+
requests before it serves.
|
|
38
|
+
- `edgeos hard-cases`, `edgeos dataset`, `edgeos replay`: the frames your robots found hard, labelled and kept as
|
|
39
|
+
versioned datasets, and a check of the next version against them before release.
|
|
40
|
+
- `edgeos release show MODEL VERSION`: one sealed record per version, from its training data to its rollouts.
|
|
41
|
+
- `edgeos --help` lists everything; every command has `--help`.
|
|
42
|
+
|
|
43
|
+
Optional extras: `pip install "edgeos[datasets]"` (dataset downloads as images, COCO or YOLO) and
|
|
44
|
+
`pip install "edgeos[lerobot]"` (episodes exported as LeRobot datasets).
|
|
45
|
+
|
|
46
|
+
https://edge-os.tech
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: edgeos
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: EdgeOS: put AI models on robot fleets and keep them updated, from the command line.
|
|
5
|
+
Author: EdgeOS
|
|
6
|
+
License: Copyright (c) 2026 EdgeOS. All rights reserved.
|
|
7
|
+
|
|
8
|
+
This software is provided to customers and evaluators of EdgeOS for use with an EdgeOS server. You may install and
|
|
9
|
+
run it, unmodified, for that purpose. Any other use, copying, modification or distribution requires written
|
|
10
|
+
permission from EdgeOS.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
13
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
14
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
15
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
|
+
|
|
17
|
+
Project-URL: Homepage, https://edge-os.tech
|
|
18
|
+
Keywords: robotics,jetson,onnx,tensorrt,ota,fleet,mlops,edge-ai
|
|
19
|
+
Classifier: Development Status :: 4 - Beta
|
|
20
|
+
Classifier: Environment :: Console
|
|
21
|
+
Classifier: Intended Audience :: Developers
|
|
22
|
+
Classifier: Intended Audience :: Science/Research
|
|
23
|
+
Classifier: License :: Other/Proprietary License
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
|
26
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
28
|
+
Classifier: Topic :: System :: Software Distribution
|
|
29
|
+
Requires-Python: >=3.9
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Requires-Dist: typer<1.0,>=0.12
|
|
33
|
+
Requires-Dist: rich>=13.7
|
|
34
|
+
Requires-Dist: httpx<1.0,>=0.27
|
|
35
|
+
Requires-Dist: certifi
|
|
36
|
+
Provides-Extra: datasets
|
|
37
|
+
Requires-Dist: numpy; extra == "datasets"
|
|
38
|
+
Requires-Dist: pillow; extra == "datasets"
|
|
39
|
+
Provides-Extra: lerobot
|
|
40
|
+
Requires-Dist: numpy; extra == "lerobot"
|
|
41
|
+
Requires-Dist: lerobot[dataset]>=0.4; extra == "lerobot"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# EdgeOS
|
|
45
|
+
|
|
46
|
+
Put AI models on your robots and keep them updated. Upload an ONNX model once; each robot builds it for its own
|
|
47
|
+
hardware, one robot gets it first, the rest follow in batches, and it rolls back by itself if robots fail.
|
|
48
|
+
|
|
49
|
+
This package is the `edgeos` command. It talks to an EdgeOS server: an EdgeOS Cloud invite, or your team's own.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install edgeos
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Four commands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
edgeos login https://app.example.com # once: your server's address
|
|
59
|
+
edgeos add-robot # once per robot: prints one line to run on it
|
|
60
|
+
edgeos deploy pallet-detector.onnx # every time you have a new model
|
|
61
|
+
edgeos status # robots, the models they run, updates in progress, what to do next
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Something wrong after an update? `edgeos rollback pallet-detector` puts the previous version back.
|
|
65
|
+
|
|
66
|
+
## What you need
|
|
67
|
+
|
|
68
|
+
| | |
|
|
69
|
+
|---|---|
|
|
70
|
+
| **Robots** | NVIDIA Jetson (JetPack 4.6 to 6.x, e.g. Jetson Nano, Orin) or Raspberry Pi 4/5 with a 64-bit OS, with internet access and `sudo` |
|
|
71
|
+
| **Your computer** | Python 3.9 or newer |
|
|
72
|
+
| **An EdgeOS server** | Its address and a way to sign in (`edgeos login`: a browser sign-in on EdgeOS Cloud, a token on your own server) |
|
|
73
|
+
| **A model** | An ONNX file, e.g. `yolo export model=best.pt format=onnx` |
|
|
74
|
+
|
|
75
|
+
## More than the four commands
|
|
76
|
+
|
|
77
|
+
- `edgeos check MODEL` and `edgeos tune MODEL --versions …`: which robots can run a model, and which version and
|
|
78
|
+
precision is fastest on each robot group, measured on real hardware before anything moves.
|
|
79
|
+
- `edgeos deploy … --shadow 10m --min-agreement 95%`: the new version runs next to the old one on copies of live
|
|
80
|
+
requests before it serves.
|
|
81
|
+
- `edgeos hard-cases`, `edgeos dataset`, `edgeos replay`: the frames your robots found hard, labelled and kept as
|
|
82
|
+
versioned datasets, and a check of the next version against them before release.
|
|
83
|
+
- `edgeos release show MODEL VERSION`: one sealed record per version, from its training data to its rollouts.
|
|
84
|
+
- `edgeos --help` lists everything; every command has `--help`.
|
|
85
|
+
|
|
86
|
+
Optional extras: `pip install "edgeos[datasets]"` (dataset downloads as images, COCO or YOLO) and
|
|
87
|
+
`pip install "edgeos[lerobot]"` (episodes exported as LeRobot datasets).
|
|
88
|
+
|
|
89
|
+
https://edge-os.tech
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
edgeos.egg-info/PKG-INFO
|
|
5
|
+
edgeos.egg-info/SOURCES.txt
|
|
6
|
+
edgeos.egg-info/dependency_links.txt
|
|
7
|
+
edgeos.egg-info/entry_points.txt
|
|
8
|
+
edgeos.egg-info/requires.txt
|
|
9
|
+
edgeos.egg-info/top_level.txt
|
|
10
|
+
edgeos_cli/__init__.py
|
|
11
|
+
edgeos_cli/auto.py
|
|
12
|
+
edgeos_cli/deploy.py
|
|
13
|
+
edgeos_cli/frames.py
|
|
14
|
+
edgeos_cli/image_tarball.py
|
|
15
|
+
edgeos_cli/lerobot_export.py
|
|
16
|
+
edgeos_cli/main.py
|
|
17
|
+
edgeos_cli/signing.py
|
|
18
|
+
edgeos_cli/simple.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
edgeos_cli
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""EdgeOS command-line interface."""
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"""`edgeos auto`: the steps toward a goal, run in order: look at the robots, push the model, give it its evaluation
|
|
2
|
+
and calibration sets, tune it on each robot group's builder, pick the candidate that meets the goal, and deploy it
|
|
3
|
+
(`decide` says how each robot group is rolled out).
|
|
4
|
+
|
|
5
|
+
Every step is still a command of its own (push, eval add, calibration add, tune, deploy); this module only decides
|
|
6
|
+
between them, as pure functions on what the server returned, so the decisions can be tested without one. The plan it
|
|
7
|
+
makes is plain JSON: saved, shown, and replayable (`edgeos auto --plan FILE`).
|
|
8
|
+
"""
|
|
9
|
+
import shlex
|
|
10
|
+
from datetime import datetime, timezone
|
|
11
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
12
|
+
|
|
13
|
+
PLAN_FORMAT = 1
|
|
14
|
+
GOALS = ("min-latency", "max-fps")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def precisions_for(calibration: bool, evaluation: bool, asked: Optional[List[str]] = None) -> List[str]:
|
|
18
|
+
"""What tune measures: the precisions asked for, else FP16 and FP32, plus INT8 when there is a calibration set.
|
|
19
|
+
With an evaluation set tune adds FP32 itself, as the reference."""
|
|
20
|
+
if asked:
|
|
21
|
+
return asked
|
|
22
|
+
return ["fp16", "fp32"] + (["int8"] if calibration else [])
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def in_scope(group: Dict[str, Any], hardware: Optional[str], jetpack: Optional[str], trt: Optional[str]) -> bool:
|
|
26
|
+
"""The robot groups `--hardware/--jetpack/--trt` pick (all when none is given), as deploy's filters do."""
|
|
27
|
+
return ((hardware is None or group["hardware"] == hardware) and (jetpack is None or group["jetpack"] == jetpack)
|
|
28
|
+
and (trt is None or group["trt"] == trt))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def serving(devices: List[Dict[str, Any]], model: str, group: Dict[str, Any]) -> List[str]:
|
|
32
|
+
"""Versions of the model the group's robots serve now (what a shadow would compare the new one with)."""
|
|
33
|
+
versions = set()
|
|
34
|
+
for d in devices:
|
|
35
|
+
if d.get("role") != "robot" or (d.get("hardware_target"), d.get("jetpack_version"), d.get("trt_version")) != (
|
|
36
|
+
group["hardware"], group["jetpack"], group["trt"]):
|
|
37
|
+
continue
|
|
38
|
+
for m in d.get("models") or []:
|
|
39
|
+
if m.get("model") == model and m.get("serving_version"):
|
|
40
|
+
versions.add(m["serving_version"])
|
|
41
|
+
return sorted(versions)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def robots_summary(devices: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
45
|
+
"""Per stack (hardware, JetPack, TensorRT): robots, online, builders online, the least free memory reported."""
|
|
46
|
+
stacks: Dict[Tuple[Any, Any, Any], Dict[str, Any]] = {}
|
|
47
|
+
for d in devices:
|
|
48
|
+
if d.get("role") not in ("robot", "builder"):
|
|
49
|
+
continue
|
|
50
|
+
key = (d.get("hardware_target"), d.get("jetpack_version"), d.get("trt_version"))
|
|
51
|
+
s = stacks.setdefault(key, {"hardware": key[0], "jetpack": key[1], "trt": key[2], "robots": 0, "online": 0,
|
|
52
|
+
"builders": [], "min_free_mb": None})
|
|
53
|
+
if d["role"] == "builder":
|
|
54
|
+
if d.get("online"):
|
|
55
|
+
s["builders"].append(d["name"])
|
|
56
|
+
continue
|
|
57
|
+
s["robots"] += 1
|
|
58
|
+
s["online"] += 1 if d.get("online") else 0
|
|
59
|
+
free = (d.get("health") or {}).get("mem_available_mb")
|
|
60
|
+
if free is not None and (s["min_free_mb"] is None or free < s["min_free_mb"]):
|
|
61
|
+
s["min_free_mb"] = free
|
|
62
|
+
return [s for s in stacks.values() if s["robots"]]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _summary(c: Dict[str, Any]) -> Dict[str, Any]:
|
|
66
|
+
m = (c.get("measured") or {}).get("metrics") or {}
|
|
67
|
+
acc = c.get("accuracy") or {}
|
|
68
|
+
return {"fps": c.get("fps"), "p95_ms": m.get("p95_ms"), "p99_ms": m.get("p99_ms"), "load_mb": m.get("load_mb"),
|
|
69
|
+
"accuracy_drop_upper": acc.get("drop_upper"), "agreement": acc.get("agreement"),
|
|
70
|
+
"eval_frames": acc.get("frames")}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def decide(report: Dict[str, Any], devices: List[Dict[str, Any]], *, customer: str, model: str, version: str,
|
|
74
|
+
sha256: str, goal: str, max_accuracy_drop: Optional[float],
|
|
75
|
+
hardware: Optional[str] = None, jetpack: Optional[str] = None, trt: Optional[str] = None,
|
|
76
|
+
control_hz: Optional[float] = None) -> Dict[str, Any]:
|
|
77
|
+
"""The plan: one deploy per robot group with a recommendation, the groups left out and why. Each is a staged
|
|
78
|
+
rollout (canary, then batches, rolled back on failures)."""
|
|
79
|
+
deploys, skipped = [], []
|
|
80
|
+
for g in report["groups"]:
|
|
81
|
+
if not in_scope(g, hardware, jetpack, trt):
|
|
82
|
+
continue
|
|
83
|
+
best = g.get("recommended")
|
|
84
|
+
if not g["builders"]:
|
|
85
|
+
skipped.append({"group": g["label"], "why": "no builder on this stack measured it (join one with "
|
|
86
|
+
"`edgeos join --builder` on a device of this kind)"})
|
|
87
|
+
continue
|
|
88
|
+
if best is None:
|
|
89
|
+
skipped.append({"group": g["label"], "why": g.get("note") or "no candidate fits the limits"})
|
|
90
|
+
continue
|
|
91
|
+
current = serving(devices, model, g)
|
|
92
|
+
deploys.append({
|
|
93
|
+
"group": g["label"], "hardware": g["hardware"], "jetpack": g["jetpack"], "trt": g["trt"],
|
|
94
|
+
"robots": g["robots"], "precision": best["precision"], "batch": best.get("batch", 1),
|
|
95
|
+
"input_shapes": best.get("input_shapes") or {}, "serving": current,
|
|
96
|
+
"control_hz": control_hz, "measured": dict(_summary(best), builders=g["builders"]),
|
|
97
|
+
})
|
|
98
|
+
plan = {"format": PLAN_FORMAT, "made_at": datetime.now(timezone.utc).isoformat(timespec="seconds"),
|
|
99
|
+
"customer": customer, "model": model, "version": version, "sha256": sha256, "goal": goal,
|
|
100
|
+
"max_accuracy_drop": max_accuracy_drop, "evaluation": report.get("evaluation"),
|
|
101
|
+
"deploys": deploys, "skipped": skipped}
|
|
102
|
+
for d in deploys:
|
|
103
|
+
d["command"] = deploy_command(plan, d)
|
|
104
|
+
return plan
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def deploy_command(plan: Dict[str, Any], d: Dict[str, Any]) -> str:
|
|
108
|
+
"""The `edgeos deploy` that does the same as this step: printed, so it can be run (or changed) by hand."""
|
|
109
|
+
args = ["edgeos", "deploy", plan["model"], plan["version"], "--customer", plan["customer"],
|
|
110
|
+
"--hardware", d["hardware"], "--jetpack", d["jetpack"], "--trt", d["trt"], "--precision", d["precision"]]
|
|
111
|
+
for name, dims in sorted(d["input_shapes"].items()):
|
|
112
|
+
args += ["--input-shape", f"{name}:{'x'.join(str(x) for x in dims)}"]
|
|
113
|
+
if d.get("control_hz"):
|
|
114
|
+
args += ["--control-hz", f"{d['control_hz']:g}"]
|
|
115
|
+
return " ".join(shlex.quote(a) for a in args)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def check_plan(plan: Any) -> Dict[str, Any]:
|
|
119
|
+
"""A saved plan, as `--plan FILE` reads it back: refuse anything this version didn't write."""
|
|
120
|
+
if not isinstance(plan, dict) or plan.get("format") != PLAN_FORMAT:
|
|
121
|
+
raise ValueError("not a plan written by `edgeos auto` (format 1)")
|
|
122
|
+
for key in ("customer", "model", "version", "sha256", "deploys"):
|
|
123
|
+
if not plan.get(key):
|
|
124
|
+
raise ValueError(f"the plan has no {key}")
|
|
125
|
+
for d in plan["deploys"]:
|
|
126
|
+
for key in ("hardware", "jetpack", "trt", "precision"):
|
|
127
|
+
if not d.get(key):
|
|
128
|
+
raise ValueError(f"a deploy in the plan has no {key}")
|
|
129
|
+
if d.get("precision") not in ("fp16", "fp32", "int8"):
|
|
130
|
+
raise ValueError(f"unknown precision {d.get('precision')!r} in the plan")
|
|
131
|
+
return plan
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def robots_result(report: Dict[str, Any], d: Dict[str, Any], version: str) -> Optional[Dict[str, Any]]:
|
|
135
|
+
"""After the rollout: what this group's robots measured on the deployed candidate, under their own traffic."""
|
|
136
|
+
for g in report.get("groups", []):
|
|
137
|
+
if (g["hardware"], g["jetpack"], g["trt"]) != (d["hardware"], d["jetpack"], d["trt"]):
|
|
138
|
+
continue
|
|
139
|
+
for c in g["candidates"]:
|
|
140
|
+
if (c["version"], c["precision"], c.get("batch", 1)) == (version, d["precision"], d.get("batch", 1)):
|
|
141
|
+
p95 = c.get("served_p95_ms")
|
|
142
|
+
return {"served_p95_ms": p95, "builder_fps": c.get("fps")}
|
|
143
|
+
return None
|