Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
| 1 |
-
---
|
| 2 |
-
license:
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
tags:
|
| 4 |
+
- text-generation
|
| 5 |
+
- shader
|
| 6 |
+
- glsl
|
| 7 |
+
- shadertoy
|
| 8 |
+
library_name: pytorch
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
model_name: Frag Loop
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Frag Loop
|
| 14 |
+
|
| 15 |
+
Frag Loop is a decoder-only Transformer trained to generate **Shadertoy-compatible GLSL fragment shader bodies**. The model outputs the body only (functions + `mainImage`), and is intended to be wrapped by a fixed WebGL2/Shadertoy template at runtime.
|
| 16 |
+
|
| 17 |
+
## Intended Use
|
| 18 |
+
- **Primary**: generate novel GLSL fragment shader bodies compatible with Shadertoy-style templates.
|
| 19 |
+
- **Not intended for**: general chat, safety-critical systems, or production code generation without review.
|
| 20 |
+
|
| 21 |
+
## Training Data (Summary)
|
| 22 |
+
- **Pretraining**: GLSL-heavy subset of **The Stack (bigcode/the-stack-dedup)**.
|
| 23 |
+
- **Fine-tuning (SFT)**: **Vipitis/Shadereval-inputs** (Shadertoy-oriented subset).
|
| 24 |
+
|
| 25 |
+
These datasets contain code under multiple licenses. If you redistribute outputs or data, ensure provenance and license compliance.
|
| 26 |
+
|
| 27 |
+
## Tokenizer
|
| 28 |
+
The tokenizer implementation is **heavily influenced by nanochat**:
|
| 29 |
+
- https://github.com/karpathy/nanochat
|
| 30 |
+
|
| 31 |
+
## Training Procedure (High-level)
|
| 32 |
+
- Decoder-only Transformer (GPT-style) trained from scratch.
|
| 33 |
+
- Pretrain on GLSL-heavy corpus, then SFT on Shadertoy-style examples.
|
| 34 |
+
- Optional copy-detection and automatic rejection are supported in the runtime.
|
| 35 |
+
|
| 36 |
+
## Evaluation
|
| 37 |
+
- Primary evaluation is **compile + render** for WebGL2 (moderngl), with metrics for:
|
| 38 |
+
- compile success
|
| 39 |
+
- render time
|
| 40 |
+
- black / static detection
|
| 41 |
+
- NaN / Inf detection
|
| 42 |
+
|
| 43 |
+
## How to Use (Recommended Runtime)
|
| 44 |
+
The reference runtime + WebUI are provided in the GitHub repo:
|
| 45 |
+
- https://github.com/hanasaan/FragLoop
|
| 46 |
+
|
| 47 |
+
From the `publish/` bundle, you can run:
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
# download from HF and start inference server
|
| 51 |
+
python infer/inference_server.py --hf-repo hanasaan/frag-loop
|
| 52 |
+
|
| 53 |
+
# start UI server
|
| 54 |
+
node ui_optional/server_node/server.js
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
Open `http://localhost:5173` in a browser.
|
| 58 |
+
|
| 59 |
+
## Limitations
|
| 60 |
+
- Outputs may occasionally fail to compile or render.
|
| 61 |
+
- The model can still produce outputs similar to training data. Use copy-detection when displaying or distributing outputs.
|
| 62 |
+
- Shader aesthetics and performance vary; manual curation is recommended for showcases.
|
| 63 |
+
|
| 64 |
+
## Acknowledgements
|
| 65 |
+
- Tokenizer influenced by **nanochat** (https://github.com/karpathy/nanochat).
|
| 66 |
+
- All implementation work in this repository was done by **GPT-5.2-Codex (xhigh)**.
|
| 67 |
+
|
| 68 |
+
## License
|
| 69 |
+
This model is trained on datasets with mixed licenses. Please review and comply with dataset licensing terms when using or redistributing the model or outputs.
|