Aman0runanywhere commited on
Commit
fb1fbaf
·
verified ·
1 Parent(s): c0fabd5

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +80 -0
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - qhexrt
5
+ - internvl
6
+ - vlm
7
+ - image-text-to-text
8
+ - hexagon
9
+ - npu
10
+ - qnn
11
+ base_model: OpenGVLab/InternVL3_5-1B
12
+ pipeline_tag: image-text-to-text
13
+ 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.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.bin` | Qwen3-0.6B **prefill** graph, fixed `S=310` (**fp16**) | 898 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.json libQnnHtp.so libQnnSystem.so internvl \
52
+ 60 'Describe this image in detail.' internvl/my_photo.jpg"
53
+ # -> text: "The image shows ..."
54
+ ```
55
+ - **Image**: any aspect ratio / format (JPEG/PNG/…); center-cropped + resized to 448×448 host-side
56
+ (256 image tokens / 1 tile).
57
+ - **Prompt is fixed**: the shipped prefill graph is pinned to `S=310`, which is the tokenized
58
+ `"Describe this image in detail."` (+ 256 image tokens + chat template). Pass exactly that string
59
+ (or `''` to use it as the default). Other prompts need a re-exported prefill at the new sequence length.
60
+
61
+ ## Performance (measured, v79 / S25)
62
+ | stage | time |
63
+ |-------|------|
64
+ | vision encode (one-time) | **181 ms** |
65
+ | prefill / TTFT | **101 ms** |
66
+ | decode | **~28 ms/token** on the NPU graphs |
67
+
68
+ End-to-end wall time includes single-threaded host preproc (patch-embed + projector, ~1.5 s one-time);
69
+ the NPU compute itself is the table above.
70
+
71
+ ## Notes
72
+ - Arch: **v79 only** — context binaries are dsp-arch-pinned. Other arches must be re-exported.
73
+ - No custom op-package needed — all graphs are pure-native HTP (HVX/HMX).
74
+ - **Precision**: vision fp16, prefill fp16, decode **W4A16**, lm-head **W8A16**. (Prefill/vision can be
75
+ further quantized to shrink the footprint; this bundle ships the validated balance.)
76
+ - **HTP gotcha baked in**: all graph I/O is 2D `[seq,dim]` — HTP mis-lays-out 3D `[1,seq,dim]` tensors.
77
+ The Conv2d patch-embed and pixel-shuffle are host-side for the same reason.
78
+ - Source model: [`OpenGVLab/InternVL3_5-1B`](https://huggingface.co/OpenGVLab/InternVL3_5-1B)
79
+ (InternViT-300M + Qwen3-0.6B), exported and compiled with QAIRT 2.45 for
80
+ `qualcomm-snapdragon-8-elite-for-galaxy`.