add ONNX sanitize required for Ultralytics
This commit is contained in:
@@ -227,6 +227,23 @@ The command downloads the job's `model.tar.gz`, finds `model.onnx`, uploads it t
|
||||
compilation, validation, and profiling. The uploaded source model uses the configured
|
||||
`aihub.model_name`.
|
||||
|
||||
The training example sanitizes the Ultralytics ONNX export before saving `model.onnx`. This removes graph input or
|
||||
output names, such as `output0`, that are duplicated in the ONNX `value_info` metadata and rejected by AI Hub.
|
||||
|
||||
For a model already downloaded by a failed upload attempt, sanitize the extracted ONNX file and retry using the local
|
||||
model. Replace the job name in both paths:
|
||||
|
||||
```bash
|
||||
uv run --with onnx python examples/meter-detection/source/sanitize_onnx.py \
|
||||
build/qai-hub/meter-detection/qc-cli-YYYYMMDD-HHMMSS/source/extracted/model.onnx \
|
||||
--output build/qai-hub/meter-detection/model.aihub.onnx
|
||||
|
||||
qc-cli ai-hub upload \
|
||||
examples/meter-detection/data/aihub_calibration \
|
||||
examples/meter-detection/data/inputs.npz \
|
||||
--onnx-path build/qai-hub/meter-detection/model.aihub.onnx
|
||||
```
|
||||
|
||||
If the meter-detection job is still the last training job in `.qc-cli.json`, `--from-job` can be omitted. Keeping it
|
||||
explicit prevents accidentally uploading an artifact from a different training run.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user