aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRuomei Yan <ruomei.yan@arm.com>2023-02-20 15:32:54 +0000
committerBenjamin Klimczak <benjamin.klimczak@arm.com>2023-10-11 15:42:28 +0100
commit446c379c92e15ad8f24ed0db853dd0fc9c271151 (patch)
treefb9e2b20fba15d3aa44054eb76d76fbdb1459006 /README.md
parentf0b8ed75fed9dc69ab1f6313339f9f7e38bfc725 (diff)
downloadmlia-446c379c92e15ad8f24ed0db853dd0fc9c271151.tar.gz
Add a CLI component to enable rewrites
* Add flags for rewrite (--rewrite, --rewrite-start, --rewrite-end, --rewrite-target) * Refactor CLI interfaces to accept tflite models with optimize for rewrite, keras models with optimize for clustering and pruning * Refactor and move common.py and select.py out of the folder nn/tensorflow/optimizations * Add file nn/rewrite/core/rewrite.py as placeholder * Update/add unit tests * Refactor OptimizeModel in ethos_u/data_collection.py for accepting tflite model case * Extend the logic so that if "--rewrite" is specified, we don't add pruning to also accept TFLite models. * Update README.md Resolves: MLIA-750, MLIA-854, MLIA-865 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com> Change-Id: I67d85f71fa253d2bad4efe304ad8225970b9622c
Diffstat (limited to 'README.md')
-rw-r--r--README.md24
1 files changed, 19 insertions, 5 deletions
diff --git a/README.md b/README.md
index 725af53..7a879a9 100644
--- a/README.md
+++ b/README.md
@@ -158,10 +158,11 @@ mlia check --help
## **optimize**
-This sub-command applies optimizations to a Keras model (.h5 or SavedModel) and
-shows the performance improvements compared to the original unoptimized model.
+This sub-command applies optimizations to a Keras model (.h5 or SavedModel) or
+a TensorFlow Lite model and shows the performance improvements compared to
+the original unoptimized model.
-There are currently two optimization techniques available to apply:
+There are currently three optimization techniques available to apply:
* **pruning**: Sets insignificant model weights to zero until the specified
sparsity is reached.
@@ -172,9 +173,13 @@ More information about these techniques can be found online in the TensorFlow
documentation, e.g. in the
[TensorFlow model optimization guides](https://www.tensorflow.org/model_optimization/guide).
+* **rewrite**: Replaces certain subgraph/layer of the pre-trained model with
+ candidates from the rewrite library, with or without training using a
+ small portion of the training data, to achieve local performance gains.
+
**Note:** A ***Keras model*** (.h5 or SavedModel) is required as input to
-perform the optimizations. Models in the TensorFlow Lite format are **not**
-supported.
+perform pruning and clustering. A ***TensorFlow Lite model*** is required as input
+to perform a rewrite.
*Examples:*
@@ -189,6 +194,15 @@ mlia optimize ~/models/ds_cnn_l.h5 \
# Get help and further information
mlia optimize --help
+
+# An example for using rewrite
+mlia optimize ~/models/ds_cnn_large_fp32.tflite \
+ --target-profile ethos-u55-256 \
+ --rewrite \
+ --dataset input.tfrec \
+ --rewrite-target fully_connected \
+ --rewrite-start MobileNet/avg_pool/AvgPool \
+ --rewrite-end MobileNet/fc1/BiasAdd
```
# Target profiles