You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/multimodel_mnn_v9/2_mnn_build.md
+24-50Lines changed: 24 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@ layout: learningpathall
6
6
7
7
## Introduction
8
8
9
-
In this section, you will 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.
9
+
In this section, you will 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.
10
10
11
-
This section 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. 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.
12
12
13
-
At the end of this module, you will have:
13
+
At the end of this section, you will have:
14
14
15
15
- a working `llm_demo` binary
16
16
- a validated model directory that includes `config.json`
@@ -26,13 +26,13 @@ mkdir -p ~/mnn
26
26
cd~/mnn
27
27
```
28
28
29
-
## Why build natively on Armv9 first
29
+
## Why build natively on Armv9
30
30
31
-
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 is 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 would hit in production.
32
32
33
-
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.
This Learning Path uses a prebuilt [Omni model package](https://huggingface.co/taobao-mnn/Qwen2.5-Omni-7B-MNN) that is already prepared for MNN deployment.
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.
## Verify that the required model files are present
142
-
143
-
Check that the repository contains the expected configuration and model files:
144
-
145
-
```bash
146
-
ls -lh ~/mnn/Qwen2.5-Omni-7B-MNN
147
-
```
148
-
149
-
Verify that `config.json` exists:
150
-
151
-
```bash
152
-
cat ~/mnn/Qwen2.5-Omni-7B-MNN/config.json
153
-
```
154
-
155
-
The presence of `config.json` alone does not guarantee that the full model weights are available locally. Confirm that the main model files are present:
148
+
## Download the model weights
156
149
157
-
-`llm.mnn`
158
-
-`llm.mnn.weight`
150
+
After cloning, install Git LFS and pull the large model files:
159
151
160
152
```bash
161
-
ls -lh ~/mnn/Qwen2.5-Omni-7B-MNN/llm.mnn ~/mnn/Qwen2.5-Omni-7B-MNN/llm.mnn.weight
162
-
```
163
-
164
-
If both files exist and show non-trivial file sizes, the model package is ready for inference.
165
-
166
-
## If the model weights are missing
167
-
168
-
Some environments fetch the large model files automatically when you clone the repository, while others do not. If `llm.mnn` or `llm.mnn.weight` is missing, install **Git LFS** and pull the large files explicitly.
169
-
170
-
Install Git LFS:
171
-
172
-
```bash
173
-
sudo apt-get update
174
153
sudo apt-get install -y git-lfs
175
154
git lfs install
176
-
```
177
-
178
-
Then download the large model files:
179
-
180
-
```bash
181
155
cd~/mnn/Qwen2.5-Omni-7B-MNN
182
156
git lfs pull
183
157
```
184
158
185
159
{{% notice Note %}}
186
-
Downloading the full model weights can take a while depending on your network connection and available bandwidth.
160
+
The full model weights are approximately 15 GB. Downloading can take a while depending on your network connection.
187
161
{{% /notice %}}
188
162
189
-
After `git lfs pull`, verify the files again:
163
+
Verify that the main model files are present and several gigabytes in size:
190
164
191
165
```bash
192
166
ls -lh ~/mnn/Qwen2.5-Omni-7B-MNN/llm.mnn ~/mnn/Qwen2.5-Omni-7B-MNN/llm.mnn.weight
193
167
```
194
168
195
-
{{% notice Note %}}
196
-
This package is already prepared for MNN deployment.
169
+
If either file is only a few hundred bytes, the LFS download did not complete. Run `git lfs pull` again to resume it.
197
170
198
-
You do not need to export the model from PyTorch or run additional quantization steps before using it in this Learning Path.
171
+
{{% notice Note %}}
172
+
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.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/multimodel_mnn_v9/3_mnn_text_baseline.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,9 @@ Prepare for tuning opt Begin
97
97
Prepare for tuning opt End
98
98
main, 282, cost time: 784.388000 ms
99
99
prompt file is /home/radxa/mnn/text_baseline_prompt.txt
100
-
The benefits of multimodal on-device inference are that it can save on cloud usage and also it can be more private and secure. It can save on cloud usage and also it can be more private and secure. So, what do you think about it? Do you have any other ideas on how it could be improved? Well, it could be improved by making it even faster, you know, like reducing the processing time even further. And also, maybe adding more features to it to make it more versatile. What do you think? Let's keep the conversation going. What do you think about the potential for multimodal on-device inference to be used in healthcare applications? It could be really useful, like for things like analyzing medical images or monitoring patients remotely. It would be great if it could be used in more areas like that. What do you think? Let's talk more about it. What do you think about the potential for multimodal on-device inference to be used in healthcare applications? It could be really useful, like for things like analyzing medical images or monitoring patients remotely. It would be great if it could be used in more areas like that. What do you think? Let's talk more about it. What do you think about the potential for multimodal on-device inference to be used in healthcare applications? What do you think about the potential for Arm is a processor architecture. It's used in mobile phones, embedded systems, etc. It has a RISC design, efficient performance, and low power consumption. Arm is popular in mobile devices, especially for its efficiency. It's used in many mobile phones, like iPhones, Androids, and embedded systems, etc. It has a RISC design, efficient performance, and low power consumption.
100
+
The benefits of multimodal on-device inference are that it can save on cloud usage and also it can be more private and secure.
101
+
[...]
102
+
Arm is a processor architecture. It's used in mobile phones, embedded systems, etc. It has a RISC design, efficient performance, and low power consumption.
101
103
```
102
104
103
105
{{% notice Note %}}
@@ -111,7 +113,7 @@ cd ~/mnn/MNN/build
111
113
./llm_demo ~/mnn/Qwen2.5-Omni-7B-MNN/config.json
112
114
```
113
115
114
-
Enter a short prompt and confirm that the model returns a reply. Type `exit` or press Ctrl+C to quit.
116
+
Enter a short prompt and confirm that the model returns a reply. Press Ctrl+C to quit.
This confirms that the image asset is ready for the vision prompt.
43
+
The key detail is that the output starts with `JPEG image data`, confirming the file is a valid JPEG. The remaining EXIF metadata can be ignored.
44
44
45
45

46
46
@@ -67,6 +67,10 @@ EOF
67
67
68
68
Run `llm_demo` with the model `config.json` file and the vision prompt:
69
69
70
+
{{% notice Note %}}
71
+
Vision inference takes longer than text-only inference because the model encodes the image into tokens before generation begins. On an Armv9 CPU, expect the initial load and image encoding step to take several minutes. The terminal will appear idle during this time — this is expected.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/multimodel_mnn_v9/5_mnn_vision_audio.md
+14-31Lines changed: 14 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,37 +6,28 @@ layout: learningpathall
6
6
7
7
## Introduction
8
8
9
-
In this module, you use an audio prompt and an MNN Omni model to convert a spoken restock note into a structured one-line ticket on an Armv9 system.
9
+
In this section, you use an audio prompt and an MNN Omni model to convert a spoken restock note into a structured one-line ticket on an Armv9 system.
10
10
11
11
This mirrors a simple retail workflow. A store associate records a short voice note during a shelf walk, and the system converts it into a task that can be reviewed by staff or passed to another tool.
12
12
13
-
To keep the output predictable, this module uses a single-line format with semicolon-separated fields. This also helps when terminal output does not preserve line breaks consistently.
13
+
To keep the output predictable, this section uses a single-line format with semicolon-separated fields. This also helps when terminal output does not preserve line breaks consistently.
14
14
15
15
## Prepare the audio asset
16
16
17
17
To simplify the demonstration and improve clarity for this learning path, directly download the prepared audio file:
This audio `restock_note.wav` contains brief spoken instructions describing restocking tasks, such as:
24
+
The audio file contains a spoken restocking instruction. The content is similar to:
25
25
26
-
- please restock the bottom-left large pet food bags, add ten bags
27
-
- also restock the middle-left canned pet food, add twenty-four cans
28
-
- finish before 3 PM today
29
-
- if something is out of stock, use a similar substitute
30
-
31
-
The model’s goal is to extract structured operational information from this audio, specifically:
32
-
33
-
- items
34
-
- quantities
35
-
- shelf zones
36
-
- deadline
37
-
- substitution policy
26
+
```text
27
+
This is the pet food aisle, left shelf. Please restock the bottom left large pet food bags, add 10 bags. Also restock the middle left canned food, add 24 cans. Finish before 3 PM today. If something is out of stock, use a similar substitute.
28
+
```
38
29
39
-
The objective isn’t comprehensive speech analytics but efficiently converting spoken instructions into a compact operational ticket.
30
+
From this spoken note, the model extracts item names, quantities, shelf zones, a deadline, and a substitution policy. The goal isn't comprehensive speech analytics — it's converting a short spoken instruction into a compact operational ticket.
This creates a mono, 16 kHz, 16-bit PCM WAV file, which is a practical format for speech input.
58
49
59
-
The spoken content can be similar to:
60
-
61
-
```text
62
-
This is the pet food aisle, left shelf. Please restock the bottom left large pet food bags, add 10 bags. Also restock the middle left canned food, add 24 cans. Finish before 3 PM today. If something is out of stock, use a similar substitute.
63
-
```
64
-
65
50
In store inspection scenarios, unreliable connectivity, or environments where teams prefer not to upload audio in real time, local speech understanding on Armv9 has clear deployment value.
66
51
67
-
In this module, the audio input is not just an audio prompt. It acts as on-device spoken task capture for store operations, turning a short spoken restocking note into structured operational input.
52
+
In this section, the audio input is not just an audio prompt. It acts as on-device spoken task capture for store operations, turning a short spoken restocking note into structured operational input.
68
53
69
54
## Create the audio prompt
70
55
@@ -77,13 +62,11 @@ Create a prompt file that attaches the WAV file and asks the model to return a s
77
62
Create the prompt file:
78
63
79
64
```bash
80
-
cat >~/mnn/prompt_audio_ticket.txt <<'EOF'
81
-
<audio>/home/radxa/mnn/assets/restock_note.wav</audio> You are a retail store replenishment assistant. Convert the spoken note into a restocking ticket. Output EXACTLY ONE line using bullet-style segments separated by semicolons: Restock ticket; - Location: pet food aisle left shelf; - Task 1: <generic item> | qty <number or NOT_SURE> | zone <top|middle|bottom>-<left|center|right or NOT_SURE>; - Task 2: <generic item> | qty <number or NOT_SURE> | zone <top|middle|bottom>-<left|center|right or NOT_SURE>; - Deadline: <time or NOT_SURE>; - Substitution: <use similar substitute|no substitute|NOT_SURE>; - Notes: <short note>; - Confidence: <high|medium|low>. Rules: do not invent quantities if not in audio.
65
+
cat >~/mnn/prompt_audio_ticket.txt <<EOF
66
+
<audio>$HOME/mnn/assets/restock_note.wav</audio> You are a retail store replenishment assistant. Convert the spoken note into a restocking ticket. Output EXACTLY ONE line using bullet-style segments separated by semicolons: Restock ticket; - Location: pet food aisle left shelf; - Task 1: <generic item> | qty <number or NOT_SURE> | zone <top|middle|bottom>-<left|center|right or NOT_SURE>; - Task 2: <generic item> | qty <number or NOT_SURE> | zone <top|middle|bottom>-<left|center|right or NOT_SURE>; - Deadline: <time or NOT_SURE>; - Substitution: <use similar substitute|no substitute|NOT_SURE>; - Notes: <short note>; - Confidence: <high|medium|low>. Rules: do not invent quantities if not in audio.
82
67
EOF
83
68
```
84
69
85
-
If your username or home directory is different, replace `/home/radxa` with the correct local path.
86
-
87
70
This prompt asks the model to:
88
71
89
72
- use generic item names instead of brands
@@ -125,7 +108,7 @@ Restock ticket;
125
108
126
109
```
127
110
The exact wording can vary. What matters is that the response stays close to the requested structure and reflects the spoken content rather than invented details.

0 commit comments