Spaces:
Running
Running
thalismind
Claude Opus 5.5
fix: send Cross-Origin-Resource-Policy so the isolated Hub page can embed the space
32eebab |
Download README.md from ThalisAI/solstice-80m-webgpu: direct link, hf CLI and curl.
- Browser
- Download file 4.84 kB
-
https://huggingface.co/spaces/ThalisAI/solstice-80m-webgpu/resolve/main/README.md
- Command line
-
hf download hf://spaces/ThalisAI/solstice-80m-webgpu/README.md
-
curl -L -o README.md https://huggingface.co/spaces/ThalisAI/solstice-80m-webgpu/resolve/main/README.md
4.84 kB
| title: Solstice 80M WebGPU | |
| emoji: ☀️ | |
| colorFrom: yellow | |
| colorTo: indigo | |
| sdk: static | |
| pinned: false | |
| license: apache-2.0 | |
| short_description: Solstice 80M and Nyx 36M pixel-art sprites in WebGPU | |
| models: | |
| - ThalisAI/solstice-80m | |
| - Bhoidy/nyx-image-36m | |
| - google/t5gemma-2b-2b-ul2 | |
| - google/siglip-base-patch16-224 | |
| custom_headers: | |
| cross-origin-embedder-policy: credentialless | |
| cross-origin-opener-policy: same-origin | |
| cross-origin-resource-policy: cross-origin | |
| tags: | |
| - text-to-image | |
| - pixel-art | |
| - webgpu | |
| - onnx | |
| - rectified-flow | |
| - lora | |
| # Solstice 80M · WebGPU | |
| [](https://huggingface.co/ThalisAI/solstice-80m) | |
| [](https://github.com/thalismind/comfyui-pixel-art-nodes) | |
| In-browser sprite generation with [ThalisAI/solstice-80m](https://huggingface.co/ThalisAI/solstice-80m) and | |
| [Bhoidy/nyx-image-36m](https://huggingface.co/Bhoidy/nyx-image-36m), based on the | |
| [Nyx Image 36M space](https://huggingface.co/spaces/Bhoidy/nyx-image-36m). Everything runs locally with ONNX Runtime Web: | |
| WebGPU when the browser has it, WASM otherwise. | |
| ## Features | |
| - **Models:** the Solstice r80-1202 teacher (30 Heun steps, CFG, self-conditioning) and its 20-, 10- and 5-step students; | |
| the retired s80-1201 teacher and students; Nyx-2 36M. fp32 runs on WebGPU or WASM, dynamic int8 on WASM. | |
| - **Precomputed prompts:** Solstice's text encoder (T5Gemma-2b, 64 × 2304) is too large for a browser, so 672 prompts are | |
| encoded ahead of time for both models (`data/`): the model-card showcase prompts, subjects, attributes, | |
| attribute + subject pairs, arithmetic and sweep terms, direction phrase pairs and LoRA trigger prompts. Nyx can also encode | |
| free text live with the quantised SigLIP text tower. | |
| - **Prompt sweep:** interpolate from prompt A to B per token (slerp on the positions both have, linear fade on the rest, | |
| slerp on the pool) with fixed noise per row, as in pixel-art-training `scripts/embed_sheets.py`. | |
| - **Arithmetic:** word arithmetic A − B + C, and an *averaged direction* A + mean_k(E["C obj_k"] − E["B obj_k"]) over a group | |
| of objects (`scripts/embed_arith_avg.py`), with a strength control and an optional strength sweep. | |
| - **LoRAs** (r80-1202): the six released LoRAs or any `.safetensors` LoRA file, several at once with per-LoRA strength. | |
| ## How LoRAs run | |
| LoRAs are added to the published models at run time; nothing LoRA-specific is hosted. ONNX Runtime Web cannot change a | |
| session's weights, so instead of merging, the page rewrites the downloaded fp32 export once, in the browser | |
| (`js/onnxlora.js`, under a second for 285 MB): each of the 160 target linears (attention and MLP in all 20 blocks), found by | |
| the exporter's `pkg.torch.onnx.name_scopes` metadata, gets a low-rank branch fed from 48 extra inputs | |
| (`lora_<stack>_<layer>_A` `[blocks, in, R]` and `_B` `[blocks, R, out]`, R dynamic). The rewrite happens when the first LoRA | |
| is switched on; after that, changing LoRAs or strengths only changes the inputs. The page stacks the chosen LoRAs along R with | |
| `strength · alpha / rank` folded into B, and feeds R = 1 zeros when none is on. This works for the teacher and every | |
| r80-1202 student. | |
| `tools/add_lora_inputs.py` is the same rewrite in Python, for checking: its `--check` compares against numpy-merged weights | |
| (within 2e-5 on the teacher and students), and the browser rewrite gives bit-identical outputs to it. | |
| ```sh | |
| pip install onnx onnxruntime | |
| python tools/add_lora_inputs.py teacher/fp32.onnx /tmp/teacher-lora.onnx --check ghost/lora.safetensors | |
| ``` | |
| ## Rebuilding the prompt library | |
| Edit `tools/prompts.py`, then re-encode (needs torch, transformers with T5Gemma, sentencepiece; ~5 min on a 16-core CPU): | |
| ```sh | |
| python tools/build_embeddings.py # -> data/library.json, data/{solstice,nyx}.{json,bin} | |
| ``` | |
| Tokens are stored as per-token int8 with float16 scales (as Solstice's training text cache), pools as float16; only the | |
| attended positions are kept. | |
| ## Layout | |
| | Path | | | |
| |---|---| | |
| | `index.html`, `style.css` | the page | | |
| | `js/app.js` | UI, model loading, the three modes | | |
| | `js/models.js` | model registry (URLs, samplers, LoRA spec) | | |
| | `js/sampler.js` | Euler / Heun, CFG on t ≤ 0.75, guidance input for students, self-conditioning | | |
| | `js/embedmath.js` | slerp sweeps and arithmetic on `ndarray`s | | |
| | `js/embeddings.js` | precomputed embedding store | | |
| | `js/lora.js` | safetensors parsing and LoRA input feeds | | |
| | `js/onnxlora.js` | adds LoRA inputs to a loaded ONNX export (protobuf rewrite) | | |
| | `js/runtime.js` | ONNX Runtime Web sessions and cached downloads | | |
| | `tools/` | prompt library, embedding builder, LoRA-input rewrite (Python, for checks) | | |