mlboydaisuke commited on
Commit
c968f23
·
verified ·
1 Parent(s): 4b6974d

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +76 -0
README.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ tags:
4
+ - executorch
5
+ - xnnpack
6
+ - pte
7
+ - on-device
8
+ - image-text-to-text
9
+ base_model:
10
+ - LiquidAI/LFM2.5-VL-450M
11
+ ---
12
+ # LFM2.5-VL-450M — ExecuTorch
13
+
14
+ `lfm2_5_vl_450m_xnnpack.pte` (2.07 GB)
15
+
16
+ - **Source**: LiquidAI/LFM2.5-VL-450M — SigLIP 2 vision tower (768 wide, 12 layers) and an
17
+ LFM2 decoder (1024 wide, 16 layers)
18
+ - **License**: LFM Open License v1.0
19
+ - **Input**: a 512×512 tile as `[1, 1024, 768]` patches plus `[1, 1024]` attention mask,
20
+ and token ids for the words around it
21
+ - **Output**: logits over the 65,536-token vocabulary
22
+
23
+ One file, three entry points — the shape ExecuTorch's multimodal runner asks for:
24
+
25
+ | method | in | out |
26
+ |---|---|---|
27
+ | `vision_encoder` | patches, mask | `[1, 256, 1024]` rows in the decoder's embedding space |
28
+ | `token_embeddings` | token ids | embeddings |
29
+ | `text_model` | embeddings, positions | logits |
30
+
31
+ A decoder that only takes token ids cannot be told about a picture. Splitting a
32
+ vision-language model into a vision `.pte` and a text `.pte` runs aground there;
33
+ `MultimodalPrefiller::load` asks one module for `token_embeddings` and `text_model` and uses
34
+ `vision_encoder` if it finds it.
35
+
36
+ ## Verification (Mac arm64, 2026-08-21)
37
+
38
+ Greedy, through the three methods, on photographs from `convert/calib_images`:
39
+
40
+ | picture | answer |
41
+ |---|---|
42
+ | a London street | "A bustling street scene with people walking, outdoor seating, and various storefronts, including a prominent Pizza Express." |
43
+ | a man with a dog | "A man with a dog is standing in front of a stack of logs with a water tower in the background." |
44
+ | a studio portrait | "A man in a gray long-sleeve shirt poses against a white background…" |
45
+
46
+ The shop sign is read correctly, which is the check that matters: a caption that fits any
47
+ street would not tell you the vision half was wired up right.
48
+
49
+ The vision encoder alone agrees with the untouched model at **corr 0.99996** (XNNPACK fp32,
50
+ against `get_image_features` on real imagery).
51
+
52
+ ## Square the picture first
53
+
54
+ The processor picks a tile grid from the aspect ratio — a 768×477 photograph becomes one
55
+ 24×40 tile, a 1280×960 one becomes seven — and this graph takes 32×32. Centre-crop to a
56
+ square before the processor sees it and every picture becomes exactly one tile. Feeding a
57
+ stretched square instead is visible in the output: asked about a squashed street, the model
58
+ called the scene "distorted and warped", which was a fair description of what it had been
59
+ given.
60
+
61
+ ```bash
62
+ python convert/run_lfm2_vl.py <image> "What is in this picture?"
63
+ ```
64
+
65
+ ## Conversion
66
+
67
+ `convert/export_lfm2_vl_bundle.py`. Two things needed re-authoring:
68
+
69
+ - **SigLIP 2 reads its grid out of a tensor** to size the position embeddings, which
70
+ `torch.export` cannot follow. The grid is fixed here, so the resize is computed once and
71
+ the constant handed to a replacement forward.
72
+ - **The projector wants the grid back.** The tower returns a flat run of patches; the
73
+ projector's pixel-unshuffle trades resolution for channels and needs to know which patches
74
+ are neighbours.
75
+
76
+ (conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models))