flying101 commited on
Commit
0c5a193
·
verified ·
1 Parent(s): 6664fff

Add v75 arch section to README

Browse files
Files changed (1) hide show
  1. README.md +73 -34
README.md CHANGED
@@ -14,41 +14,35 @@ language:
14
  - en
15
  ---
16
 
17
- # InternVL3.5-1B — QHexRT NPU bundle (Hexagon v79)
18
 
19
- Precompiled **InternVL3.5-1B** vision-language model for the **QHexRT** runtime on Qualcomm
20
- Hexagon **v79** (Snapdragon 8 Elite / SM8750, e.g. Galaxy S25). Image caption runs **entirely on
21
- the NPU**: the InternViT-300M vision encoder and the full Qwen3-0.6B language model are
22
- `qnn_context_binary` graphs; the host does only light glue (image resize, patch-embed, pixel-shuffle
23
- projector, tokenize/splice, sampling). Device-validated end-to-end on diverse photos.
24
 
25
  The model is driven by QHexRT's declarative **manifest plan-interpreter** (`Session::generate` via the
26
  `internvl_generate` host-op) — the same engine that runs the other `*_HNPU` bundles.
27
 
28
- ## Contents (`v79/`)
29
- | file | what | size |
30
- |------|------|------|
31
- | `internvl3_5-1b-512.json` | QHexRT manifest (vlm family, `internvl_generate` plan) | — |
32
- | `ivl_enc2.bin` | InternViT-300M vision encoder — 24-layer, **fp16**, 2D `[seq,dim]` I/O | 621 MB |
33
- | `ivl_pf_512.bin` | Qwen3-0.6B **batched prefill** graph, AR=512 (padded) — **arbitrary prompts** up to ~256 text tokens (**fp16**) | 890 MB |
34
- | `ivl_dec_w4.bin` | Qwen3-0.6B **decode** step (1 token), **W4A16** | 225 MB |
35
- | `ivl_lmh_q.bin` | untied **lm-head**, **W8A16** (int8) → logits over 151936 vocab | 158 MB |
36
- | `ivl_embed_f16.bin` | token embedding table `[151936,1024]` f16 (mmap, host lookup) | 311 MB |
37
- | `tokenizer.json` | Qwen3 tokenizer (vocab 151936) | 11 MB |
38
- | `vlm/` | host vision preproc: Conv2d patch-embed, pos-embed, layer-norm + pixel-shuffle MLP projector, prompt template | 27 MB |
39
 
40
- Total ≈ **2.25 GB** on disk; ≈ **2.0 GB** peak device RSS at runtime (weights are ion-shared host↔DSP,
41
- not duplicated).
 
 
 
 
 
42
 
43
  ## Run (QHexRT CLI)
44
  ```bash
45
  hf download runanywhere/internvl3_5_1b_HNPU --local-dir internvl3_5_1b_HNPU
46
- # qhx_generate comes from a QHexRT build; QNN libs from the QAIRT SDK (lib/aarch64-android) + v79 HTP skel.
47
- adb push internvl3_5_1b_HNPU/v79 /data/local/tmp/wq/internvl
48
  adb push my_photo.jpg /data/local/tmp/wq/internvl/
49
 
50
- adb shell "cd /data/local/tmp/wq && LD_LIBRARY_PATH=. ADSP_LIBRARY_PATH=. \
51
- ./qhx_generate internvl/internvl3_5-1b-512.json libQnnHtp.so libQnnSystem.so internvl \
52
  60 'What animals are in this picture and what are they doing?' internvl/my_photo.jpg"
53
  # -> text: "In the image, there are two cats lying on a pink couch ..."
54
  ```
@@ -57,6 +51,21 @@ adb shell "cd /data/local/tmp/wq && LD_LIBRARY_PATH=. ADSP_LIBRARY_PATH=. \
57
  - **Arbitrary prompts**: the padded `AR=512` prefill accepts any prompt up to ~256 text tokens (image is
58
  fixed at 256 tokens). Ask real questions, not just a fixed caption string.
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  ## Performance (measured, v79 / S25)
61
  | stage | time |
62
  |-------|------|
@@ -67,20 +76,41 @@ adb shell "cd /data/local/tmp/wq && LD_LIBRARY_PATH=. ADSP_LIBRARY_PATH=. \
67
  End-to-end wall time includes single-threaded host preproc (patch-embed + projector, ~1.5 s one-time);
68
  the NPU compute itself is the table above.
69
 
70
- ## Notes
71
- - Arch: **v79 only** — context binaries are dsp-arch-pinned. Other arches must be re-exported.
72
- - No custom op-package needed all graphs are pure-native HTP (HVX/HMX).
73
- - **Precision**: vision fp16, prefill fp16, decode **W4A16**, lm-head **W8A16**. (Prefill/vision can be
74
- further quantized to shrink the footprint; this bundle ships the validated balance.)
75
- - **HTP gotcha baked in**: all graph I/O is 2D `[seq,dim]` HTP mis-lays-out 3D `[1,seq,dim]` tensors.
76
- The Conv2d patch-embed and pixel-shuffle are host-side for the same reason.
77
- - Source model: [`OpenGVLab/InternVL3_5-1B`](https://huggingface.co/OpenGVLab/InternVL3_5-1B)
78
- (InternViT-300M + Qwen3-0.6B), exported and compiled with QAIRT 2.45 for
79
- `qualcomm-snapdragon-8-elite-for-galaxy`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  ## v81 (SM8850 / soc_model 87)
82
 
83
- Device-validated on SM8850: image->caption tracks the image — e.g. an orange dahlia ->
84
  *"The image features a close-up of a single, large, orange flower with a textured, layered appearance. The
85
  flower has a circular shape with numerous petals radiating from a central point..."*. Vision 147 ms, prefill
86
  TTFT 115 ms, decode 18.4 ms/tok. The v81 recipe was **completed** by reconstructing the two graphs the
@@ -91,3 +121,12 @@ lm-head graph (`ivl_lmh`) — both gated vs the HF gold first token. All graphs
91
  `internvl3_5-1b.json` · `ivl_enc_f16.bin` (InternViT-300M vision) · `ivl_pf_f16.bin` (batched prefill) ·
92
  `ivl_dec_f16.bin` (AR=1 decode) · `ivl_lmh_f16.bin` (lm-head) · `ivl_embed_f16.bin` · `tokenizer.json` ·
93
  `vlm/` (host patch/pos-embed + pixel-shuffle MLP projector weights + prompt template).
 
 
 
 
 
 
 
 
 
 
14
  - en
15
  ---
16
 
17
+ # InternVL3.5-1B — QHexRT NPU bundle
18
 
19
+ Precompiled **InternVL3.5-1B** vision-language model for the **QHexRT** runtime on Qualcomm Hexagon NPU.
20
+ Image caption runs **entirely on the NPU**: the InternViT-300M vision encoder and the full Qwen3-0.6B
21
+ language model are `qnn_context_binary` graphs; the host does only light glue (image resize, patch-embed,
22
+ pixel-shuffle projector, tokenize/splice, sampling). Device-validated end-to-end on diverse photos.
 
23
 
24
  The model is driven by QHexRT's declarative **manifest plan-interpreter** (`Session::generate` via the
25
  `internvl_generate` host-op) — the same engine that runs the other `*_HNPU` bundles.
26
 
27
+ Context binaries are **arch-pinned** — pick the sibling dir that matches your device.
 
 
 
 
 
 
 
 
 
 
28
 
29
+ ## Architectures
30
+
31
+ | Dir | Device (example) | Status |
32
+ |-----|------------------|--------|
33
+ | `v79/` | Galaxy S25 / SM8750 (Hexagon v79) | Device-validated |
34
+ | `v81/` | SM8850 (Hexagon v81) | Device-validated |
35
+ | `v75/` | Galaxy S24 / SM8650 (Hexagon v75) | Device-validated |
36
 
37
  ## Run (QHexRT CLI)
38
  ```bash
39
  hf download runanywhere/internvl3_5_1b_HNPU --local-dir internvl3_5_1b_HNPU
40
+ # qhx_generate from a QHexRT build; QNN libs from QAIRT SDK (lib/aarch64-android) + matching HTP skel.
41
+ adb push internvl3_5_1b_HNPU/v79 /data/local/tmp/wq/internvl # or v75/ or v81/
42
  adb push my_photo.jpg /data/local/tmp/wq/internvl/
43
 
44
+ adb shell "cd /data/local/tmp/wq && export ADSP_LIBRARY_PATH='/data/local/tmp/wq/dsp;/data/local/tmp/wq;/vendor/dsp/cdsp'; \
45
+ LD_LIBRARY_PATH=. ./qhx_generate internvl/internvl3_5-1b-512.json libQnnHtp.so libQnnSystem.so internvl \
46
  60 'What animals are in this picture and what are they doing?' internvl/my_photo.jpg"
47
  # -> text: "In the image, there are two cats lying on a pink couch ..."
48
  ```
 
51
  - **Arbitrary prompts**: the padded `AR=512` prefill accepts any prompt up to ~256 text tokens (image is
52
  fixed at 256 tokens). Ask real questions, not just a fixed caption string.
53
 
54
+ ## Contents (`v79/`)
55
+ | file | what | size |
56
+ |------|------|------|
57
+ | `internvl3_5-1b-512.json` | QHexRT manifest (vlm family, `internvl_generate` plan) | — |
58
+ | `ivl_enc2.bin` | InternViT-300M vision encoder — 24-layer, **fp16**, 2D `[seq,dim]` I/O | 621 MB |
59
+ | `ivl_pf_512.bin` | Qwen3-0.6B **batched prefill** graph, AR=512 (padded) — **arbitrary prompts** up to ~256 text tokens (**fp16**) | 890 MB |
60
+ | `ivl_dec_w4.bin` | Qwen3-0.6B **decode** step (1 token), **W4A16** | 225 MB |
61
+ | `ivl_lmh_q.bin` | untied **lm-head**, **W8A16** (int8) → logits over 151936 vocab | 158 MB |
62
+ | `ivl_embed_f16.bin` | token embedding table `[151936,1024]` f16 (mmap, host lookup) | 311 MB |
63
+ | `tokenizer.json` | Qwen3 tokenizer (vocab 151936) | 11 MB |
64
+ | `vlm/` | host vision preproc: Conv2d patch-embed, pos-embed, layer-norm + pixel-shuffle MLP projector, prompt template | 27 MB |
65
+
66
+ Total ≈ **2.25 GB** on disk; ≈ **2.0 GB** peak device RSS at runtime (weights are ion-shared host↔DSP,
67
+ not duplicated).
68
+
69
  ## Performance (measured, v79 / S25)
70
  | stage | time |
71
  |-------|------|
 
76
  End-to-end wall time includes single-threaded host preproc (patch-embed + projector, ~1.5 s one-time);
77
  the NPU compute itself is the table above.
78
 
79
+ ## v75 (SM8650 / soc_model 57)
80
+
81
+ Device-validated on Galaxy S24 (Hexagon v75): all four context binaries load; image→caption runs end-to-end.
82
+ Vision **206 ms**, prefill TTFT **139 ms**, decode **~23 ms/tok** (QAIRT 2.47, soc 57).
83
+
84
+ Same graph layout as `v79/` (`ivl_enc2`, `ivl_pf_512`, `ivl_dec_w4`, `ivl_lmh_q`). Vision + prefill are
85
+ **fp16**; lm-head is **W8 weight-only**. Decode graph name is `ivl_dec_w4` but weights are **W8
86
+ weight-only** (per-row int8 via `dump_wqo_params`, not true W4 like `v79/`) — same compile workaround used
87
+ for other v75 LLM bundles on Apple Silicon hosts where `qairt-quantizer` SIGILLs under Docker.
88
+
89
+ ### Files (`v75/`)
90
+ | file | what | size |
91
+ |------|------|------|
92
+ | `internvl3_5-1b-512.json` | QHexRT manifest (`dsp_arch: v75`) | — |
93
+ | `ivl_enc2.bin` | InternViT-300M vision encoder (**fp16**) | 592 MB |
94
+ | `ivl_pf_512.bin` | Batched LLM prefill Pn=512 (**fp16**) | 855 MB |
95
+ | `ivl_dec_w4.bin` | GQA-native decode MAXCTX=512 (**W8 weight-only**, graph name `ivl_dec_w4`) | 424 MB |
96
+ | `ivl_lmh_q.bin` | Untied lm-head (**W8 weight-only**) | 151 MB |
97
+ | `ivl_embed_f16.bin` | Token embedding table f16 | 297 MB |
98
+ | `ivl_tokenizer.json` | Qwen2 tokenizer — **separate filename** so it does not collide with other QHexRT bundles on device | 11 MB |
99
+ | `vlm/` | Host patch-embed + pixel-shuffle projector + prompt template | 27 MB |
100
+
101
+ Total ≈ **2.3 GB**.
102
+
103
+ ```bash
104
+ adb push internvl3_5_1b_HNPU/v75 /data/local/tmp/wq/internvl
105
+ adb push my_photo.jpg /data/local/tmp/wq/internvl/
106
+ adb shell "cd /data/local/tmp/wq && export ADSP_LIBRARY_PATH='/data/local/tmp/wq/dsp;/data/local/tmp/wq;/vendor/dsp/cdsp'; \
107
+ LD_LIBRARY_PATH=. ./qhx_generate internvl/internvl3_5-1b-512.json libQnnHtp.so libQnnSystem.so internvl \
108
+ 60 'Describe this image in detail.' internvl/my_photo.jpg"
109
+ ```
110
 
111
  ## v81 (SM8850 / soc_model 87)
112
 
113
+ Device-validated on SM8850: imagecaption tracks the image — e.g. an orange dahlia ->
114
  *"The image features a close-up of a single, large, orange flower with a textured, layered appearance. The
115
  flower has a circular shape with numerous petals radiating from a central point..."*. Vision 147 ms, prefill
116
  TTFT 115 ms, decode 18.4 ms/tok. The v81 recipe was **completed** by reconstructing the two graphs the
 
121
  `internvl3_5-1b.json` · `ivl_enc_f16.bin` (InternViT-300M vision) · `ivl_pf_f16.bin` (batched prefill) ·
122
  `ivl_dec_f16.bin` (AR=1 decode) · `ivl_lmh_f16.bin` (lm-head) · `ivl_embed_f16.bin` · `tokenizer.json` ·
123
  `vlm/` (host patch/pos-embed + pixel-shuffle MLP projector weights + prompt template).
124
+
125
+ ## Notes
126
+ - Context binaries are **dsp-arch-pinned** — use the sibling `<arch>/` dir that matches your device.
127
+ - No custom op-package needed — all graphs are pure-native HTP (HVX/HMX).
128
+ - **Precision (v79)**: vision fp16, prefill fp16, decode **W4A16**, lm-head **W8A16**.
129
+ - **HTP gotcha baked in**: all graph I/O is 2D `[seq,dim]` — HTP mis-lays-out 3D `[1,seq,dim]` tensors.
130
+ The Conv2d patch-embed and pixel-shuffle are host-side for the same reason.
131
+ - Source model: [`OpenGVLab/InternVL3_5-1B`](https://huggingface.co/OpenGVLab/InternVL3_5-1B)
132
+ (InternViT-300M + Qwen3-0.6B).