Repository navigation
Add MLIA NX Learning Path - #3876
annietllnd wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
I think this is a good start but it's quite hard to follow and understand. The commands used here generic, I feel like a specific example which uses a pre made scenario and also simplified bash commands instead of multi line confusing stuff.
There was a problem hiding this comment.
That's great feedback. I think some of the multilines will be needed (like changing the GPU settings), but trying to focus on what's important and remove extracirrucular stuff :) Let's jump on a call to discuss in more detail if you have ideas on simplification after this iteration?
| --target-profile neural-technology \ | ||
| --performance \ | ||
| --profiling-data "nx-demo/captures/$CAPTURE_NAME" \ | ||
| --output-dir runs/baseline-measured |
There was a problem hiding this comment.
I think it would be good to add the model explorer command in this. Just to say something like this is best viewed with model explorer and then link to another learning path.
| layout: learningpathall | ||
| --- | ||
|
|
||
| ## Verify ADB and build Scenario Runner |
There was a problem hiding this comment.
I think a short introductory paragraph could be beneficial before launching into the steps.
| <device-serial> device | ||
| ``` | ||
|
|
||
| Your device should appear with the status `device`. If several devices are connected, set `ANDROID_SERIAL` to the intended serial. This workflow assumes that ADB can install APKs and configure GPU debug-layer settings on your device. |
There was a problem hiding this comment.
Might be worth clarifying the ANDROID_SERIAL refers to an environment variable
|
|
||
| Follow the [Scenario Runner Android build instructions](https://github.com/arm/ai-ml-sdk-scenario-runner#building-with-the-script) to build a debuggable Android arm64 APK. This experimental build needs the Android NDK, Android SDK, Gradle, and public SDK source dependencies. Use VGF Library `release/v0.11.0` to match the host tools used here. | ||
|
|
||
| Use the unmodified runner with the public Neural Statistics layer. The capture setup enables **Enable GPU debug layers**, selects the runner application, and activates `VK_LAYER_LGL_neural_statistics` through ADB. |
There was a problem hiding this comment.
This sentence seems a little out of place. Is it an instruction of what the user should do, or a description of the following steps?
|
|
||
| Use the unmodified runner with the public Neural Statistics layer. The capture setup enables **Enable GPU debug layers**, selects the runner application, and activates `VK_LAYER_LGL_neural_statistics` through ADB. | ||
|
|
||
| ## Prepare the baseline scenario on the host |
There was a problem hiding this comment.
What does 'baseline' mean here? (Perhaps this is mentioned on previous pages of the LP, I'm afraid I've only read this one page)
|
|
||
| ## Prepare the baseline scenario on the host | ||
|
|
||
| Run the remaining host commands from `mlia-demo` in the same Bash shell, and stop if any command fails. Create a separate environment for the public VGF tools and LiteRT CPU runtime. This keeps their packages separate from the tested MLIA installation: |
There was a problem hiding this comment.
" and stop if any command fails." < is this really necessary to say?
|
|
||
| ## Validate output and capture completion | ||
|
|
||
| First, check the device's output against the CPU reference: |
There was a problem hiding this comment.
As mentioned above, I'm not sure this is necessary.
| Captured dispatches: 1; warnings: [] | ||
| ``` | ||
|
|
||
| The equality check is deliberately strict. If it fails, investigate conversion, bindings, preprocessing, and your driver's documented numerical behavior. Don't silently relax it to make the test pass; assess any accepted tolerance with representative data and application accuracy requirements. Review capture warnings before using the measurements. |
There was a problem hiding this comment.
This line seems related to the output tensor reference check, rather than the neural statistics capture. Therefore it should probably be moved further up (though as I mentioned above, ideally we could get rid of this entirely)
| --output-dir runs/baseline-measured | ||
| ``` | ||
|
|
||
| The output is similar to this abbreviated result. The `<measured ...>` placeholders are numeric cycle counts in your run; their values depend on your device and workload: |
There was a problem hiding this comment.
This LP deals with a specific workload, so saying it "depends on your workload" is confusing.
Showing some representative example values here may be quite useful to give readers confidence that their data is reasonable.
| └────────────────┴────────────────────┴────────┘ | ||
| ``` | ||
|
|
||
| `Status ok` confirms that MLIA analyzed the capture. `Mode measured` and the `neural-technology-profiling-data` producer distinguish these results from the compiler estimates. The command also prints per-entity breakdowns. Some metrics, such as inference time and throughput, can be unavailable; don't interpret a missing value as zero. |
There was a problem hiding this comment.
"don't interpret a missing value as zero." < not sure this is a useful phrase
|
|
||
| The full results are saved in `runs/baseline-measured/mlia-output/mlia-output.json`. Supplying `--profiling-data` selects the measured backend automatically, so don't add `--backend nx-performance-estimator`. Use the complete schema-version-2 capture hierarchy, not the runner's timestamp JSON or a statistics file alone. | ||
|
|
||
| This synthetic-input run validates execution and profiling, not model accuracy or representative performance. For benchmarks, follow the [SDK performance guidance](https://github.com/arm/ai-ml-sdk-for-vulkan/blob/main/docs/source/performance.rst) and collect repeated runs under controlled conditions. |
There was a problem hiding this comment.
This is a good point, but doesn't really give the user enough guidance on how to use the profiling workflow along with the linked ML SDK documentation.
| source mlia-venv/bin/activate | ||
| python -m pip install --upgrade pip | ||
| python -m pip install \ | ||
| mlia==0.12.3 \ |
There was a problem hiding this comment.
this can be avoided, mlia-neural-technolody will pull the correct dependency of mlia automatically
| Install the backend from the public wheel's bundled payload: | ||
|
|
||
| ```bash | ||
| mlia backend install nx-performance-estimator |
There was a problem hiding this comment.
this is now optional, it will be installed at first run if not pre-install
|
|
||
| Keep the model in your working directory. No model binaries need to be added to the Learning Paths repository. | ||
|
|
||
| ## Convert the model before analysis |
There was a problem hiding this comment.
Why the manual step? if converter is installed that will be done automatically
There was a problem hiding this comment.
Think we wanted this to just showcase you can start with other formats too - but makes sense to remove now to simplify
| Run a compatibility check on the converted model. Use a dedicated output directory to keep this report separate from performance results: | ||
|
|
||
| ```bash | ||
| mlia check mlia-demo-models/baseline.tosamlir \ |
There was a problem hiding this comment.
in theory we could skip the conversion to tosamlir and use the tflite here instead, the beauty of MLIA is actually avoid any manual conversion
|
Thanks all, all addressed and ready for round 2 :) |
| `Status ok` confirms that MLIA analyzed the capture. The full results are saved in `runs/baseline-measured/mlia-output/mlia-output.json`. | ||
|
|
||
|
|
||
| ## (Optional) Inspect the graph with Model Explorer |
There was a problem hiding this comment.
This section shows doesn't show how to actually view the performance stats in Model Explorer, which is missing the whole point! The user doesn't need to install model explorer separately, just passing --model-explorer open is all that's needed.
There was a problem hiding this comment.
Great point - old ME habits die hard! Updated now
No description provided.