aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
6 daysfeat: Add custom pre-commit hook to check for updated Copyright headerHEADmainBenedetta Delfino
Signed-off-by: Benedetta Delfino <benedetta.delfino@arm.com> Change-Id: Ic6a07ef12868673466a5db0cbce08015b9df4ffc
13 daysfeat: Implement the clustering rewrite for int8Nathan Bailey
Implements a clustering rewrite for fully connected layers for int8 models Resolves: MLIA-1080 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: If48efb22764187a382e5b84bbb5c3b75a6e71b75
13 daysfeat: Implement the clustering rewrite for fp32Nathan Bailey
Implements a clustering rewrite for fully connected layers for fp32 models Resolves: MLIA-1079 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: I4c12f0bf911219b4066f0760976e424ebe900a0b
13 daysfeat: CLI and API changes for the clustering rewriteNathan Bailey
Adds API changes for a fully-connected-clustering rewrite Resolves: MLIA-1077 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: I845796a391c5020e66472456b97ecad5ee8139a8
2024-04-12fix: Change training_parameters to return empty list instead of list of None ↵Nathan Bailey
if needed. Extension to MLIA-1004 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: Ib40c2e5932c1210a1d141200815a76e33f5ab078
2024-04-12fix: Pin h5py + TF dependency to fix issue on aarch64Gergely Nagy
Worked around dependency issue on aarch64, due to this bug: https://github.com/h5py/h5py/issues/2408. When the bug is fixed, this commit can be reverted. Pinning the following dependencies: * tensorflow==2.15.1 * h5py==3.10.0 Change-Id: Iada706c403f14d29735e9abea986427bbdae0660 Signed-off-by: Gergely Nagy <gergely.nagy@arm.com>
2024-04-04build: Fix changelog generation with missing commit typesGergely Nagy
Update commitizen config to include all the commit types into the changelog, that are currently accepted by the commit message verification. Change-Id: Iffc975bff9c44ea202b109bd488ba1c9d5e19bd6
2024-04-04feat: Implement int8 sparsity 2:4 rewriteMadeleine Dunn
- Implement pruning-preserving quantisation aware training - Rework the training logic to avoid duplication - Remove the DynamicallyLoadedRewrite class as it is now unused Resolves: MLIA-1003 Signed-off-by: Madeleine Dunn <madeleine.dunn@arm.com> Change-Id: Ia7a4acf5f477a27963cffa88180cca085b32ffe4
2024-04-03feat: Implement fp32 sparsity 2:4 rewriteMadeleine Dunn
- Update the existing placeholder with code to prune the given model Resolves: MLIA-1002 Signed-off-by: Madeleine Dunn <madeleine.dunn@arm.com> Change-Id: I76b0e0bfe81be5e57d518cd7bb588eef76a11641
2024-04-03feat: Add placeholder rewrite_target for sparsity24Madeleine Dunn
- The placeholder currently duplicates the existing fc target Resolves: MLIA-1000 Signed-off-by: Madeleine Dunn <madeleine.dunn@arm.com> Change-Id: I0df5d47e61dafa567e212566bbcb0f1639fe7642
2024-04-03feat: Implement sparsityMadeleine Dunn
- Add a placeholder file and registry option for sparsity Resolves: MLIA-999 Signed-off-by: Madeleine Dunn <madeleine.dunn@arm.com> Change-Id: I273192ba6813309f5226e3d8e0b686ce87ee6b79
2024-03-28fix: Check that training checkpoint feature works as expectedNathan Bailey
Fixes the checkpoint feature in training and also completes unit tests for it Resolves: MLIA-1111 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: Ic2b84b4b045db5ba3cb299fcd137ae9d31df5298
2024-03-28feat: Update Vela versionNathan Bailey
Updates Vela Version to 3.11.0 and TensorFlow version to 2.15.1 Required keras import to change: from keras.api._v2 import keras needed instead of calling tf.keras Subsequently tf.keras.X needed to change to keras.X Resolves: MLIA-1107 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: I53bcaa9cdad58b0e6c311c8c6490393d33cb18bc
2024-03-27fix: Update rewrite target nameMadeleine Dunn
- Rename "fully_connected" to "fully-connected" - This will resolve issues with upstreaming rewrite library changes Signed-off-by: Madeleine Dunn <madeleine.dunn@arm.com> Change-Id: I2f24ae4917a556fd0bd44f0db6ee4e0f7a68cd24
2024-03-22refactor: Backend dependencies and moreBenjamin Klimczak
- Add backend dependencies: One backend can now depend on another backend. - Re-factor 'DownloadArtifact': - Rename 'DownloadArtifact' to 'DownloadConfig' - Remove attributes 'name' and 'version' not relevant for downloads - Add helper properties: - 'filename' parses the URL to extract the file name from the end - 'headers' calls the function to generate a HTML header for the download - Add OutputLogger helper class - Re-factor handling of backend configurations in the target profiles. Change-Id: Ifda6cf12c375d0c1747d7e4130a0370d22c3d33a Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2024-03-21refactor: Refactored functions for Corstone installationsBenedetta Delfino
Signed-off-by: Benedetta Delfino <benedetta.delfino@arm.com> Change-Id: I51f845e9fc9f0a699a239c63c268565487be2aeb
2024-03-19feat: Add e2e optimization profileNathan Bailey
Adds optimization profile to the tests_e2e directory: - Enables the number of steps to be configured to reduce e2e runtime Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: I1433c75b22916a3fa640917bc18175607ac24755
2024-03-14feat: Enable rewrite parameterisationNathan Bailey
Enables user to provide a toml or default profile to change training settings for rewrite optimization Resolves: MLIA-1004 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: I3bf9f44b9a2062fb71ef36eb32c9a69edcc48061
2024-03-14feat: Update Corstone-300 version to 11.24_13Benedetta Delfino
Signed-off-by: Benedetta Delfino <benedetta.delfino@arm.com> Change-Id: I0918c0c323328348e8f605ce20b81840b5c65a81
2024-03-13fix: Relax filtering during archive installationBenjamin Klimczak
- Relax the filtering when unpacking an archive - Add unit tests for the filtering Resolves: MLIA-1042 Change-Id: I8acd6a1596bef1c624a8fc67cdfbac961e0b179d
2024-03-11feat: Add support for Arm Corstone-300 and Corstone-310 on AArch64Benedetta Delfino
- Add support for Corstone-300 download on AArch64 - Add support for Corstone-310 download on AArch64 - Add support for Corstone-310 download on x86 - Add e2e tests and unit tests - Edited README.md to reflect updates Resolves: MLIA-1017 Signed-off-by: Benedetta Delfino <benedetta.delfino@arm.com> Change-Id: I8d54a721f91d67123f65c076313cef12b7df92bd
2024-03-08fix: bugfix argparse e2e testsBenedetta Delfino
Argparse in the e2e tests was set up such that if the model name was specified after the backend, the model itself would be recognised as an invalid backend and the test skipped. Fixed this behavior Resolves: MLIA-1101 Signed-off-by: Benedetta Delfino <benni.delfino@arm.com> Change-Id: I645992379adfcb13a72b946c713d5a0be429fca8
2024-03-07fix: Retry flaky test up to four timesAnnie Tallund
- We have seen flaky tests failing on retrying - Increasing the number of tries to see if it resolves the issue Signed-off-by: Annie Tallund <annie.tallund@arm.com> Change-Id: I15f304a3b7e0e1b15c8e3b8fe22ffacb86f1eda0
2024-02-23refactor: Migrate from Vela's internal code to CSV summaryNathan Bailey
Removes vela defines from vela compiler.py and performance.py Replaces calls to vela code with data from vela summary csv Resolves: MLIA-1024 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: I569878f2936767f70c0255919ca40d1969275529
2024-02-14docs: Update RELEASES.md for release 0.8.00.8.0-rc.10.8.0Benjamin Klimczak
Resolves: MLIA-1074 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com> Change-Id: Id23da33fefbe5ef61b2e507f6c7706e3ed3d0bef
2024-02-09feat: Integrate Vela's per-layer performance estimatesNathan Bailey
Resolves: MLIA-1055, MLIA-1056, MLIA-1057 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: Id573cec94e4a69117051dcd5175f383c0955d890
2024-01-23fix: Improve error handling for invalid fileAnnie Tallund
If a file has the right extension, MLIA previously tried to load files with invalid content, resulting in confusing errors. This patch adds better reporting for that scenario Resolves: MLIA-1051 Signed-off-by: Annie Tallund <annie.tallund@arm.com> Change-Id: I3f1fd578906a73a58367428f78409866f5da7836
2024-01-23build: Integrate Commitizen to check commit messages and generate changelogGergely Nagy
The commit messages are checked against the Conventional Commits (https://www.conventionalcommits.org) specification, along with minor customizations (eg, capitalized header, some irrelevant commit types removed Checking messages is integrated into `tox -e lint`. Changelog generation is integrated into "tox -e changelog", which runs `cz changelog` command underneath and incrementally updates RELEASES.md. Change-Id: I86f21f6c78a166d3bb92450a027a2d7e71ce22cf Signed-off-by: Gergely Nagy <gergely.nagy@arm.com>
2023-12-07MLIA-835 Invalid JSON outputGergely Nagy
TFLiteConverter was producing log messages in the output that was not possible to capture and redirect to logging. The solution/workaround is to run it as a subprocess. This change required some refactoring around existing invocations of the converter. Change-Id: I394bd0d49d36e6686cfcb9d658e4aad05326cb87 Signed-off-by: Gergely Nagy <gergely.nagy@arm.com>
2023-12-04Update to Vela 3.10, TensorFlow 2.14, Python 3.9Benjamin Klimczak
Updating to Vela 3.10 which requires TensorFlow 2.14 which requires Python 3.9 (dropping support for Python 3.8). Resolves: MLIA-997 Change-Id: Id60bd08f7156a8efa204ef71ba81590edf0e3b28 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-12-04MLIA-136 Add flaky dependency for unstable testsAnnie Tallund
- https://github.com/box/flaky - Is set to re-run tests marked with @flaky - Provides a report on failures - Add flaky guard to tests/test_nn_tensorflow_optimizations_clustering.py Signed-off-by: Annie Tallund <annie.tallund@arm.com> Change-Id: I6795fd8bb2c38be6513f3689c3eeb805e7976add
2023-11-24MLIA-1037 Fix default backend validationBenjamin Klimczak
Add a check to see if the default backends are installed when no backend is provided via CLI. Change-Id: I27dd9f35cfeec187f44cba06915d1be5a3a052b5 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-11-22MLIA-963: Capture and handle Vela warningMichiel Olieslagers
Signed-off-by: Gergely Nagy <gergely.nagy@arm.com> Change-Id: I6c8b0b74d6d35261eb0ff1a37b9577f9033be8f9
2023-11-16MLIA-136 Update RELEASES.md with pruning test issueAnnie Tallund
Signed-off-by: Annie Tallund <annie.tallund@arm.com> Change-Id: I2b2383533578b815372e26f01d6066b4a9b39df0
2023-11-16MLIA-790 Update README.mdAnnie Tallund
- New overview on Arm MLIA Signed-off-by: Annie Tallund <annie.tallund@arm.com> Change-Id: I7da120aefb23ac6434c99c41e65a051f4a0bd8fa
2023-11-15Add linters/checkers for TOML files to pre-commitsBenjamin Klimczak
Change-Id: I8a228cbab405b4d4112e5e38856b3cb92304cba7 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-11-03Fix PytestCollectionWarning in unit testsBenjamin Klimczak
Rename 'TestTrainingParameters' to 'MockTrainingParameters' to avoid a PytestCollectionWarning during test parsing Change-Id: I26b52d46aa71bcc6748e38e92331be21a667e8c9 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-10-31MLIA-1019 Fix rebase artifactGergely Nagy
Fixed an artifact that crept in during the upstream rebase process, change a6ae703b6e41c73 was being taken out, but 3cd84481fa25 reintroduced the first part of a try/except block which caused a syntax error. Change-Id: I7fc2e18a227a30ebaaee0763450ee68646611add Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-10-11Enable rewrites for quantized input modelsBenjamin Klimczak
If the input model for rewriting is quantized: - Record de-quantized TFRecords - enable writing de-quantized calibration data for the training - re-generate augmented training data, if needed - Use quantization-aware training (QAT) to train the replacement models - Check if replacement model is quantized: If source model is quantized, we make sure rewrite's output model is quantized too. Right now, only int8 is supported so raising an error if any other datatype is present in the output. Resolves: MLIA-907, MLIA-908, MLIA-927 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com> Change-Id: Icb4070a9e6f1fdb5ce36120d73823986e89ac955
2023-10-11Re-factoring of rewrite management & added metricsGergely Nagy
- List available rewrites - Refactor/rename 'Rewrite' class to 'RewritingOptimizer' - Introduce a registry for rewrite functions - Refactor 'Rewriter' to use the registry to look up rewrite functions - Remove mentions of hardcoded "fully_connected" from CLI help and error messages, using the registry instead - Add unit tests - Enable rewrites for all targets: Extract optimization (including rewrite specific code) from the Ethos-U-specific data collector into OptimizingDataCollector. This is reused in other targets' collectors, such as TOSA and Cortex-A. - Add more logging for rewrite - add display of MAE and NRMSE values for the trained result - add total model MAE and NRMSE metric Resolves: MLIA-891, MLIA-899, MLIA-906 Change-Id: Ie798749e1ed60cab14fdb6d9c2271c833960e93f Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-10-11Bug-fixes and re-factoring for the rewrite moduleBenjamin Klimczak
- Fix input shape of rewrite replacement: During and after training of the replacement model for a rewrite the Keras model is converted and saved in TensorFlow Lite format. If the input shape does not match the teacher model exactly, e.g. if the batch size is undefined, the TFLiteConverter adds extra operators during conversion. - Fix rewritten model output - Save the model output with the rewritten operator in the output dir - Log MAE and NRMSE of the rewrite - Remove 'verbose' flag from rewrite module and rely on the logging mechanism to control verbose output. - Re-factor utility classes for rewrites - Merge the two TFLiteModel classes - Move functionality to load/save TensorFlow Lite flatbuffers to nn/tensorflow/tflite_graph - Fix issue with unknown shape in datasets After upgrading to TensorFlow 2.12 the unknown shape of the TFRecordDataset is causing problems when training the replacement models for rewrites. By explicitly setting the right shape of the tensors we can work around the issue. - Adapt default parameters for rewrites. The training steps especially had to be increased significantly to be effective. Resolves: MLIA-895, MLIA-907, MLIA-946, MLIA-979 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com> Change-Id: I887ad165aed0f2c6e5a0041f64cec5e6c5ab5c5c
2023-10-11Implement first rewrite (proof of concept)Ruomei Yan
* Define replacement function fully_connected layer * Define RewriteConfiguration and Rewriter to integrate rewrite module into mlia optimize command * Fix a bug in the ethos_u/data_collection.py file * Fix a bug in join.py * Remove diff_stats and use diff instead, added related changes around this to ensure e2e tests passing * Add unit tests for all changes * Fix bug in diff_stats function * The bug was caused by a dividing by numpy array of all zeros. The previous way of handling it did not consider the all zeros case but only dealt with partially zeros * unit tests added. * Fix the bug in rewrite/core/graph_edit/join.py * Remove the possibility of passing None to append_relabel function because it is immutable * The bug happened when empty dictionary was passed in the append_relabel function and the function overwrites the reference of operator_map which caused the dictionary was not updated after the function call Resolves: MLIA-749, MLIA-864, MLIA-866 Change-Id: I1ab426996232f182345e6e98033d5dcb32aea08c Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-10-11Adapt rewrite module to MLIA coding standardsAnnie Tallund
- Fix imports - Update variable names - Refactor helper functions - Add licence headers - Add docstrings - Use f-strings rather than % notation - Create type annotations in rewrite module - Migrate from tqdm to rich progress bar - Use logging module in rewrite module: All print statements are replaced with logging module Resolves: MLIA-831, MLIA-842, MLIA-844, MLIA-846 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com> Change-Id: Idee37538d72b9f01128a894281a8d10155f7c17c
2023-10-11MLIA-843 Add unit tests for module mlia.nn.rewriteBenjamin Klimczak
Note: The unit tests mostly call the main functions from the respective modules only. Change-Id: Ib2ce5c53d0c3eb222b8b8be42fba33ac8e007574 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-10-11Add a CLI component to enable rewritesRuomei Yan
* 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
2023-10-11MLIA-845 Migrate rewrite codeAnnie Tallund
- Add required files for rewriting of TensorFlow Lite graphs - Adapt rewrite dependency paths and project name - Add license headers Change-Id: I19c5f63215fe2af2fa7d7d44af08144c6c5f911c Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-09-29MLIA-984 Pin 'build' package to ~=0.10.0Benjamin Klimczak
The recent update to version 1.0.3 causes issues when building. Change-Id: I74db3b419ece7b744cbb48c8e11096e99709a9cd Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-09-26MLIA-469 Support batch size > 1 for optimizationsAnnie Tallund
- Add a PruningPolicy to skip layers that are not supported by the Keras pruning API - Make dataset generation more generic to support use-cases beyond classification Signed-off-by: Annie Tallund <annie.tallund@arm.com> Change-Id: I198dae2b53860f449f2fdbc71575babceed1ffcf
2023-09-08MLIA-961 Update pre-commit hook versionsBenjamin Klimczak
- Update dependencies in .pre-commit.yaml - Fix code issues with new linters Change-Id: I36964ecf1a405dd8faac01b4470b56122a7cad17 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>
2023-09-05MLIA-961 Update tox dependenciesBenjamin Klimczak
- Update version dependencies in the tox.ini - Fix linter issues Change-Id: I04c3a841ee2646a865dab037701d66c28792f2a4 Signed-off-by: Benjamin Klimczak <benjamin.klimczak@arm.com>