AS-IF β Artificial Stupidity Image (Full)
β οΈ These are not my weights
This repository contains quantized ONNX exports of models trained by other people. I did not train them and I do not own them.
sd-turbo/derives from stabilityai/sd-turbo β Β© Stability AI, governed by the Stability AI licence and Acceptable Use Policy.tiny-sd/derives from segmind/tiny-sd, itself a pruned Stable Diffusion 1.5.Check the upstream licences before any use, especially commercial. My contribution is only the export, quantization and decoder swap described below. If Stability AI or Segmind object to this redistribution, contact me and I will remove it.
The counterpart to AS-I, which is mine: 13.7M parameters, 14 MB, trained from scratch on a laptop, and it only draws emoji. AS-IF is the other trade β someone else's billion-parameter model, compressed enough to ship.
| AS-I (mine) | AS-IF sd-turbo | AS-IF tiny-sd | |
|---|---|---|---|
| Weights by | me | Stability AI | Segmind |
| Size | 14 MB | 1216 MB | 454 MB |
| Steps | 8 | 2 | 4 |
| Time per image | 0.19 s | 2.2 s | 5.7 s |
| Resolution | 64Γ64 | 512Γ512 | 512Γ512 |
| Draws | ~1250 emoji | anything | anything |
Example input and output
python asif_sample.py --prompt "two astronauts playing chess" --steps 2
| Prompt | Result |
|---|---|
two astronauts playing chess |
both astronauts, a real chessboard |
a frog running a startup |
an excellent frog. No startup. |
a red car beside a blue house |
red car and blue house β spatial relation held |
a cat riding a bicycle |
cat and bicycle, not convincingly joined |
an apple on a wooden table |
correct, and clean |
a yellow bird sitting on a tree |
correct, and clean |
Four of six are what was asked. "A frog running a startup" produced a frog and dropped the abstraction β the honest failure mode of a 2-step distilled model: concrete nouns survive, conceptual framing does not.
What I actually did
1. Exported to ONNX and quantized per component, because they do not tolerate damage equally:
| Component | Precision | fp32 | after |
|---|---|---|---|
| UNet | int8 | 3.2 GB | 869 MB |
| Text encoder | int8 | 1.3 GB | 342 MB |
| VAE decoder | replaced | 189 MB | 4.9 MB |
2. Replaced the VAE decoder with TAESD rather than quantizing it. Quantizing it to int8 causes visible colour banding on flat regions for ~80 MB saved; replacing it saves 193 MB and runs faster, because SD's decoder is roughly a third of generation time at 512px on CPU.
Trap worth recording: TAESD's
scaling_factoris 1.0, so it consumes UNet-space latents directly. Dividing by SD's 0.18215 first β the move every SD decode example shows β hands it values 5.5Γ too large and returns psychedelic noise that reads as a broken model rather than a broken constant.
3. Measured a smaller base. tiny-sd/ is 2.7Γ smaller but not
step-distilled, so it needs classifier-free guidance β two UNet passes per step.
Four of its steps is 8 passes against sd-turbo's 2, hence 2.6Γ slower.
The build that would win does not exist off the shelf. Pruned and step-distilled β 454 MB at 2 passes β is the obvious combination and cannot be assembled: LCM-LoRA is trained against the full SD 1.5 UNet, so its tensors do not fit a pruned one (
lora_Awants[64, 1280, 3, 3], the pruned model has[64, 640, 3, 3]). Pruning and step-distillation do not compose after the fact.
Usage
git clone https://github.com/ayushmaninbox/artificial-stupidity
cd artificial-stupidity/as-image-model
pip install -r requirements.txt
python asif_sample.py --prompt "a wizard riding a motorcycle" --tiny-vae
SD-Turbo requires guidance_scale=0.0 β it is distilled without
classifier-free guidance, and the usual 7.5 produces washed-out output. Tiny-SD
is a normal SD 1.5 model and wants ~7.5.
You can rebuild both from scratch instead of downloading:
python asif_export.py --tiny-vae # sd-turbo, ~1216 MB
python asif_export.py --small --tiny-vae # tiny-sd, ~454 MB
Related
| artificial-stupidity-image | AS-I β 14 MB, from scratch, mine |
| artificial-stupidity | AS-F β the language model |
| artificial-stupidity-tiny | AS-0β¦AS-5, down to 83 KB |
License
Upstream terms govern. See Stability AI for
sd-turbo/ and segmind/tiny-sd for
tiny-sd/. The export scripts in the GitHub repo are MIT.
