ayushmaninbox commited on
Commit
da2a4d7
·
verified ·
1 Parent(s): efc7d45

Upload folder using huggingface_hub

Browse files
Files changed (7) hide show
  1. .gitattributes +2 -0
  2. AS-I-300-prior.pt +3 -0
  3. AS-I-prior.pt +3 -0
  4. AS-I-vae.pt +3 -0
  5. README.md +127 -0
  6. as-i-vs-300.png +3 -0
  7. as-i.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ as-i-vs-300.png filter=lfs diff=lfs merge=lfs -text
37
+ as-i.png filter=lfs diff=lfs merge=lfs -text
AS-I-300-prior.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14816b89893c8cfeb6e466a10ac46cd64d3f414155238bfd991babbe197089a3
3
+ size 109304673
AS-I-prior.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45ed8e3948810cb6b411eb0c89414a222a7f15b2c5af7f6fb411bf913ec92e4a
3
+ size 110273385
AS-I-vae.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3abef8deca23d05c1782666a0db4857b4ddea1d00e5d3c3447574b742e31dd6c
3
+ size 11028119
README.md ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags: [text-to-image, diffusion, tiny, from-scratch]
4
+ pipeline_tag: text-to-image
5
+ ---
6
+
7
+ # AS-I — Artificial Stupidity Image
8
+
9
+ A text-to-image latent diffusion model trained **entirely from scratch** on a
10
+ laptop. No Stable Diffusion, no CLIP, no pretrained weights of any kind.
11
+
12
+ **13.7M parameters. 14 MB at int8. 186 ms per image on a CPU.**
13
+
14
+ Two variants are included, and the difference between them is the point.
15
+
16
+ | | **AS-I** | **AS-I-300** |
17
+ |---|--:|--:|
18
+ | Glyphs it can draw | 1254 | 300 |
19
+ | Training samples per glyph | 36 | **150** |
20
+ | Final val loss | 0.0913 | **0.0374** |
21
+ | Size | 14 MB | 14 MB |
22
+ | Time per image | 186 ms | 192 ms |
23
+
24
+ ![AS-I vs AS-I-300](as-i-vs-300.png)
25
+
26
+ *Top row AS-I, bottom row AS-I-300, same prompts and seed:*
27
+ `red heart` · `pizza` · `grinning face` · `cat face` · `birthday cake` ·
28
+ `hamburger` · `strawberry` · `cookie`
29
+
30
+ Identical architecture, identical compute, identical size — **59% lower loss**,
31
+ and the difference is visible rather than statistical. AS-I-300's strawberry has
32
+ seeds and a leaf where AS-I's is a red blob; its cookie has chocolate chips; its
33
+ pizza has pepperoni.
34
+
35
+ > A fixed parameter budget buys a fixed amount of *detail*. Spreading it over 4×
36
+ > more identities spends it on breadth instead of sharpness. **Small models are
37
+ > not bad models — they are models that have to choose.**
38
+
39
+ ## Example input and output
40
+
41
+ ![AS-I samples](as-i.png)
42
+
43
+ ```python
44
+ python sample.py --prompt "red heart"
45
+ python sample.py --prompt "a large red heart in the center on a black background"
46
+ python sample.py --preset AS-I-300 --prompt "pizza"
47
+ ```
48
+
49
+ | Prompt | What it draws |
50
+ |---|---|
51
+ | `red heart` | a clean, correctly-shaped red heart |
52
+ | `soccer ball` | black-and-white ball, pentagon pattern intact |
53
+ | `rocket` | rocket body with fins and nose cone |
54
+ | `cat face` | orange cat face with ears and whiskers |
55
+ | `a small pizza in the top left on a navy background` | exactly that |
56
+
57
+ ## The prompt grammar — this is a closed vocabulary
58
+
59
+ ```
60
+ <name>
61
+ a <size> <name> in the <position> on a <bg> background
62
+
63
+ size small | medium | large
64
+ position top left | top | top right | left | center | right
65
+ bottom left | bottom | bottom right
66
+ bg white | black | navy | grey | cream | teal
67
+ ```
68
+
69
+ Prompt adherence, scored automatically over 120 prompts:
70
+
71
+ | Attribute | AS-I | AS-I-300 |
72
+ |---|--:|--:|
73
+ | background | 100% | 100% |
74
+ | size | 100% | 100% |
75
+ | position | 88% | 93% |
76
+
77
+ ## What it cannot do
78
+
79
+ **`two astronauts playing chess` — nothing.** It knows emoji names and placement
80
+ words. Novel *combinations* of known words compose fine (`pizza in the top left`
81
+ never appeared in training). Novel *concepts* do not, and no amount of training
82
+ at this size will change that.
83
+
84
+ Open-domain text-to-image needs ~1B parameters and ~150,000 A100-hours. This is
85
+ what the same problem looks like when the budget is a laptop and the rule is
86
+ that every weight has to be yours.
87
+
88
+ ## Architecture
89
+
90
+ ```
91
+ prompt -> word-level text encoder (0.45M params, trained here, NOT CLIP)
92
+ -> cross-attention U-Net (13.2M) on a 16x16x4 latent, 8 DDIM steps
93
+ -> VAE decoder -> 64x64 image
94
+ ```
95
+
96
+ **No codebook.** The obvious reference (RQ-VAE, [arXiv:2203.01941](https://arxiv.org/abs/2203.01941))
97
+ spends 16,384 codes × 256 dims × 4 quantizers ≈ 16.8M params — about **67 MB** —
98
+ on lookup tables alone, more than this entire model. A continuous 4-channel
99
+ latent needs no table.
100
+
101
+ **4× downsampling, not 8×.** Stable Diffusion uses 8×, but it applies that to
102
+ 512px images and lands on a 64×64 latent. Applying 8× to a 64px image lands on
103
+ 8×8 — the same ratio with 64× fewer cells — and reconstructs a rainbow as a
104
+ brown smear at 21.7 dB. At 4× it is 26.3 dB and colour survives.
105
+
106
+ ## Files
107
+
108
+ | File | What |
109
+ |---|---|
110
+ | `AS-I-prior.pt` | the 1254-glyph diffusion prior + text encoder |
111
+ | `AS-I-300-prior.pt` | the 300-glyph variant |
112
+ | `AS-I-vae.pt` | the autoencoder (shared by both) |
113
+
114
+ ## Usage
115
+
116
+ ```bash
117
+ git clone https://github.com/ayushmaninbox/artificial-stupidity
118
+ cd artificial-stupidity/as-image-model
119
+ pip install -r requirements.txt
120
+ python sample.py --prompt "red heart"
121
+ ```
122
+
123
+ ## License
124
+
125
+ MIT for code and weights. Training images are rendered from
126
+ [OpenMoji](https://openmoji.org) (CC BY-SA 4.0) — attribute OpenMoji if you
127
+ redistribute renders or derivatives.
as-i-vs-300.png ADDED

Git LFS Details

  • SHA256: e42a15452d7e6462d2a15983db079fcb1a30401493735845dca9e883524616d4
  • Pointer size: 131 Bytes
  • Size of remote file: 162 kB
as-i.png ADDED

Git LFS Details

  • SHA256: 51e0c6fbda4c8f5c4f03f9c8f4166ca9dd796635518495129804da2228627751
  • Pointer size: 131 Bytes
  • Size of remote file: 140 kB