|
| 1 | +--- |
| 2 | +title: Validate text-only inference with an Omni model on Armv9 |
| 3 | +weight: 4 |
| 4 | +layout: learningpathall |
| 5 | +--- |
| 6 | + |
| 7 | +## Introduction |
| 8 | + |
| 9 | +In this section, you run a **text-only baseline** using the Omni model on an Armv9 Linux system. Before adding image and audio inputs, this baseline helps you confirm that the core inference path is working correctly with a simple prompt and predictable output behavior. |
| 10 | + |
| 11 | +This text-only baseline serves an important purpose in the Learning Path. Before adding image and audio inputs, it lets you verify the Armv9 runtime, basic token generation, and feature detection in isolation. That makes it easier to confirm that the core inference path is working correctly before you introduce additional multimodal variables. |
| 12 | + |
| 13 | +By the end of this module, you will be able to: |
| 14 | + |
| 15 | +- run a reproducible text-only inference baseline on an Armv9 CPU |
| 16 | +- verify that the MNN runtime, prompt input path, and token generation are working correctly |
| 17 | +- establish a text baseline that you can use to compare later vision, audio, and multimodal runs |
| 18 | + |
| 19 | +## Create a baseline prompt |
| 20 | + |
| 21 | +Create a small prompt file in your workspace: |
| 22 | + |
| 23 | +```bash |
| 24 | +cat > ~/mnn/text_baseline_prompt.txt <<'EOF' |
| 25 | +You are an on-device inference assistant. In one short sentence, describe the benefits of multimodal on-device inference. |
| 26 | +EOF |
| 27 | +``` |
| 28 | + |
| 29 | +{{% notice Note %}} |
| 30 | +`llm_demo` commonly treats each line in the file as a separate prompt. Keep each prompt on a single line. |
| 31 | +{{% /notice %}} |
| 32 | + |
| 33 | +## Run `llm_demo` with the prompt file |
| 34 | + |
| 35 | +Run `llm_demo` from the MNN build directory and pass both the model configuration and prompt file: |
| 36 | + |
| 37 | +```bash |
| 38 | +cd ~/mnn/MNN/build |
| 39 | +./llm_demo ~/mnn/Qwen2.5-Omni-7B-MNN/config.json ~/mnn/text_baseline_prompt.txt |
| 40 | +``` |
| 41 | + |
| 42 | +A successful run should load the model, report the detected CPU features, and return a text response for the prompt. |
| 43 | + |
| 44 | +Example output: |
| 45 | + |
| 46 | +```text |
| 47 | +config path is /home/radxa/mnn/Qwen2.5-Omni-7B-MNN/config.json |
| 48 | +CPU Group: [ 1 2 3 4 ], 799999 - 1800968 |
| 49 | +CPU Group: [ 7 8 ], 799897 - 2199795 |
| 50 | +CPU Group: [ 5 6 ], 799897 - 2299896 |
| 51 | +CPU Group: [ 9 10 ], 799897 - 2399998 |
| 52 | +CPU Group: [ 0 11 ], 799897 - 2500100 |
| 53 | +The device supports: i8sdot:1, fp16:1, i8mm: 1, sve2: 1, sme2: 0 |
| 54 | +main, 274, cost time: 5683.311035 ms |
| 55 | +Prepare for tuning opt Begin |
| 56 | +Prepare for tuning opt End |
| 57 | +main, 282, cost time: 751.726013 ms |
| 58 | +prompt file is /home/radxa/mnn/text_baseline_prompt.txt |
| 59 | + The benefits are: - It reduces the need for cloud-based services. - It can be used in areas with limited internet connectivity. - It can save on data transfer costs. - It can be used for real-time processing. - It can improve the privacy of data processing. |
| 60 | +
|
| 61 | +Multimodal on-device inference has several benefits, including reducing the need for cloud-based services, allowing usage in areas with poor internet connectivity, saving on data transfer costs, enabling real-time processing, and enhancing privacy during data processing. It's a great way to handle various tasks efficiently, especially when you don't want to rely too much on the cloud. |
| 62 | +``` |
| 63 | + |
| 64 | + |
| 65 | +{{% notice Note %}} |
| 66 | +When you run `llm_demo`, you may see a line like: |
| 67 | +`The device supports: i8sdot:1, fp16:1, i8mm: 1, sve2: 1, sme2: 0` |
| 68 | +This line reports hardware feature support on your CPU: **i8sdot**, **fp16**, **i8mm**, **sve2**, and **sme2**. |
| 69 | +A value of `1` means the feature is supported in hardware, and `0` means it is not. |
| 70 | +{{% /notice %}} |
| 71 | + |
| 72 | +## Check how prompt files are processed |
| 73 | + |
| 74 | +To verify that the prompt file is read line by line, append a second prompt: |
| 75 | + |
| 76 | +```bash |
| 77 | +cat >> ~/mnn/text_baseline_prompt.txt <<'EOF' |
| 78 | +What is the Arm CPU architecture? |
| 79 | +EOF |
| 80 | +``` |
| 81 | + |
| 82 | +Run the same command again: |
| 83 | +```bash |
| 84 | +cd ~/mnn/MNN/build |
| 85 | +./llm_demo ~/mnn/Qwen2.5-Omni-7B-MNN/config.json ~/mnn/text_baseline_prompt.txt |
| 86 | +``` |
| 87 | +You should now see two responses, one for each line in the prompt file. |
| 88 | + |
| 89 | +``` |
| 90 | +config path is /home/radxa/mnn/Qwen2.5-Omni-7B-MNN/config.json |
| 91 | +CPU Group: [ 1 2 3 4 ], 799999 - 1800968 |
| 92 | +CPU Group: [ 7 8 ], 799897 - 2199795 |
| 93 | +CPU Group: [ 5 6 ], 799897 - 2299896 |
| 94 | +CPU Group: [ 9 10 ], 799897 - 2399998 |
| 95 | +CPU Group: [ 0 11 ], 799897 - 2500100 |
| 96 | +The device supports: i8sdot:1, fp16:1, i8mm: 1, sve2: 1, sme2: 0 |
| 97 | +main, 274, cost time: 5700.204102 ms |
| 98 | +Prepare for tuning opt Begin |
| 99 | +Prepare for tuning opt End |
| 100 | +main, 282, cost time: 784.388000 ms |
| 101 | +prompt file is /home/radxa/mnn/text_baseline_prompt.txt |
| 102 | + 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. |
| 103 | +``` |
| 104 | + |
| 105 | +You should now see two responses (one per line). |
| 106 | + |
| 107 | + |
| 108 | +If you want to quickly sanity-check interactive mode: |
| 109 | + |
| 110 | +```bash |
| 111 | +cd ~/mnn/MNN/build |
| 112 | +./llm_demo ~/mnn/Qwen2.5-Omni-7B-MNN/config.json |
| 113 | +``` |
| 114 | + |
| 115 | +Enter a short prompt and confirm that the model returns a reply. |
| 116 | + |
| 117 | +## Check your results |
| 118 | + |
| 119 | +You have completed this module when: |
| 120 | + |
| 121 | +- `llm_demo` loads `config.json` successfully |
| 122 | +- the prompt file produces one response per line |
| 123 | +- the model returns non-empty text output |
| 124 | +- the runtime completes without crashes or missing-library errors |
| 125 | + |
| 126 | +## Next steps |
| 127 | + |
| 128 | +In the next module, you will add an image input and validate the vision path of the Omni model on Armv9. |
0 commit comments