Skip to content

Commit cadd1a0

Browse files
authored
Merge branch 'ArmDeveloperEcosystem:main' into main
2 parents 301d884 + c498e0d commit cadd1a0

88 files changed

Lines changed: 3845 additions & 737 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.wordlist.txt

Lines changed: 415 additions & 374 deletions
Large diffs are not rendered by default.

content/learning-paths/cross-platform/multimodel_mnn_v9/1_mnn_v9.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,26 @@ layout: learningpathall
44
weight: 2
55
---
66

7-
## Introduction
7+
## Understand MNN and multimodal inference on Armv9
88

9-
This section introduces the software stack used throughout this Learning Path. You will use **[MNN](https://github.com/alibaba/MNN)** to run a prebuilt **Omni multimodal model** on an Armv9 Linux system using only the CPU.
9+
This section introduces the software stack used throughout this Learning Path. You will use **[MNN](https://github.com/alibaba/MNN)** (Mobile Neural Network), a lightweight inference engine, to run a prebuilt **Omni multimodal model** on an Armv9 Linux system using only the CPU.
1010

11-
By the end of this section, you will understand why this combination is a practical starting point for reproducible multimodal inference on Armv9, and use retail restocking workflow as an example combines local image and audio inputs use case.
11+
By the end of this section, you'll understand why this combination is a practical starting point for reproducible multimodal inference on Armv9. A retail restocking workflow that combines local image and audio inputs is used as the example throughout.
1212

1313
## Why use MNN on Armv9
1414

15-
MNN is a lightweight inference engine designed for deployment across mobile, embedded, and edge platforms. It is a good fit for this Learning Path for four reasons:
15+
MNN is a lightweight inference engine designed for deployment across mobile, embedded, and edge platforms. It's a good fit for this Learning Path for four reasons:
1616

17-
- It provides a **portable runtime** that can be built and reused across different eevice classes.
18-
- It supports a **CPU-first deployment flow**, which is useful when you want to validate multimodal inference on Armv9 without depending on a discrete GPU or dedicated accelerator.
19-
- Native builds can take advantage of **Armv9-specific CPU features and optimizations** when they are enabled in the build, making this a practical path for efficient local inference.
20-
- The same runtime approach can be reused across **Arm Linux, Android, iOS, and x86-based development hosts**, which improves portability from development to deployment.
17+
- Provides a **portable runtime** that can be built and reused across different device classes
18+
- Supports a **CPU-first deployment flow**, useful when you want to validate multimodal inference on Armv9 without depending on a discrete GPU or dedicated accelerator
19+
- Native builds take advantage of **Armv9-specific CPU features and optimizations** when enabled in the build, making this a practical path for efficient local inference
20+
- The same runtime approach can be reused across **Arm Linux, Android, iOS, and x86-based development hosts**, improving portability from development to deployment
2121

2222
For this Learning Path, MNN gives you a practical way to build a reproducible multimodal inference workflow on Armv9 while keeping the software stack compact and deployment-oriented.
2323

24-
A retail restocking workflow is also a good use case example for Arm because it benefits from local CPU execution, simple deployment, and the ability to process store inputs close to where they are captured.
25-
2624
## Why use an Omni multimodal model
2725

28-
An Omni model combines **text, image, and audio** understanding in a single inference pipeline. This makes it useful for building compact edge applications that need to reason over more than one input type.
26+
An Omni model combines **text, image, and audio** understanding in a single inference pipeline, making it useful for building compact edge applications that need to reason over more than one input type.
2927

3028
In this Learning Path, you use the model to:
3129

@@ -51,6 +49,12 @@ To keep the workflow reproducible, this Learning Path uses a deliberately narrow
5149

5250
This scope keeps the focus on setup, validation, and multimodal application flow.
5351

54-
## Next steps
52+
## What you've learned and what's next
53+
54+
In this section, you learned:
55+
56+
- Why MNN is a practical inference engine for multimodal workflows on Armv9
57+
- How an Omni model combines text, image, and audio understanding in one pipeline
58+
- The deliberate scope choices that keep this Learning Path reproducible and focused on CPU-first inference
5559

56-
In the next section, you will build MNN on Armv9 and prepare the model files and local assets used in the remaining examples.
60+
In the next section, you'll build MNN natively on Armv9 and prepare the model files and local assets used in the remaining examples.

content/learning-paths/cross-platform/multimodel_mnn_v9/2_mnn_build.md

Lines changed: 69 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ weight: 3
44
layout: learningpathall
55
---
66

7-
## Introduction
7+
## Build MNN for Armv9 multimodal inference
88

9-
In this module you will build **MNN** natively on your Arm v9 Linux system and verify that the `llm_demo` binary can load a **prebuilt Omni MNN model package**. This sets up everything needed for the text, vision, and audio demos in later modules.
9+
In this section, you'll build **MNN** natively on your Armv9 Linux system and verify that the `llm_demo` binary can load a prebuilt Omni MNN model package. This sets up everything needed for the text, vision, and audio demos in later sections.
1010

11-
This module uses a native **CPU-only** MNN build on Armv9. That is a deliberate design choice, not a fallback. The goal is to show how a compact, reproducible, deployment-friendly software stack can run directly on an Armv9 CPU without depending on a discrete GPU or separate accelerator.
11+
This section uses a native CPU-only MNN build on Armv9 a deliberate design choice, not a fallback. The goal is to show how a compact, reproducible, deployment-friendly software stack can run directly on an Armv9 CPU without depending on a discrete GPU or separate accelerator.
1212

13-
At the end of this module, you will have:
13+
At the end of this section, you'll have:
1414

1515
- a working `llm_demo` binary
1616
- a validated model directory that includes `config.json`
1717
- a runtime environment that resolves the correct MNN shared libraries
18+
- the required Omni model files available locally
1819

1920
## Create a workspace
2021

@@ -25,13 +26,13 @@ mkdir -p ~/mnn
2526
cd ~/mnn
2627
```
2728

28-
## Why build natively on Armv9 first
29+
## Why build natively on Armv9
2930

30-
This Learning Path uses a native build on the target Armv9 system before introducing any cross-compilation workflow. Building directly on the target helps reduce environment drift, makes library and toolchain issues easier to diagnose, and lets you validate the runtime in the same environment where you will execute the model.
31+
Building, running inference, and deploying all happen directly on the Armv9 device. There's no cross-compilation involved. This keeps the toolchain simple, eliminates environment drift between build and target, and means any library or configuration issue you encounter is the same one you'd hit in production.
3132

32-
A native-first approach also makes it easier to confirm that the final binary, shared libraries, and model assets work together correctly on the Armv9 platform. For a reproducible Learning Path, this is usually the fastest way to get to a working baseline before optimizing or automating the workflow further.
33+
Building on the target also makes it straightforward to confirm that the binary, shared libraries, and model assets all resolve correctly in the same environment where you will run the model.
3334

34-
## Build MNN natively on Armv9
35+
## Build MNN
3536

3637
Clone the MNN repository:
3738

@@ -40,14 +41,22 @@ git clone https://github.com/alibaba/MNN.git
4041
cd MNN
4142
```
4243

43-
Configure and build MNN with LLM, audio, and Omni support enabled:
44+
Install the required build dependencies:
4445

4546
```bash
47+
sudo apt update
48+
sudo apt install -y build-essential gcc g++ cmake
49+
```
50+
51+
Configure and build MNN with LLM, audio, and Omni support enabled:
4652

47-
rm -rf build
53+
```bash
4854
mkdir build && cd build
55+
```
4956

57+
```bash
5058
cmake .. \
59+
-DCMAKE_BUILD_TYPE=Release \
5160
-DMNN_BUILD_SHARED=ON \
5261
-DMNN_BUILD_LLM=ON \
5362
-DMNN_BUILD_AUDIO=ON \
@@ -84,11 +93,17 @@ If your system already has another MNN installation, `llm_demo` can load a diffe
8493
From the build directory, inspect the runtime dependencies:
8594

8695
```bash
87-
cd ~/mnn/MNN/build
8896
ldd ./llm_demo | grep -E "libMNN|Express|Audio|OpenCV" || true
8997
```
9098

91-
You should see `libMNN.so` and `libMNN_Express.so` resolving from the `~/mnn/MNN/build` tree.
99+
You should see `libMNN.so` and `libMNN_Express.so` resolving from the `~/mnn/MNN/build` tree. A correct result looks similar to:
100+
101+
```text
102+
libMNNAudio.so => /home/radxa/mnn/MNN/build/tools/audio/libMNNAudio.so (0x0000ffffb6d00000)
103+
libMNN_Express.so => /home/radxa/mnn/MNN/build/express/libMNN_Express.so (0x0000ffffb6c00000)
104+
libMNN.so => /home/radxa/mnn/MNN/build/libMNN.so (0x0000ffffb6600000)
105+
libMNNOpenCV.so => /home/radxa/mnn/MNN/build/tools/cv/libMNNOpenCV.so (0x0000ffffb61a0000)
106+
```
92107

93108
An incorrect result looks like this, where `libMNN.so` is loaded from another location:
94109

@@ -105,66 +120,74 @@ If `libMNN.so` resolves from a different directory, update `LD_LIBRARY_PATH` to
105120
export LD_LIBRARY_PATH=$HOME/mnn/MNN/build:$HOME/mnn/MNN/build/express:$HOME/mnn/MNN/build/tools/audio:$HOME/mnn/MNN/build/tools/cv:${LD_LIBRARY_PATH:-}
106121
```
107122

123+
To make this setting persistent across terminal sessions, add it to your shell profile:
124+
125+
```bash
126+
echo 'export LD_LIBRARY_PATH=$HOME/mnn/MNN/build:$HOME/mnn/MNN/build/express:$HOME/mnn/MNN/build/tools/audio:$HOME/mnn/MNN/build/tools/cv:${LD_LIBRARY_PATH:-}' >> ~/.bashrc
127+
source ~/.bashrc
128+
```
129+
108130
Run the check again:
109131

110132
```bash
111133
ldd ./llm_demo | grep -E "libMNN|Express|Audio|OpenCV" || true
112134
```
113135

114-
## Download a prebuilt Omni model package
136+
## Download the prebuilt Omni model package
115137

116-
This learning path uses a prebuilt [Omni model package](https://huggingface.co/taobao-mnn/Qwen2.5-Omni-7B-MNN) that is already in MNN deployable format.
138+
This Learning Path uses a prebuilt [Omni model package](https://www.modelscope.cn/MNN/Qwen2.5-Omni-7B-MNN) that is already prepared for MNN deployment. The full package is approximately 15 GB, so ensure you have sufficient disk space and a stable internet connection before cloning.
117139

118-
Clone the model into your workspace:
140+
Clone the model repository into your workspace:
119141

120142
```bash
121143
cd ~/mnn
122144
git clone https://www.modelscope.cn/MNN/Qwen2.5-Omni-7B-MNN.git
145+
cd ~/mnn/Qwen2.5-Omni-7B-MNN
123146
```
124147

125-
Verify that the package includes `config.json`:
148+
## Download the model weights
149+
150+
After cloning, install Git LFS and pull the large model files:
126151

127152
```bash
128-
cat ~/mnn/Qwen2.5-Omni-7B-MNN/config.json
129-
```
130-
131-
A valid configuration looks similar to:
132-
133-
```json
134-
{
135-
"llm_model": "llm.mnn",
136-
"llm_weight": "llm.mnn.weight",
137-
"backend_type": "cpu",
138-
"thread_num": 4,
139-
"precision": "low",
140-
"memory": "low",
141-
"system_prompt": "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech.",
142-
"talker_max_new_tokens": 2048,
143-
"talker_speaker": "Chelsie",
144-
"dit_steps": 5,
145-
"dit_solver": 1,
146-
"mllm": {
147-
"backend_type": "cpu",
148-
"thread_num": 4,
149-
"precision": "normal",
150-
"memory": "low"
151-
}
152-
}
153+
sudo apt-get install -y git-lfs
154+
git lfs install
155+
cd ~/mnn/Qwen2.5-Omni-7B-MNN
156+
git lfs pull
153157
```
154158

155159
{{% notice Note %}}
156-
This package is already prepared for MNN deployment.
157-
158-
You do not need to export the model from PyTorch or run additional quantization steps before using it in this learning path.
160+
The full model weights are approximately 15 GB. Downloading can take a while depending on your network connection.
159161
{{% /notice %}}
160162

163+
Verify that the main model files are present and several gigabytes in size:
164+
165+
```bash
166+
ls -lh ~/mnn/Qwen2.5-Omni-7B-MNN/llm.mnn ~/mnn/Qwen2.5-Omni-7B-MNN/llm.mnn.weight
167+
```
168+
169+
If either file is only a few hundred bytes, the LFS download did not complete. Run `git lfs pull` again to resume it.
170+
171+
{{% notice Note %}}This package is already prepared for MNN deployment. You do not need to export the model from PyTorch or run additional quantization steps before using it in this Learning Path.{{% /notice %}}
172+
161173
## Check your setup
162174

163-
Start `llm_demo` with the model configuration:
175+
Run `llm_demo` with the model configuration to verify the binary loads correctly:
164176

165177
```bash
166178
cd ~/mnn/MNN/build
167179
./llm_demo ~/mnn/Qwen2.5-Omni-7B-MNN/config.json
168180
```
169181

170-
If the binary starts without `undefined symbol` errors or missing library messages, your environment is ready for the next module.
182+
The binary starts an interactive session. Type `exit` or press Ctrl+C to quit. If the binary loads without `undefined symbol` errors or missing library messages, your environment is ready for the next section.
183+
184+
## What you've learned and what's next
185+
186+
In this section, you:
187+
188+
- Built MNN natively on Armv9 with multimodal and KleidiAI support enabled
189+
- Verified that shared libraries resolve correctly to avoid runtime conflicts
190+
- Downloaded and validated the prebuilt Omni model package and weights
191+
- Confirmed that `llm_demo` can load the model configuration
192+
193+
In the next section, you'll run a text-only baseline to verify that the core inference path works correctly before adding vision and audio inputs.

0 commit comments

Comments
 (0)