From 05c1c5a1beb8c1c17e2a06000727f9f094bc6e37 Mon Sep 17 00:00:00 2001 From: Nina Drozd Date: Tue, 22 Aug 2023 12:41:55 +0100 Subject: MLECO-4072: update MLEK dependencies to 23.08 * version updates in cmakelists file * update submodules to 23.08 versions * updates to documentation - vela 3.9.0 Change-Id: I5e24d5729ecbd2289b04fcc845fb44f455ab38d5 Signed-off-by: Nina Drozd --- CMakeLists.txt | 2 +- dependencies/cmsis | 2 +- dependencies/cmsis-dsp | 2 +- dependencies/cmsis-nn | 2 +- dependencies/core-platform | 2 +- dependencies/tensorflow | 2 +- docs/quick_start.md | 6 +- docs/sections/troubleshooting.md | 12 +- download_dependencies.py | 12 +- release_notes.txt | 4 + set_up_default_resources.py | 2 +- .../api/common/include/TensorFlowLiteMicro.hpp | 3 - source/application/api/common/source/Model.cc | 2 +- .../include/MicroMutableAllOpsResolver.hpp | 134 +++++++++++++++++++++ .../inference_runner/include/TestModel.hpp | 7 +- .../api/use_case/inference_runner/src/TestModel.cc | 4 +- 16 files changed, 167 insertions(+), 31 deletions(-) create mode 100644 source/application/api/use_case/inference_runner/include/MicroMutableAllOpsResolver.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index a6e41f9..91f31f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,7 @@ if(POLICY CMP0123) endif() project(arm_ml_embedded_evaluation_kit - VERSION 23.05.0 + VERSION 23.08.0 DESCRIPTION "ARM ML Embedded Evaluation Kit" LANGUAGES C CXX ASM) diff --git a/dependencies/cmsis b/dependencies/cmsis index e94a962..a75f017 160000 --- a/dependencies/cmsis +++ b/dependencies/cmsis @@ -1 +1 @@ -Subproject commit e94a96201a97be3e84d3d6ef081d2f0f7db9b5fd +Subproject commit a75f01746df18bb5b929dfb8dc6c9407fac3a0f3 diff --git a/dependencies/cmsis-dsp b/dependencies/cmsis-dsp index 3a04f81..8f8bb8d 160000 --- a/dependencies/cmsis-dsp +++ b/dependencies/cmsis-dsp @@ -1 +1 @@ -Subproject commit 3a04f817a4380c00ff51f9bcdc6c4e4bb7a18b80 +Subproject commit 8f8bb8d56b346274c9b2918928f2d5c3dae51758 diff --git a/dependencies/cmsis-nn b/dependencies/cmsis-nn index 61d1bb6..ebd73de 160000 --- a/dependencies/cmsis-nn +++ b/dependencies/cmsis-nn @@ -1 +1 @@ -Subproject commit 61d1bb6c4428ad730e525d0164e12df12b789985 +Subproject commit ebd73deaa9a57a8838cfb2c9dde6cc682794d2ff diff --git a/dependencies/core-platform b/dependencies/core-platform index 4db21c9..8d3074b 160000 --- a/dependencies/core-platform +++ b/dependencies/core-platform @@ -1 +1 @@ -Subproject commit 4db21c986a8aec9a1ee31479fd3ca9806781865f +Subproject commit 8d3074b0e82ed46e45d13c22a39e40388a9df8c7 diff --git a/dependencies/tensorflow b/dependencies/tensorflow index 384dd27..80cb11b 160000 --- a/dependencies/tensorflow +++ b/dependencies/tensorflow @@ -1 +1 @@ -Subproject commit 384dd272f28ea7a99f5f7c211c9791f73cdb301b +Subproject commit 80cb11b131e9738dc60b2db3e2f1f8e2425ded52 diff --git a/docs/quick_start.md b/docs/quick_start.md index cad0e8c..d9c3712 100644 --- a/docs/quick_start.md +++ b/docs/quick_start.md @@ -37,14 +37,14 @@ To get started quickly, please follow these steps: [supported by Vela](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ethos-u-vela/+/HEAD/SUPPORTED_OPS.md). ```commandline - python3 ./build_default.py + python3.9 ./build_default.py ``` > **Note** The preceding command assumes you are using the GNU Arm Embedded toolchain. If you are using the Arm > Compiler instead, you can override the default selection by executing: ```commandline - python3 ./build_default.py --toolchain arm + python3.9 ./build_default.py --toolchain arm ``` 5. Launch the project as explained in the following section: [Deployments](sections/deployment.md#deployment). In quick @@ -71,7 +71,7 @@ mkdir resources_downloaded && cd resources_downloaded python3 -m venv env env/bin/python3 -m pip install --upgrade pip env/bin/python3 -m pip install --upgrade setuptools -env/bin/python3 -m pip install ethos-u-vela==3.8.0 +env/bin/python3 -m pip install ethos-u-vela==3.9.0 cd .. curl -L https://github.com/ARM-software/ML-zoo/raw/7c32b097f7d94aae2cd0b98a8ed5a3ba81e66b18/models/anomaly_detection/micronet_medium/tflite_int8/ad_medium_int8.tflite \ diff --git a/docs/sections/troubleshooting.md b/docs/sections/troubleshooting.md index e6b921b..6841e62 100644 --- a/docs/sections/troubleshooting.md +++ b/docs/sections/troubleshooting.md @@ -6,7 +6,7 @@ - [NPU configuration mismatch error when running inference](./troubleshooting.md#npu-configuration-mismatch-error-when-running-inference) - [Errors when cloning the repository](./troubleshooting.md#errors-when-cloning-the-repository) - [Problem installing Vela](./troubleshooting.md#problem-installing-vela) - - [No matching distribution found for ethos-u-vela==3.8.0](./troubleshooting.md#no-matching-distribution-found-for-ethos_u_vela) + - [No matching distribution found for ethos-u-vela==3.9.0](./troubleshooting.md#no-matching-distribution-found-for-ethos_u_vela) - [How to update Python3 package to 3.9 version](./troubleshooting.md#how-to-update-python3-package-to-newer-version) - [Error trying to build on Arm Virtual Hardware](./troubleshooting.md#error-trying-to-build-on-arm-virtual-hardware) - [Internal Compiler Error](./troubleshooting.md#internal-compiler-error) @@ -129,15 +129,15 @@ To solve this issue install libpython3 on the system. ## No matching distribution found for ethos-u-vela -Vela 3.8.0 increases Python requirement to at least version 3.9, if not installed on your system the following error will occur: +Vela 3.9.0 increases Python requirement to at least version 3.9, if not installed on your system the following error will occur: ```log -python3 -m pip install ethos-u-vela==3.8.0 -ERROR: Could not find a version that satisfies the requirement ethos-u-vela==3.8.0 (from versions: 0.1.0, 1.0.0, 1.1.0, 1.2.0, 2.0.0, 2.0.1, 2.1.1, 3.0.0, 3.1.0, 3.2.0) -ERROR: No matching distribution found for ethos-u-vela==3.8.0 +python3 -m pip install ethos-u-vela==3.9.0 +ERROR: Could not find a version that satisfies the requirement ethos-u-vela==3.9.0 (from versions: 0.1.0, 1.0.0, 1.1.0, 1.2.0, 2.0.0, 2.0.1, 2.1.1, 3.0.0, 3.1.0, 3.2.0) +ERROR: No matching distribution found for ethos-u-vela==3.9.0 ``` -Ensure that the minimum Python 3.9 requirement is installed and it's the default version. +Ensure that the minimum Python 3.9 requirement is installed, and it's the default version. Check your current installed version of Python by running: ```commandline diff --git a/download_dependencies.py b/download_dependencies.py index b07ef0d..33c7eec 100755 --- a/download_dependencies.py +++ b/download_dependencies.py @@ -24,12 +24,12 @@ from urllib.request import urlopen from zipfile import ZipFile from pathlib import Path -TF = "https://github.com/tensorflow/tflite-micro/archive/384dd272f28ea7a99f5f7c211c9791f73cdb301b.zip" -CMSIS = "https://github.com/ARM-software/CMSIS_5/archive/e94a96201a97be3e84d3d6ef081d2f0f7db9b5fd.zip" -CMSIS_DSP = "https://github.com/ARM-software/CMSIS-DSP/archive/refs/tags/v1.14.4.zip" -CMSIS_NN = "https://github.com/ARM-software/CMSIS-NN/archive/refs/tags/v4.1.0.zip" -ETHOS_U_CORE_DRIVER = "https://git.mlplatform.org/ml/ethos-u/ethos-u-core-driver.git/snapshot/ethos-u-core-driver-23.05.tar.gz" -ETHOS_U_CORE_PLATFORM = "https://git.mlplatform.org/ml/ethos-u/ethos-u-core-platform.git/snapshot/ethos-u-core-platform-23.05.tar.gz" +TF = "https://github.com/tensorflow/tflite-micro/archive/80cb11b131e9738dc60b2db3e2f1f8e2425ded52.zip" +CMSIS = "https://github.com/ARM-software/CMSIS_5/archive/a75f01746df18bb5b929dfb8dc6c9407fac3a0f3.zip" +CMSIS_DSP = "https://github.com/ARM-software/CMSIS-DSP/archive/refs/tags/v1.15.0.zip" +CMSIS_NN = "https://github.com/ARM-software/CMSIS-NN/archive/refs/tags/23.08.zip" +ETHOS_U_CORE_DRIVER = "https://git.mlplatform.org/ml/ethos-u/ethos-u-core-driver.git/snapshot/ethos-u-core-driver-23.08.tar.gz" +ETHOS_U_CORE_PLATFORM = "https://git.mlplatform.org/ml/ethos-u/ethos-u-core-platform.git/snapshot/ethos-u-core-platform-23.08.tar.gz" def download(url_file: str, post_process=None): diff --git a/release_notes.txt b/release_notes.txt index cc34c0a..7296739 100644 --- a/release_notes.txt +++ b/release_notes.txt @@ -1,3 +1,7 @@ +Changes in 23.08 + * Support for 23.08 NPU components and dependencies (core-driver, core-platform, Vela 3.9.0, CMSIS, CMSIS-NN and TensorFlow Lite Micro). + * Update Python package requirements for compatibility reasons. + Changes in 23.05 * Support for 23.05 NPU components and dependencies (core-driver, core-platform, Vela 3.8.0, CMSIS, CMSIS-NN and TensorFlow Lite Micro). * Minor updates to CMSIS-pack dependencies. diff --git a/set_up_default_resources.py b/set_up_default_resources.py index b442432..f983508 100755 --- a/set_up_default_resources.py +++ b/set_up_default_resources.py @@ -382,7 +382,7 @@ def set_up_resources( metadata_file_path = download_dir / "resources_downloaded_metadata.json" metadata_dict = dict() - vela_version = "3.8.0" + vela_version = "3.9.0" py3_version_minimum = (3, 9) # Is Python minimum requirement matched? diff --git a/source/application/api/common/include/TensorFlowLiteMicro.hpp b/source/application/api/common/include/TensorFlowLiteMicro.hpp index 17dfd64..6957b1b 100644 --- a/source/application/api/common/include/TensorFlowLiteMicro.hpp +++ b/source/application/api/common/include/TensorFlowLiteMicro.hpp @@ -30,19 +30,16 @@ #pragma clang diagnostic ignored "-Wunused-parameter" #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/micro_interpreter.h" - #include "tensorflow/lite/micro/all_ops_resolver.h" #pragma clang diagnostic pop #elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/micro_interpreter.h" - #include "tensorflow/lite/micro/all_ops_resolver.h" #pragma GCC diagnostic pop #else #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/micro_interpreter.h" - #include "tensorflow/lite/micro/all_ops_resolver.h" #endif #include "tensorflow/lite/c/common.h" diff --git a/source/application/api/common/source/Model.cc b/source/application/api/common/source/Model.cc index da8f46b..b344a53 100644 --- a/source/application/api/common/source/Model.cc +++ b/source/application/api/common/source/Model.cc @@ -193,7 +193,7 @@ void arm::app::Model::LogInterpreterInfo() for (size_t i = 0; i < nOperators; ++i) { const tflite::Operator* op = subgraph->operators()->Get(i); const tflite::OperatorCode* opcode = opcodes->Get(op->opcode_index()); - const TfLiteRegistration_V1* reg = nullptr; + const TFLMRegistration* reg = nullptr; tflite::GetRegistrationFromOpCode(opcode, this->GetOpResolver(), ®); std::string opName; diff --git a/source/application/api/use_case/inference_runner/include/MicroMutableAllOpsResolver.hpp b/source/application/api/use_case/inference_runner/include/MicroMutableAllOpsResolver.hpp new file mode 100644 index 0000000..df55a83 --- /dev/null +++ b/source/application/api/use_case/inference_runner/include/MicroMutableAllOpsResolver.hpp @@ -0,0 +1,134 @@ +/* + * SPDX-FileCopyrightText: Copyright 2023 Arm Limited and/or its affiliates + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef INF_RUNNER_MICRO_MUTABLE_ALLOPS_RESOLVER_HPP +#define INF_RUNNER_MICRO_MUTABLE_ALLOPS_RESOLVER_HPP + +#include + +constexpr int kNumberOperators = 97; + +namespace arm { +namespace app { + + inline tflite::MicroMutableOpResolver get_resolver() { + tflite::MicroMutableOpResolver micro_op_resolver; + + micro_op_resolver.AddAbs(); + micro_op_resolver.AddAdd(); + micro_op_resolver.AddAddN(); + micro_op_resolver.AddArgMax(); + micro_op_resolver.AddArgMin(); + micro_op_resolver.AddAssignVariable(); + micro_op_resolver.AddAveragePool2D(); + micro_op_resolver.AddBatchToSpaceNd(); + micro_op_resolver.AddBroadcastArgs(); + micro_op_resolver.AddBroadcastTo(); + micro_op_resolver.AddCallOnce(); + micro_op_resolver.AddCast(); + micro_op_resolver.AddCeil(); + micro_op_resolver.AddCircularBuffer(); + micro_op_resolver.AddConcatenation(); + micro_op_resolver.AddConv2D(); + micro_op_resolver.AddCos(); + micro_op_resolver.AddCumSum(); + micro_op_resolver.AddDepthToSpace(); + micro_op_resolver.AddDepthwiseConv2D(); + micro_op_resolver.AddDequantize(); + micro_op_resolver.AddDetectionPostprocess(); + micro_op_resolver.AddDiv(); + micro_op_resolver.AddElu(); + micro_op_resolver.AddEqual(); + micro_op_resolver.AddEthosU(); + micro_op_resolver.AddExp(); + micro_op_resolver.AddExpandDims(); + micro_op_resolver.AddFill(); + micro_op_resolver.AddFloor(); + micro_op_resolver.AddFloorDiv(); + micro_op_resolver.AddFloorMod(); + micro_op_resolver.AddFullyConnected(); + micro_op_resolver.AddGather(); + micro_op_resolver.AddGatherNd(); + micro_op_resolver.AddGreater(); + micro_op_resolver.AddGreaterEqual(); + micro_op_resolver.AddHardSwish(); + micro_op_resolver.AddIf(); + micro_op_resolver.AddL2Normalization(); + micro_op_resolver.AddL2Pool2D(); + micro_op_resolver.AddLeakyRelu(); + micro_op_resolver.AddLess(); + micro_op_resolver.AddLessEqual(); + micro_op_resolver.AddLog(); + micro_op_resolver.AddLogicalAnd(); + micro_op_resolver.AddLogicalNot(); + micro_op_resolver.AddLogicalOr(); + micro_op_resolver.AddLogistic(); + micro_op_resolver.AddLogSoftmax(); + micro_op_resolver.AddMaxPool2D(); + micro_op_resolver.AddMaximum(); + micro_op_resolver.AddMean(); + micro_op_resolver.AddMinimum(); + micro_op_resolver.AddMirrorPad(); + micro_op_resolver.AddMul(); + micro_op_resolver.AddNeg(); + micro_op_resolver.AddNotEqual(); + micro_op_resolver.AddPack(); + micro_op_resolver.AddPad(); + micro_op_resolver.AddPadV2(); + micro_op_resolver.AddPrelu(); + micro_op_resolver.AddQuantize(); + micro_op_resolver.AddReadVariable(); + micro_op_resolver.AddReduceMax(); + micro_op_resolver.AddRelu(); + micro_op_resolver.AddRelu6(); + micro_op_resolver.AddReshape(); + micro_op_resolver.AddResizeBilinear(); + micro_op_resolver.AddResizeNearestNeighbor(); + micro_op_resolver.AddRound(); + micro_op_resolver.AddRsqrt(); + micro_op_resolver.AddSelectV2(); + micro_op_resolver.AddShape(); + micro_op_resolver.AddSin(); + micro_op_resolver.AddSlice(); + micro_op_resolver.AddSoftmax(); + micro_op_resolver.AddSpaceToBatchNd(); + micro_op_resolver.AddSpaceToDepth(); + micro_op_resolver.AddSplit(); + micro_op_resolver.AddSplitV(); + micro_op_resolver.AddSqrt(); + micro_op_resolver.AddSquare(); + micro_op_resolver.AddSquaredDifference(); + micro_op_resolver.AddSqueeze(); + micro_op_resolver.AddStridedSlice(); + micro_op_resolver.AddSub(); + micro_op_resolver.AddSum(); + micro_op_resolver.AddSvdf(); + micro_op_resolver.AddTanh(); + micro_op_resolver.AddTranspose(); + micro_op_resolver.AddTransposeConv(); + micro_op_resolver.AddUnidirectionalSequenceLSTM(); + micro_op_resolver.AddUnpack(); + micro_op_resolver.AddVarHandle(); + micro_op_resolver.AddWhile(); + micro_op_resolver.AddZerosLike(); + + return micro_op_resolver; + } + +} /* namespace app */ +} /* namespace arm */ + +#endif /* INF_RUNNER_MICRO_MUTABLE_ALLOPS_RESOLVER_HPP */ diff --git a/source/application/api/use_case/inference_runner/include/TestModel.hpp b/source/application/api/use_case/inference_runner/include/TestModel.hpp index 80318e6..bc6a0fb 100644 --- a/source/application/api/use_case/inference_runner/include/TestModel.hpp +++ b/source/application/api/use_case/inference_runner/include/TestModel.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright 2021 Arm Limited and/or its affiliates + * SPDX-FileCopyrightText: Copyright 2021, 2023 Arm Limited and/or its affiliates * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,6 +18,7 @@ #define INF_RUNNER_TESTMODEL_HPP #include "Model.hpp" +#include "MicroMutableAllOpsResolver.hpp" namespace arm { namespace app { @@ -26,7 +27,7 @@ namespace app { protected: /** @brief Gets the reference to op resolver interface class. */ - const tflite::AllOpsResolver& GetOpResolver() override; + const tflite::MicroMutableOpResolver& GetOpResolver() override; /** @brief Adds operations to the op resolver instance, not needed as using AllOpsResolver. */ bool EnlistOperations() override {return false;} @@ -34,7 +35,7 @@ namespace app { private: /* No need to define individual ops at the cost of extra memory. */ - tflite::AllOpsResolver m_opResolver; + tflite::MicroMutableOpResolver m_opResolver; }; } /* namespace app */ diff --git a/source/application/api/use_case/inference_runner/src/TestModel.cc b/source/application/api/use_case/inference_runner/src/TestModel.cc index 660c3e6..c69a98d 100644 --- a/source/application/api/use_case/inference_runner/src/TestModel.cc +++ b/source/application/api/use_case/inference_runner/src/TestModel.cc @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright 2021 Arm Limited and/or its affiliates + * SPDX-FileCopyrightText: Copyright 2021, 2023 Arm Limited and/or its affiliates * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,7 @@ #include "TestModel.hpp" #include "log_macros.h" -const tflite::AllOpsResolver& arm::app::TestModel::GetOpResolver() +const tflite::MicroMutableOpResolver& arm::app::TestModel::GetOpResolver() { return this->m_opResolver; } -- cgit v1.2.1