darkmaniac7 commited on
Commit
63eca1b
·
verified ·
1 Parent(s): 39ae3a9

Public-facing model card

Browse files
Files changed (1) hide show
  1. README.md +35 -83
README.md CHANGED
@@ -5,106 +5,58 @@ license_link: https://huggingface.co/stabilityai/sdxl-turbo/blob/main/LICENSE.md
5
  tags:
6
  - stable-diffusion-xl
7
  - sdxl-turbo
8
- - qnn
9
  - hexagon
 
10
  - npu
11
- - w8a16
12
  - text-to-image
13
  - tokforge
14
- pipeline_tag: text-to-image
15
  library_name: qnn
 
16
  inference: false
17
  ---
18
 
19
- # TokForge SDXL-Turbo · Hexagon NPU (W8A16)
20
-
21
- **PRIVATE** model bundle for the **TokForge** Android app (`dev.tokforge`). This repo hosts the
22
- **SDXL-Turbo** image-generation pipeline compiled to **QNN context binaries** for the
23
- **Qualcomm Hexagon DSP (HTP)**, so TokForge can fetch the SDXL-NPU "Faithful" backend from scratch
24
- (previously hand-staged on devices only).
25
-
26
- Sibling of [`darkmaniac7/TokForge-SD15-QNN-NPU`](https://huggingface.co/darkmaniac7/TokForge-SD15-QNN-NPU)
27
- (SD1.5). Same non-root `untrusted_app` cDSP recipe; this is the higher-quality 1024px tier.
28
-
29
- ## What this is
30
-
31
- - **Model:** SDXL-Turbo (few-step distilled SDXL), native **1024×1024** (128×128 latent).
32
- - **Quantization:** **W8A16** (8-bit weights, 16-bit activations) on the Hexagon HTP.
33
- - **Runtime:** **QAIRT 2.40**. Bin set is **V75-native** (`libQnnHtpV75Skel.so`).
34
- - **Variant:** **fp16 text encoders + TAESDXL** tiny-VAE (see below).
35
- - **Footprint:** **~4.3 GB** on disk (the on-device fresh download is this big).
36
-
37
- ## Pipeline / variant
38
-
39
- This bundle is the **fp16-encoders + TAESDXL** variant the `libsdxl_qnn_driver` runs end-to-end
40
- (no host orchestration beyond the emb-MLP):
41
-
42
- | Stage | File | Where it runs |
43
- |-------|------|---------------|
44
- | CLIP-L text encoder | `text_encoder_1_fp16.bin` | DSP (fp16) → `last_hidden [1,77,768]` |
45
- | OpenCLIP-bigG text encoder (+proj) | `text_encoder_2_fp16.bin` | DSP (fp16) → `last_hidden [1,77,1280]` + `pooled [1,1280]` |
46
- | text_embedding | concat → `[1,77,2048]` | driver |
47
- | combined-emb MLP | `sdxl_emb_mlp.bin` | **host CPU** → `emb [1,1280]` per step |
48
- | UNet (EulerAncestral, 4 steps, guidance 0) | `unet.bin` (2.6 GB) | DSP |
49
- | VAE decode (1024px) | `taesdxl_decoder.mnn` (2.4 MB) | **CPU** (MNN tiny-VAE) |
50
-
51
- **Why the host emb-MLP:** qairt-converter 2.40 constant-folds SDXL's two sinusoidal paths
52
- (`time_proj` and `add_time_proj`). The driver dodges both by precomputing the **combined**
53
- `emb = time_embedding(time_proj(t)) + add_embedding(cat(pooled, add_time_proj(time_ids)))` on host
54
- (weights in `sdxl_emb_mlp.bin`) and feeding it as ONE float UNet input, so no foldable path remains.
55
-
56
- **Why TAESDXL CPU VAE:** it is the **only validated** VAE path. The DSP VAE is blocked at 1024px on
57
- V75 (unsigned-PD HTP cap) and the OpenCL/Vulkan VAE SIGSEGVs Adreno in `Session::resize`. The driver
58
- always selects `--vae_mnn` + `SDXL_VAE_BACKEND=cpu`.
59
-
60
- **SDXL-Turbo is guidance-free** (`guidance_scale 0`): NO CFG → one UNet pass per step. EulerAncestral,
61
- 4 steps native (6 for quality), VAE scaling factor **0.13025**.
62
-
63
- ## Arch coverage & verification
64
-
65
- | Set | dsp_arch | Skel | Verified |
66
- |-----|----------|------|----------|
67
- | `ours/v75` | 75 (V75) | `libQnnHtpV75Skel.so` | **YES** — device-verified coherent+crisp on Lenovo **SM8650/V75** (.69) |
68
 
69
- **Forward-compat:** a lower-arch bin runs on a higher-arch DSP. The **V75-native** set is the
70
- shipping set for **V73 → V81**, and was **verified by forward-compat on V81** (RedMagic **SM8850**
71
- handsets .82 and .80, coherent+crisp). **Native V81/V79 SDXL bins are NOT separately built** — V75-native
72
- is the single own-built set today.
73
 
74
- | SoC class | Hexagon | Status |
75
- |-----------|---------|--------|
76
- | 8 Gen 2 / 8s Gen 3 (SM8550/SM8635) | V73 | covered by V75-native forward-compat (untested on device) |
77
- | 8 Gen 3 (SM8650) | V75 | **device-verified** |
78
- | 8 Elite (SM8750) | V79 | forward-compat (untested on V79 silicon) |
79
- | 8 Elite Gen 5 (SM8850) | V81 | **forward-compat verified** (.82, .80) |
80
 
81
- ## Provenance
82
 
83
- Clean-room conversion, our own pipeline (no third-party NPU bins):
84
 
85
- 1. **Base:** `stabilityai/sdxl-turbo` (fp16 safetensors) → ONNX export (UNet emb-input/fold-proofed
86
- graph, dual CLIP encoders, TAESDXL decoder).
87
- 2. **Quantize:** **W8A16** via QAIRT (calibration set), graph name `model`.
88
- 3. **Compile:** `qnn-context-binary-generator` → V75 HTP context binaries (**QAIRT 2.40**).
89
- 4. **VAE:** TAESDXL exported to a CPU MNN model (`taesdxl_decoder.mnn`).
90
 
91
- ## License
 
 
 
92
 
93
- **SDXL-Turbo — Stability AI Community License** (`stabilityai/sdxl-turbo`).
 
 
 
 
 
 
 
94
 
95
- - Commercial use **permitted** for organizations/individuals with **< $1M USD annual revenue**.
96
- - Above $1M revenue requires a **Stability AI Enterprise license**.
97
- - **Attribution + license text must be retained** with the model.
98
- - This is **NOT** OpenRAIL-M (that covers the sibling SD1.5 bundle).
99
 
100
- Text encoder bases: OpenCLIP bigG (MIT-class), OpenAI CLIP-L (MIT).
101
 
102
- ## Files
 
103
 
104
- See `manifest.json` for the authoritative file set with per-file md5 + size. The app reads
105
- `manifest.json`, resolves the device Hexagon arch, downloads the matching set into
106
- `filesDir/image_models/SDXL-QNN-NPU/`, and the `libsdxl_qnn_driver` loads the bins flat from there.
107
 
108
- **Driver-required files** (every one must be present + non-empty for a usable bundle):
109
- `unet.bin`, `text_encoder_1_fp16.bin`, `text_encoder_2_fp16.bin`, `sdxl_emb_mlp.bin`,
110
- `taesdxl_decoder.mnn`, `tokenizer/{vocab.json,merges.txt}`, `tokenizer_2/{vocab.json,merges.txt}`.
 
 
5
  tags:
6
  - stable-diffusion-xl
7
  - sdxl-turbo
8
+ - qualcomm
9
  - hexagon
10
+ - qnn
11
  - npu
 
12
  - text-to-image
13
  - tokforge
 
14
  library_name: qnn
15
+ pipeline_tag: text-to-image
16
  inference: false
17
  ---
18
 
19
+ # TokForge — SDXL-Turbo (Qualcomm Hexagon NPU)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ **SDXL-Turbo** image generation for the **Qualcomm Hexagon NPU (HTP)**, packaged for **on-device**
22
+ image generation in the **TokForge** Android app (`dev.tokforge`). This is the higher-quality
23
+ **1024×1024** tier alongside the SD1.5 NPU bundle.
 
24
 
25
+ The model is quantized to **W8A16** (8-bit weights, 16-bit activations) and compiled to **QNN HTP
26
+ context binaries** that run on the phone's Hexagon DSP. The pipeline uses **fp16 text encoders** and a
27
+ **TAESDXL** tiny-VAE decoder, and is **guidance-free** (few-step distilled, one UNet pass per step).
 
 
 
28
 
29
+ ## Based on
30
 
31
+ [`stabilityai/sdxl-turbo`](https://huggingface.co/stabilityai/sdxl-turbo).
32
 
33
+ ## Format
 
 
 
 
34
 
35
+ **QNN HTP context binaries** (W8A16), native **1024px** (128×128 latent). These are compiled for the
36
+ Hexagon DSP and are **not** a portable format like GGUF. The shipping set is V75-native and is
37
+ **forward-compatible** (a lower-arch binary also runs on a higher-arch DSP), covering Hexagon
38
+ **V73 → V81**.
39
 
40
+ | Stage | File |
41
+ |-------|------|
42
+ | CLIP-L text encoder (fp16) | `text_encoder_1_fp16.bin` |
43
+ | OpenCLIP-bigG text encoder (fp16) | `text_encoder_2_fp16.bin` |
44
+ | combined embedding MLP | `sdxl_emb_mlp.bin` |
45
+ | UNet | `unet.bin` |
46
+ | VAE decode (TAESDXL tiny-VAE) | `taesdxl_decoder.mnn` |
47
+ | tokenizers | `tokenizer/`, `tokenizer_2/` |
48
 
49
+ See `manifest.json` for the authoritative file set (with per-file size + md5) that the app uses to
50
+ download the bundle.
 
 
51
 
52
+ ## Usage
53
 
54
+ This bundle is loaded automatically by the TokForge Android app — it is not a standalone diffusers
55
+ checkpoint. The app downloads the file set from `manifest.json` and runs the binaries on the device NPU.
56
 
57
+ ## License & attribution
 
 
58
 
59
+ This model is a derivative of [`stabilityai/sdxl-turbo`](https://huggingface.co/stabilityai/sdxl-turbo)
60
+ and is distributed under the **Stability AI Community License**
61
+ ([LICENSE](https://huggingface.co/stabilityai/sdxl-turbo/blob/main/LICENSE.md)). Attribution to Stability AI
62
+ and retention of the license text are required.