Building the ML SDK Model Converter

The build system must have:

  • CMake 3.25 or later.

  • C/C++ 17 compiler: GCC, or optionally Clang on Linux and MSVC on Windows®.

  • Python 3.10 or later. Required python libraries for building are listed in tooling-requirements.txt.

  • Ninja 1.10 or later.

The following dependencies are also needed:

For the preferred dependency versions see the manifest file.

Building with the script

Arm® provides a python build script to make build configuration options easily discoverable. When the script is run from a git-repo manifest checkout, the script uses default paths and does not require any additional arguments. Otherwise the paths to the dependencies must be specified.

To build on Linux, run:

SDK_PATH="path/to/sdk"
python3 ${SDK_PATH}/sw/model-converter/scripts/build.py -j $(nproc) \
    --vgf-lib-path ${SDK_PATH}/sw/vgf-lib \
    --flatbuffers-path ${SDK_PATH}/dependencies/flatbuffers \
    --argparse-path ${SDK_PATH}/dependencies/argparse \
    --tosa-tools-path ${SDK_PATH}/dependencies/tosa_tools \
    --external-llvm ${SDK_PATH}/dependencies/llvm-project

To build on Windows®, run:

$env:SDK_PATH="path\to\sdk"
$cores = [System.Environment]::ProcessorCount
python3 "$env:SDK_PATH\sw\model-converter\scripts\build.py" -j $cores `
    --vgf-lib-path "$env:SDK_PATH\sw\vgf-lib" `
    --flatbuffers-path "$env:SDK_PATH\dependencies\flatbuffers" `
    --argparse-path "$env:SDK_PATH\dependencies\argparse" `
    --tosa-tools-path "$env:SDK_PATH\dependencies\tosa_tools" `
    --external-llvm "$env:SDK_PATH\dependencies\llvm-project"

If the components are in their default locations, it is not necessary to specify the --vgf-lib-path, --flatbuffers-path, --argparse-path, --tosa-tools-path, and --external-llvm options.

Tests can be enabled and run with --test and linting by --lint. To enable tests and documentation building python dependencies must be installed:

pip install -r requirements.txt
pip install -r tooling_requirements.txt

The documentation can be built with --doc. To build the documentation, sphinx and doxygen must be installed on the machine.

You can install the project build artifacts into a specified location by passing the option --install with the required path.

To create an archive with the build artifacts option, add --package. The archive will be stored in the provided location.”

For more information, see the help output:

python3 scripts/build.py --help