omni-train-cli 0.1.29__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.
omni_cli/__init__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "0.1.29"
omni_cli/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .main import main
2
+
3
+
4
+ if __name__ == "__main__":
5
+ raise SystemExit(main())
File without changes
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: omni-train
3
+ description: Use when operating Omni Train through the CLI, preparing custom image algorithm packages, or running dataset, training, deployment, and algorithm build workflows.
4
+ ---
5
+
6
+ # Omni Train agent workflow
7
+
8
+ Use the `omni` CLI as the only platform interface. Use `--output json` for every command and make decisions from the JSON envelope and exit code.
9
+
10
+ 1. Run `omni context show --output json` before platform work.
11
+ When the user has not selected a Workspace, keep the account's default Workspace
12
+ and do not persist an override. When the user asks which
13
+ Workspaces are available, run `omni workspace list --output json`. Only
14
+ switch after an explicit user request, using
15
+ `omni workspace use <workspace_id> --output json`; never guess a Workspace ID.
16
+ Restore the account default with
17
+ `omni workspace reset --output json`.
18
+ 2. Discover real dataset, task, and algorithm IDs with `omni dataset`, `omni task`, and `omni algorithm`; never guess IDs. Use `omni task list --page`, `--page-size`, or `--all` when the task list is paginated.
19
+ Use `--page`, `--page-size`, or `--all` when a list response is paginated.
20
+ When the user needs a new dataset, run
21
+ `omni dataset create --name <name> --type <type> --labels <label1,label2> --output json`
22
+ and retain the returned `dataset_id`. To upload a local ZIP, run
23
+ `omni dataset upload <archive.zip> --dataset-id <dataset_id> --subset-name <subset> --output json`.
24
+ This command creates the dataset subset and uses persistent TUS resumable
25
+ upload state. Keep resume enabled by default; use `--restart` only when the
26
+ user explicitly asks to discard the current upload session. File upload
27
+ completion is not dataset parsing completion. Use `--wait` only when the
28
+ user asks to wait for parsing, and report the returned upload and parse
29
+ states separately.
30
+ When the user explicitly says the ZIP contains LabelMe annotations, add
31
+ `--labeled-format json`. Each annotated image must have a `.json` file in
32
+ the same directory with the same filename stem. When a classification ZIP
33
+ is organized by label directory, add `--labeled-format folder`; every image
34
+ must be below a directory whose name exactly matches an existing dataset
35
+ label. The target must be a classification dataset using tag annotations.
36
+ A single common wrapper directory is allowed. Do not infer labeled mode
37
+ from ZIP contents when the user has not declared it.
38
+ 3. Read the selected algorithm's `params` from
39
+ `omni algorithm get <algorithm_id> --output json`, then create `train.yaml`
40
+ using `references/train-schema.md`. Standard training defaults are declared
41
+ under `params.base`. When the user does not specify `epochs`, `batch_size`,
42
+ or `input_size`, omit those fields instead of inventing values; the CLI
43
+ applies the selected algorithm's defaults. Put custom overrides under
44
+ `configuration.advanced_conf.<stage>` using only stages and keys declared
45
+ by that algorithm. Never guess a custom parameter name.
46
+ For `dataset.splits`, follow the split rules in `references/train-schema.md`:
47
+ a single subtask uses ratio split and defaults to 8:2 (`0.8`/`0.2`) when
48
+ `train`/`val` are omitted. With multiple subtasks, ask the user whether to
49
+ use ratio split (fractions on every subtask) or independent split
50
+ (`mode: independent` with `1`/`0`, naming which subtasks are train and which
51
+ are val); do not guess the strategy.
52
+ 4. Run `omni train validate --file train.yaml --output json`.
53
+ 5. Run `omni train create --file train.yaml --output json` and retain
54
+ `train_id`, `run_id`, and `invocation_id`.
55
+ 6. By default, create and start it without pausing for confirmation. Immediately
56
+ run `omni train submit --run-id <run_id> --output json` after a successful
57
+ creation. Only stop after creation when the user explicitly asks for
58
+ create-only, no start, a draft, or inspection before starting.
59
+ 7. Wait only when requested with `omni train wait <run_id>`. Do not poll indefinitely.
60
+ 8. Diagnose failures with `omni train status <run_id> --output json` and
61
+ `omni train logs <run_id> --log-type client --output json`. The `client`
62
+ log is the default and contains detailed training output such as per-epoch
63
+ metrics. Use `--log-type task` for workflow-stage messages and
64
+ `--log-type all` for a snapshot of both streams. Add `--follow` only to a
65
+ single `client` or `task` stream.
66
+ 9. Run `omni train stop <run_id>` only after the user explicitly asks to stop.
67
+ 10. On completion, use `omni train result <run_id>` for metrics and `omni train download` only when artifacts are requested.
68
+
69
+ ## Updating existing resources
70
+
71
+ Use the dedicated CLI update command. The CLI follows the platform REST
72
+ contract: algorithms, projects, and training tasks use their standard resource
73
+ `PATCH` endpoints; only deployment configuration uses a dedicated `config`
74
+ endpoint. Updates do not start, stop, delete, upload, rebuild, or resubmit
75
+ anything.
76
+
77
+ - Algorithm metadata: `omni algorithm update <algorithm_id> --file algorithm-update.yaml --output json`.
78
+ Only `name`, `description`, `type`, and `params` are editable. Use
79
+ `omni algorithm upload --algorithm-id` when source code changes.
80
+ - Project metadata: `omni project update <project_id> --file project-update.yaml --output json`.
81
+ Only `name` and `description` are editable; project type is immutable.
82
+ - Training configuration: `omni train update <run_id> --file train.yaml --output json`.
83
+ The task must still be `new`. Keep `project.train_id` and `run.type`
84
+ unchanged. The selected algorithm is read again so omitted base/custom
85
+ parameters use that algorithm's defaults. When `dataset` or `configuration`
86
+ is supplied, it replaces that entire nested section.
87
+ - Deployment configuration: `omni deploy update <deploy_id> --file deploy.yaml --output json`.
88
+ The deployment must still be `new`. The CLI and server revalidate the
89
+ completed model, ONNX artifact, chip, system, framework, and quantization.
90
+ Deployment format remains ONNX.
91
+
92
+ Always inspect the JSON returned after an update. The CLI re-fetches the
93
+ resource so the response reflects server-authoritative values. If a training
94
+ task or deployment has started, create a new one instead of trying to mutate
95
+ runtime state.
96
+
97
+ `omni train submit --file train.yaml --output json` remains a
98
+ backward-compatible shortcut that creates and immediately starts a task. Use
99
+ the explicit create-then-submit flow when the task must be inspected before
100
+ starting.
101
+
102
+ During `omni train create` and the compatible file-based submit shortcut, the
103
+ CLI fetches the selected algorithm, fills omitted base and custom values from
104
+ its defaults, applies the values in `train.yaml` as overrides, and validates
105
+ types, choices, and ranges. The supported image algorithm stages are
106
+ `dataset_preprocess`, `train`, `val`, `dataset_postprocess`, and
107
+ `convert_onnx`. `omni train validate` is offline and checks only the file
108
+ structure; create-time validation is authoritative for the selected algorithm.
109
+
110
+ ## Completed model deployment
111
+
112
+ When the user asks to convert, package, or deploy a completed training model,
113
+ **MUST read** `references/deployment.md` completely before acting.
114
+
115
+ 1. Run `omni deploy platforms --output json` and select only a target returned
116
+ by the current Workspace.
117
+ 2. Confirm the selected model is completed with
118
+ `omni train get <model_id> --output json`. Never deploy an unfinished model.
119
+ 3. Create `deploy.yaml` from `assets/deploy.example.yaml`. Use only the chip,
120
+ framework, system, quantization, and input values supported by the selected
121
+ platform. Never send web-only fields such as `vendor`, `vendoor`,
122
+ `platform`, `compiler`, or `model_name`.
123
+ 4. By default, create and start the deployment without pausing for confirmation
124
+ with `omni deploy submit --file deploy.yaml --output json`. Only stop after
125
+ creation when the user explicitly asks for create-only, no start, a draft,
126
+ or inspection before starting; in that case use
127
+ `omni deploy create --file deploy.yaml --output json`.
128
+ 5. Query `omni deploy status <deploy_id> --output json` and
129
+ `omni deploy logs <deploy_id> --output json`. Use
130
+ `omni deploy wait <deploy_id> --output json` only when the user asks to wait,
131
+ and never poll indefinitely.
132
+ 6. Download the completed package only when requested. When the deployment SDK
133
+ is requested, use
134
+ `omni deploy sdk <deploy_id> --output-path ./artifacts/omni-sdk.zip --output json`.
135
+ The deployment's stored `system` and `platform` are authoritative: never
136
+ invent or send target overrides for SDK download.
137
+ 7. Stop or delete a deployment only after an explicit user request. Preserve
138
+ failed and stopped records and their logs by default.
139
+
140
+ ## Custom image algorithm development
141
+
142
+ When asked to generate, modify, validate, package, or troubleshoot a local
143
+ custom image algorithm, **MUST read**
144
+ `references/custom-image-algorithms.md` completely before acting. Treat that
145
+ reference as the authoritative contract for entrypoints, configuration,
146
+ LabelMe data, stage inputs and outputs, metrics, ONNX artifacts, local
147
+ verification, packaging, and troubleshooting. Do not invent paths or rebuild
148
+ platform-managed configuration fields.
149
+
150
+ When generating a new image algorithm, follow the advisory per-epoch logging
151
+ pattern in `references/custom-image-algorithms.md`. Skill-generated image
152
+ algorithms should emit one progress record after every completed epoch to both
153
+ standard output and `config["log_path"]`. This is not an upload requirement:
154
+ do not reject, rewrite, or diagnose an independently developed algorithm only
155
+ because its logs use another format.
156
+
157
+ For Skill-generated algorithms, apply the headless image dependencies rules in
158
+ the reference. Never generate GUI-enabled OpenCV or Ultralytics requirements
159
+ for the platform training container.
160
+
161
+ For every Skill-generated custom image algorithm, generate a separate
162
+ `algorithm.params.yaml` from `assets/algorithm.params.example.yaml`. Its
163
+ `params.base` configuration must declare `epochs`, `batch_size`, and
164
+ `input_size`. Recommend at least one `params.train` custom group using only
165
+ values the generated training code actually reads, normally including `lr`
166
+ and `optimizer`. Adjust ranges and defaults to the real algorithm instead of
167
+ copying the example mechanically.
168
+
169
+ Pass the file explicitly during upload with
170
+ `--params-file algorithm.params.yaml`. The CLI does not auto-discover parameter
171
+ metadata in the ZIP or working directory. A user-supplied algorithm may still
172
+ be uploaded without a parameter file; explain that its corresponding training
173
+ controls will not be declared until parameter metadata is added.
174
+
175
+ Before uploading or rebuilding an algorithm, **MUST also read**
176
+ `references/cli-commands.md` and use the documented `omni algorithm upload`
177
+ arguments. Run `omni algorithm upload --help` if the installed CLI may differ
178
+ from the bundled reference. Use `omni algorithm base-images --output json` to
179
+ inspect the platform-supported images. Never guess an algorithm ID or base
180
+ image value. When `--base-image` is omitted, the CLI uses the single image
181
+ marked as the platform default.
182
+
183
+ After local verification succeeds, use `omni algorithm upload`. The command
184
+ validates the ZIP archive locally, creates the algorithm when `--algorithm-id`
185
+ is not supplied, uploads the archive, and submits the platform build workflow.
186
+ The archive must have one top-level directory containing
187
+ `dataset_preprocess.py`, `train.py`, `val.py`, `dataset_postprocess.py`,
188
+ `convert_onnx.py`, and `requirements.txt` directly under that directory.
189
+ Retain the returned algorithm and build IDs. Diagnose the build with
190
+ `omni algorithm build-status <algorithm_id> <build_id>` and
191
+ `omni algorithm build-logs <algorithm_id> <build_id>`. Use
192
+ `omni algorithm builds <algorithm_id>` when the build ID must be discovered.
193
+
194
+ Never print or request an API Key in chat, call arbitrary REST URLs, access Django models, or parse human-readable CLI output.
@@ -0,0 +1,60 @@
1
+ # Parameter metadata uploaded with:
2
+ # omni algorithm upload ... --params-file algorithm.params.yaml
3
+ # Adjust ranges and defaults to match the algorithm implementation.
4
+
5
+ base:
6
+ epochs:
7
+ key: epochs
8
+ name: Epochs
9
+ choice_type: range
10
+ choice_value: [1, 200]
11
+ value_type: int
12
+ default: 100
13
+ step: 1
14
+ tips: Number of completed training epochs.
15
+
16
+ batch_size:
17
+ key: batch_size
18
+ name: Batch size
19
+ choice_type: range
20
+ choice_value: [1, 512]
21
+ value_type: int
22
+ default: 16
23
+ step: 1
24
+ tips: Number of samples processed in one training batch.
25
+
26
+ input_size:
27
+ key: input_size
28
+ name: Input size
29
+ choice_type: s_range
30
+ choice_value: [32, 2048]
31
+ value_type: int
32
+ default: [224, 224]
33
+ step: 1
34
+ tips: Model input size in [width, height] order.
35
+
36
+ train:
37
+ learning-rate:
38
+ key: lr
39
+ name: Learning rate
40
+ choice_type: range
41
+ choice_value: [0.000001, 1.0]
42
+ value_type: float
43
+ default: 0.001
44
+ step: 0.000001
45
+ tips: Initial optimizer learning rate.
46
+
47
+ optimizer:
48
+ key: optimizer
49
+ name: Optimizer
50
+ choice_type: choice
51
+ choice_value:
52
+ - label: SGD
53
+ value: SGD
54
+ - label: Adam
55
+ value: Adam
56
+ - label: AdamW
57
+ value: AdamW
58
+ value_type: string
59
+ default: AdamW
60
+ tips: Optimizer used by the train stage.
@@ -0,0 +1,18 @@
1
+ schema_version: 1
2
+ name: resnet18-qcs6490-int16
3
+ model_id: 53
4
+ format: ONNX
5
+ chip: QCS6490/QCM6490
6
+ system: Android
7
+ framework: Qualcomm
8
+ quantized: true
9
+ configuration:
10
+ weight_type: int16
11
+ use_weight_per_channel: true
12
+ inputs:
13
+ - name: input
14
+ type: image
15
+ data_size: [224, 224]
16
+ mean: [0.485, 0.456, 0.406]
17
+ std: [0.229, 0.224, 0.225]
18
+ built_in_dataset: coco
@@ -0,0 +1,31 @@
1
+ schema_version: 1
2
+ project:
3
+ name: vehicle-detection
4
+ type: image
5
+ run:
6
+ name: baseline
7
+ type: detection
8
+ algorithm_id: 18
9
+ dataset:
10
+ dataset_id: [25, 30]
11
+ label: [cat, dog]
12
+ splits:
13
+ - task_id: 69
14
+ mode: independent
15
+ train: 1
16
+ val: 0
17
+ - task_id: 68
18
+ mode: independent
19
+ train: 0
20
+ val: 1
21
+ configuration:
22
+ # Optional overrides. Omit them to use the selected algorithm's defaults.
23
+ # epochs: 1
24
+ # batch_size: 1
25
+ # input_size: [224, 224]
26
+ # Use only stages and keys declared by `omni algorithm get 18`.
27
+ # Omitted declared values are filled from that algorithm's defaults on submit.
28
+ advanced_conf:
29
+ train:
30
+ lr: 0.1786
31
+ optimizer: SGD
@@ -0,0 +1,145 @@
1
+ # CLI commands
2
+
3
+ ```text
4
+ omni context show --output json
5
+ # Keep the account default unless the user explicitly requests a switch
6
+ omni workspace list --output json
7
+ omni workspace use <workspace_id> --output json
8
+ omni workspace reset --output json
9
+ omni dataset list --output json
10
+ omni dataset list --page 2 --page-size 50 --output json
11
+ omni dataset list --all --output json
12
+ omni dataset get <id> --output json
13
+ omni dataset create --name demo-dataset --type classification --labels cat,dog --output json
14
+ omni dataset upload ./dataset.zip --dataset-id <dataset_id> --subset-name train --output json
15
+ omni dataset upload ./dataset.zip --dataset-id <dataset_id> --subset-name train --wait --timeout 1800 --output json
16
+ # LabelMe: image and .json use the same directory and filename stem
17
+ omni dataset upload ./labelme.zip --dataset-id <dataset_id> --subset-name train --labeled-format json --output json
18
+ # Classification: images are grouped by an existing label directory
19
+ omni dataset upload ./classification.zip --dataset-id <dataset_id> --subset-name train --labeled-format folder --output json
20
+ omni task list --page-size 50 --output json
21
+ omni task list --all --output json
22
+ omni task get <id> --output json
23
+ omni algorithm list --available --output json
24
+ omni algorithm base-images --output json
25
+ omni algorithm upload --name demo-classifier --type classification --archive ./algorithm.zip --output json
26
+ omni algorithm upload --algorithm-id <id> --archive ./algorithm.zip --base-image open_platform:torch_2.7.1_cu118 --output json
27
+ omni algorithm update <algorithm_id> --file algorithm-update.yaml --output json
28
+ omni algorithm builds <algorithm_id> --all --output json
29
+ omni algorithm build-status <algorithm_id> <build_id> --output json
30
+ omni algorithm build-logs <algorithm_id> <build_id> --offset 0 --limit 200 --output json
31
+ omni train list --page-size 50 --output json
32
+ omni project list --all --output json
33
+ omni project get <project_id> --output json
34
+ omni project update <project_id> --file project-update.yaml --output json
35
+ omni resource show --output json
36
+ omni train validate --file train.yaml --output json
37
+ # Recommended two-step flow
38
+ omni train create --file train.yaml --output json
39
+ omni train update <run_id> --file train.yaml --output json
40
+ omni train submit --run-id <run_id> --output json
41
+ # Backward-compatible create-and-start shortcut
42
+ omni train submit --file train.yaml --output json
43
+ omni train status <run_id> --output json
44
+ # Detailed algorithm output from client.log (default)
45
+ omni train logs <run_id> --log-type client --output json
46
+ # Workflow-stage messages from task.log
47
+ omni train logs <run_id> --log-type task --output json
48
+ # Snapshot of both streams
49
+ omni train logs <run_id> --log-type all --output json
50
+ # Follow one stream without skipping offsets
51
+ omni train logs <run_id> --log-type client --follow --output json
52
+ omni train wait <run_id> --output json
53
+ omni train stop <run_id> --output json
54
+ omni train result <run_id> --output json
55
+ omni train download <run_id> --output-path ./artifacts/model.zip --output json
56
+ omni deploy platforms --output json
57
+ omni deploy list --all --output json
58
+ omni deploy get <deploy_id> --output json
59
+ # Create only
60
+ omni deploy create --file deploy.yaml --output json
61
+ omni deploy update <deploy_id> --file deploy.yaml --output json
62
+ # Create and start
63
+ omni deploy submit --file deploy.yaml --output json
64
+ # Start an existing deployment
65
+ omni deploy submit --deploy-id <deploy_id> --output json
66
+ omni deploy status <deploy_id> --output json
67
+ omni deploy logs <deploy_id> --offset 0 --limit 200 --output json
68
+ omni deploy wait <deploy_id> --output json
69
+ omni deploy stop <deploy_id> --output json
70
+ omni deploy download <deploy_id> --output-path ./artifacts/deployed-model.zip --output json
71
+ omni deploy sdk <deploy_id> --output-path ./artifacts/omni-sdk.zip --output json
72
+ omni deploy delete <deploy_id> --output json
73
+ ```
74
+
75
+ `--labeled-format` automatically sends `is_labeled=true`. `json` performs a
76
+ lightweight same-stem image/JSON check before upload. `folder` requires a
77
+ classification dataset with tag annotations and existing labels; each image
78
+ must be under its matching label directory, optionally below one common
79
+ wrapper directory. The CLI does not infer labeled mode from ZIP contents.
80
+
81
+ Upload completion only confirms file transfer. Labeled data import continues
82
+ in the asynchronous dataset parsing task.
83
+
84
+ Dataset creation and ZIP upload use the `dataset` API Key scope. Always take
85
+ `dataset_id` from the create response; never infer it from a name. Dataset ZIP
86
+ files are attached to a newly created subset task. Upload sessions are persisted
87
+ locally and resumed from the server's TUS offset when the same command is run
88
+ again. Keep resume enabled by default. `--restart` creates a new subset task and
89
+ does not delete the previous task. Upload completion confirms file transfer only;
90
+ parsing can still be `waiting` or `running`. Add `--wait` only when parsing
91
+ completion is required.
92
+
93
+ For a new algorithm, `--name`, `--type`, and `--archive` are required.
94
+ `--description`, `--params-file`, and `--base-image` are optional. Skill-generated
95
+ image algorithms should copy `assets/algorithm.params.example.yaml` to
96
+ `algorithm.params.yaml` and pass it explicitly with
97
+ `--params-file algorithm.params.yaml`; the CLI never searches the ZIP for it.
98
+
99
+ For an existing algorithm, use `--algorithm-id`. If `--params-file` is
100
+ provided, the CLI first calls `PATCH /api/algorithms/{id}` with the new `params`
101
+ and uploads the archive only after that succeeds. Without `--params-file`, it
102
+ keeps the existing parameters and uploads only the new source archive.
103
+ `--name`, `--type`, and `--description` remain ignored for existing algorithms.
104
+
105
+ The CLI always reads `baseImageOptions` from `GET /api/servers/options`.
106
+ An explicit `--base-image` must match one of those values. When it is omitted,
107
+ the CLI uses the single option marked with `default: true`; it never assumes
108
+ the first option is the default.
109
+
110
+ Example base image values from one platform release:
111
+
112
+ ```text
113
+ open_platform:only_cuda_12.2.2
114
+ open_platform:torch_2.7.1_cu118
115
+ open_platform:torch_2.6.0_cu118
116
+ open_platform:torch_2.5.1_cu121
117
+ open_platform:torch_2.3.1_cu121
118
+ open_platform:torch_2.1.1_cu121
119
+ open_platform:torch_1.13.1_cu116
120
+ ```
121
+
122
+ Always use the values returned by `omni algorithm base-images` rather than
123
+ copying a value from an older Skill release.
124
+
125
+ Deployment commands use the `deploy` API Key scope. `deploy create` never
126
+ starts the workflow. `deploy submit --file` creates and starts it, while
127
+ `deploy submit --deploy-id` starts an existing deployment. Keep stop and
128
+ delete as separate, explicit actions.
129
+
130
+ Update commands never change lifecycle state. Algorithm and project updates
131
+ accept only their documented metadata fields. Training and deployment updates
132
+ are accepted only while the record is `new`; their YAML files reuse the same
133
+ create contracts, and nested configuration sections are complete replacements.
134
+
135
+ REST mapping: algorithm, project, and training updates use standard
136
+ `PATCH /api/algorithms/{id}`, `PATCH /api/trains/{id}`, and
137
+ `PATCH /api/models/{id}`. Only deployment uses the dedicated
138
+ `PATCH /api/deploys/{id}/config` endpoint.
139
+
140
+ `omni train logs` accepts `--offset` and `--limit` for explicit paging. Its
141
+ default log type is `client`, which exposes algorithm stdout and per-epoch
142
+ training details stored in `client.log`. `task` reads the shorter workflow
143
+ stage log, while `all` returns separate `task` and `client` snapshots and
144
+ cannot be combined with `--follow`. With JSON output, `--follow` emits one JSON envelope per page
145
+ so callers can process the stream line by line.