| --- |
| license: openrail++ |
| tags: |
| - stable-diffusion-xl |
| - realvisxl |
| - lightning |
| - qualcomm |
| - hexagon |
| - qnn |
| - npu |
| - text-to-image |
| - tokforge |
| library_name: qnn |
| pipeline_tag: text-to-image |
| inference: false |
| --- |
| |
| # TokForge — RealVisXL V4.0 Lightning (Qualcomm Hexagon NPU) |
|
|
| **RealVisXL V4.0 Lightning** image generation for the **Qualcomm Hexagon NPU (HTP)**, packaged for |
| **on-device** image generation in the **TokForge** Android app (`dev.tokforge`). This is the |
| higher-quality **1024×1024** "Faithful" tier alongside the SD1.5 NPU bundle. |
|
|
| vc410: this repo replaces the previous **SDXL-Turbo** bins (few-step distillation gave fused heads / |
| doubled bodies / extra limbs) with **RealVisXL V4.0 Lightning**, which is adversarially distilled for |
| **deterministic few-step Euler** and renders clean, photoreal people. The W8A16 NPU quant is |
| unchanged — the checkpoint was the cure. |
|
|
| The model is quantized to **W8A16** (8-bit weights, 16-bit activations) and compiled to **QNN HTP |
| context binaries** that run on the phone's Hexagon DSP. The pipeline uses **fp16 text encoders** and a |
| **TAESDXL** tiny-VAE decoder, runs **6-step EulerDiscrete**, and is **guidance-free** (one UNet pass |
| per step). |
|
|
| ## Based on |
|
|
| [`SG161222/RealVisXL_V4.0_Lightning`](https://huggingface.co/SG161222/RealVisXL_V4.0_Lightning) — |
| CreativeML OpenRAIL++-M license (commercial use permitted, no revenue cap). |
|
|
| ## Format |
|
|
| **QNN HTP context binaries** (W8A16), native **1024px** (128×128 latent). These are compiled for the |
| Hexagon DSP and are **not** a portable format like GGUF. The repo ships **native sets for V73 / V75 / |
| V79 / V81**; the app reads the device Hexagon arch (`dsp_arch`) and downloads the matching set. |
| Forward-compatibility (a lower-arch binary also runs on a higher-arch DSP) still applies as a |
| fallback. Device-verified clean on **V75** (Lenovo SM8650) and **V81** (RedMagic SM8850). |
|
|
| ## Pipeline |
|
|
| | Stage | File | |
| |-------|------| |
| | CLIP-L text encoder (fp16) | `<arch>/text_encoder_1_fp16.bin` | |
| | OpenCLIP-bigG text encoder (fp16) | `<arch>/text_encoder_2_fp16.bin` | |
| | Combined-emb MLP (host CPU) | `<arch>/sdxl_emb_mlp.bin` | |
| | UNet (W8A16, DSP) | `<arch>/unet.bin` | |
| | TAESDXL tiny-VAE (CPU MNN) | `<arch>/taesdxl_decoder.mnn` | |
| | Dual CLIP BPE tokenizers | `<arch>/tokenizer/`, `<arch>/tokenizer_2/` | |
|
|
| Scheduler: **EulerDiscrete** (deterministic), trailing spacing, epsilon prediction, **6 steps**, |
| guidance_scale 0. Runs via the license-clean `libsdxl_qnn_driver` in the TokForge app. |
| |
| See `manifest.json` for the per-arch file list, sizes, and md5 checksums. |
| |