diff options
author | Raul Farkas <raul.farkas@arm.com> | 2022-11-29 13:29:04 +0000 |
---|---|---|
committer | Raul Farkas <raul.farkas@arm.com> | 2023-01-10 10:46:07 +0000 |
commit | 5800fc990ed1e36ce7d06670f911fbb12a0ec771 (patch) | |
tree | 294605295cd2624ba63e6ad3df335a2a4b2700ab /README.md | |
parent | dcd0bd31985c27e1d07333351b26cf8ad12ad1fd (diff) | |
download | mlia-5800fc990ed1e36ce7d06670f911fbb12a0ec771.tar.gz |
MLIA-650 Implement new CLI changes
Breaking change in the CLI and API: Sub-commands "optimization",
"operators", and "performance" were replaced by "check", which
incorporates compatibility and performance checks, and "optimize" which
is used for optimization. "get_advice" API was adapted to these CLI
changes.
API changes:
* Remove previous advice category "all" that would perform all three
operations (when possible). Replace them with the ability to pass a
set of the advice categories.
* Update api.get_advice method docstring to reflect new changes.
* Set default advice category to COMPATIBILITY
* Update core.common.AdviceCategory by changing the "OPERATORS" advice
category to "COMPATIBILITY" and removing "ALL" enum type.
Update all subsequent methods that previously used "OPERATORS" to use
"COMPATIBILITY".
* Update core.context.ExecutionContext to have "COMPATIBILITY" as
default advice_category instead of "ALL".
* Remove api.generate_supported_operators_report and all related
functions from cli.commands, cli.helpers, cli.main, cli.options,
core.helpers
* Update tests to reflect new API changes.
CLI changes:
* Update README.md to contain information on the new CLI
* Remove the ability to generate supported operators support from MLIA
CLI
* Replace `mlia ops` and `mlia perf` with the new `mlia check` command
that can be used to perform both operations.
* Replace `mlia opt` with the new `mlia optimize` command.
* Replace `--evaluate-on` flag with `--backend` flag
* Replace `--verbose` flag with `--debug` flag (no behaviour change).
* Remove the ability for the user to select MLIA working directory.
Create and use a temporary directory in /temp instead.
* Change behaviour of `--output` flag to not format the content
automatically based on file extension anymore. Instead it will simply
redirect to a file.
* Add the `--json` flag to specfy that the format of the output should
be json.
* Add command validators that are used to validate inter-dependent
flags (e.g. backend validation based on target_profile).
* Add support for selecting built-in backends for both `check` and
`optimize` commands.
* Add new unit tests and update old ones to test the new CLI changes.
* Update RELEASES.md
* Update copyright notice
Change-Id: Ia6340797c7bee3acbbd26601950e5a16ad5602db
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 74 |
1 files changed, 31 insertions, 43 deletions
@@ -1,5 +1,5 @@ <!--- -SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. +SPDX-FileCopyrightText: Copyright 2022-2023, Arm Limited and/or its affiliates. SPDX-License-Identifier: Apache-2.0 ---> # ML Inference Advisor - Introduction @@ -96,10 +96,8 @@ mlia [sub-command] [arguments] Where the following sub-commands are available: -* ["operators"](#operators-ops): show the model's operator list -* ["optimization"](#model-optimization-opt): run the specified optimizations -* ["performance"](#performance-perf): measure the performance of inference on hardware -* ["all_tests"](#all-tests-all): have a full report +* ["check"](#check): perform compatibility or performance checks on the model +* ["optimize"](#optimize): apply specified optimizations Detailed help about the different sub-commands can be shown like this: @@ -113,25 +111,27 @@ The following sections go into further detail regarding the usage of MLIA. This section gives an overview of the available sub-commands for MLIA. -## **operators** (ops) +## **check** -Lists the model's operators with information about their compatibility with the -specified target. +### compatibility + +Default check that MLIA runs. It lists the model's operators with information +about their compatibility with the specified target. *Examples:* ```bash # List operator compatibility with Ethos-U55 with 256 MAC -mlia operators --target-profile ethos-u55-256 ~/models/mobilenet_v1_1.0_224_quant.tflite +mlia check ~/models/mobilenet_v1_1.0_224_quant.tflite --target-profile ethos-u55-256 # List operator compatibility with Cortex-A -mlia ops --target-profile cortex-a ~/models/mobilenet_v1_1.0_224_quant.tflite +mlia check ~/models/mobilenet_v1_1.0_224_quant.tflite --target-profile cortex-a # Get help and further information -mlia ops --help +mlia check --help ``` -## **performance** (perf) +### performance Estimate the model's performance on the specified target and print out statistics. @@ -140,18 +140,21 @@ statistics. ```bash # Use default parameters -mlia performance ~/models/mobilenet_v1_1.0_224_quant.tflite +mlia check ~/models/mobilenet_v1_1.0_224_quant.tflite \ + --target-profile ethos-u55-256 \ + --performance -# Explicitly specify the target profile and backend(s) to use with --evaluate-on -mlia perf ~/models/ds_cnn_large_fully_quantized_int8.tflite \ - --evaluate-on "Vela" "Corstone-310" \ - --target-profile ethos-u65-512 +# Explicitly specify the target profile and backend(s) to use with --backend +mlia check ~/models/ds_cnn_large_fully_quantized_int8.tflite \ + --target-profile ethos-u65-512 \ + --performance \ + --backend "Vela" "Corstone-310" # Get help and further information -mlia perf --help +mlia check --help ``` -## **optimization** (opt) +## **optimize** This sub-command applies optimizations to a Keras model (.h5 or SavedModel) and shows the performance improvements compared to the original unoptimized model. @@ -175,35 +178,20 @@ supported. ```bash # Custom optimization parameters: pruning=0.6, clustering=16 -mlia optimization \ - --optimization-type pruning,clustering \ - --optimization-target 0.6,16 \ - ~/models/ds_cnn_l.h5 - -# Get help and further information -mlia opt --help -``` - -## **all_tests** (all) - -Combine sub-commands described above to generate a full report of the input -model with all information available for the specified target. E.g. for Ethos-U -this combines sub-commands *operators* and *optimization*. Therefore most -command line arguments are shared with other sub-commands. - -*Examples:* - -```bash -# Create full report and save it as JSON file -mlia all_tests --output ./report.json ~/models/ds_cnn_l.h5 +mlia optimize ~/models/ds_cnn_l.h5 \ + --target-profile ethos-u55-256 \ + --pruning \ + --pruning-target 0.6 \ + --clustering \ + --clustering-target 16 # Get help and further information -mlia all --help +mlia optimize --help ``` # Target profiles -Most sub-commands accept the name of a target profile as input parameter. The +All sub-commands require the name of a target profile as input parameter. The profiles currently available are described in the following sections. The support of the above sub-commands for different targets is provided via @@ -232,7 +220,7 @@ attributes: Example: ```bash -mlia perf --target-profile ethos-u65-512 ~/model.tflite +mlia check ~/model.tflite --target-profile ethos-u65-512 --performance ``` Ethos-U is supported by these backends: |