Incorporo-user commited on
Commit
49afe28
·
verified ·
1 Parent(s): 5ee0736

Agate Preview 002: weights, pipeline, model card, figures

Browse files
.gitattributes CHANGED
@@ -33,3 +33,18 @@ 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
+ assets/battery_part1.png filter=lfs diff=lfs merge=lfs -text
37
+ assets/battery_part2.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/concept.png filter=lfs diff=lfs merge=lfs -text
39
+ assets/dashboard.png filter=lfs diff=lfs merge=lfs -text
40
+ assets/energy.png filter=lfs diff=lfs merge=lfs -text
41
+ assets/geneval_categories.png filter=lfs diff=lfs merge=lfs -text
42
+ assets/geneval_lineage.png filter=lfs diff=lfs merge=lfs -text
43
+ assets/hero_samples.png filter=lfs diff=lfs merge=lfs -text
44
+ assets/judge_detail.png filter=lfs diff=lfs merge=lfs -text
45
+ assets/loss.png filter=lfs diff=lfs merge=lfs -text
46
+ assets/masthead.png filter=lfs diff=lfs merge=lfs -text
47
+ assets/numbers.png filter=lfs diff=lfs merge=lfs -text
48
+ assets/pareto.png filter=lfs diff=lfs merge=lfs -text
49
+ assets/qib.png filter=lfs diff=lfs merge=lfs -text
50
+ assets/side_by_side.png filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LogoLabs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ pipeline_tag: text-to-image
6
+ base_model: Logolabs/agate-preview-001
7
+ base_model_relation: finetune
8
+ datasets:
9
+ - LucasFang/FLUX-Reason-6M
10
+ tags:
11
+ - text-to-image
12
+ - flow-matching
13
+ - rectified-flow
14
+ - compact
15
+ - 256px
16
+ - logolabs
17
+ - eurohpc
18
+ ---
19
+
20
+ <p align="center"><img src="assets/masthead.png" alt="Agate, model release 002: small model, broad imagination. 260M parameters, 256 x 256, research preview." width="100%"></p>
21
+
22
+ <p align="center"><img src="assets/numbers.png" alt="GenEval 0.577 on the official scorer; 260M parameters; 188 GPU-hours for the whole lineage; 1.9 s per image on an RTX 4060." width="100%"></p>
23
+
24
+ # Agate Preview 002
25
+
26
+ **Agate Preview 002 is Preview 001 trained for longer.** Same 260M-parameter network, same 256 × 256 output, same
27
+ text encoder and pipeline code. We branched 001's run at step 82,800, just before its cosine anneal, trained 38,710
28
+ more steps at a constant learning rate, and then ran the same 3-epoch anneal. It scores **0.577 on GenEval** with the official scorer (001:
29
+ 0.550) and **28.9 on Qwen-Image-Bench** (001: 28.2;
30
+ SD 1.5: 29.1).
31
+
32
+ It replaces 001 wherever 001 runs from Python: the weights have the same shapes and the `agate/` code is 001's.
33
+ The architecture, the design ideas and the full lineage are described in
34
+ [Agate Preview 001](https://huggingface.co/Logolabs/agate-preview-001); this card covers what changed.
35
+
36
+ Built by [LogoLabs](https://logolabs.org), which makes AI logo generation.
37
+
38
+ <p align="center"><img src="assets/hero_samples.png" alt="Twelve Agate Preview 002 samples at 256 px, seed 0" width="100%"></p>
39
+
40
+ ## At a glance
41
+
42
+ | | |
43
+ |---|---|
44
+ | **What** | Text-to-image, 256 × 256, English prompts |
45
+ | **Size** | 260M parameters with TAESD, 308.5M with SD-VAE: 190.9M generator + 68.1M text encoder + decoder (as 001) |
46
+ | **Training** | 001's first 82,800 steps, then 55,210 more at batch 1,024: 138,010 steps, 186.6M images seen (≈33 epochs) |
47
+ | **Compute** | 187.7 GH200-hours for the whole lineage from scratch (61.0 of them for the continuation), 107.1 kWh, 3.21 kg CO₂e, measured with perun |
48
+ | **GenEval** (official) | **0.577** (001: 0.550). SDXL 0.55, SD 2.1 0.50, PixArt-α 0.48, SD 1.5 0.43 (published) |
49
+ | **Qwen-Image-Bench** (1,000 prompts) | **28.9** (001: 28.2; SD 1.5: 29.1) |
50
+ | **Speed** | Same network as 001: 1.9 s per image on an RTX 4060 (50 steps, CUDA graphs), timed on 001 |
51
+ | **ComfyUI / browser** | Not yet updated for 002 (see below) |
52
+ | **Licence** | MIT, for code and weights |
53
+ | **Status** | Research preview |
54
+
55
+ ## What changed from 001
56
+
57
+ | | Preview 001 | Preview 002 |
58
+ |---|---|---|
59
+ | Training after step 82,800 | cosine anneal to 2e-5 over 16,500 steps (3 epochs) | 38,710 more steps at lr 2e-4, then the same 16,500-step cosine anneal to 2e-5 |
60
+ | Final step | 99,250 | 138,010 |
61
+ | GenEval, official, 4 images per prompt | 0.550 | **0.577** |
62
+ | Qwen-Image-Bench, 1,000 prompts | 28.2 | **28.9** |
63
+ | FID-5k / FD-DINOv2 (internal, COCO) | 33.70 / 419 | 34.01 / 413 |
64
+ | Architecture, text encoder, pipeline | | unchanged (the fine-tuned Ettin kept training at lr 1e-5) |
65
+
66
+ The gain comes from more training at a constant learning rate followed by the same anneal, nothing else: same data,
67
+ same caption mix, same batch.
68
+
69
+ ## Quick start
70
+
71
+ ```bash
72
+ pip install torch transformers diffusers safetensors huggingface_hub pillow invisible-watermark
73
+ ```
74
+
75
+ ```python
76
+ import sys
77
+ from huggingface_hub import snapshot_download
78
+
79
+ path = snapshot_download("Logolabs/agate-preview-002")
80
+ sys.path.insert(0, path)
81
+ import agate
82
+ from agate import AgatePipeline
83
+
84
+ pipe = AgatePipeline.from_pretrained(path, device="cuda") # "cpu" works too, slowly
85
+ image = pipe("a green teapot and a red cup on a table", seed=0)[0]
86
+ agate.save(image, "teapot.png") # keeps the AI-generated metadata in the PNG
87
+ ```
88
+
89
+ The arguments are 001's: `seed`, `steps` (50), `cfg` (3.0), `negative_prompt` (""), `num_images`, `autoguide`, and
90
+ `fast_vae` / `cuda_graphs` in `from_pretrained`; new in 002 are `watermark`, `metadata` and `record_prompt` (see
91
+ [AI-generated content marking](#ai-generated-content-marking)). Install `invisible-watermark` as well (in
92
+ `requirements.txt`). `autoguide` steers away from the same guide model 001 ships (T40r
93
+ step 27,600, in `guide/`); we have not re-tuned its strength for 002.
94
+
95
+ **ComfyUI and the WebGPU demo are not yet updated for 002.** The
96
+ [ComfyUI nodes](https://github.com/logolabs/agate-comfyui) download 001's single-file checkpoint, and the
97
+ [WebGPU Space](https://huggingface.co/spaces/Logolabs/agate-webgpu) runs 001's ONNX export. Because 002 is the same
98
+ network, the same converters should apply unchanged, but no 002 single-file checkpoint or ONNX export is published or
99
+ tested yet.
100
+
101
+ ## Results
102
+
103
+ All scores were measured by us with the same seeds, sampler and scorer for every model. Each model generated at its
104
+ own resolution; every scorer saw 512 × 512 (Lanczos).
105
+
106
+ ### GenEval (official scorer)
107
+
108
+ <p align="center"><img src="assets/geneval_lineage.png" alt="GenEval overall, one image per prompt, for every model in the lineage including Preview 002" width="100%"></p>
109
+
110
+ The official [GenEval](https://github.com/djghosh13/geneval) pipeline on all 553 prompts, four images per prompt
111
+ (2,212 images), generated on Arrhenius and scored locally, as for 001:
112
+
113
+ | | Single | Two obj. | Counting | Colours | Position | Colour attr. | **Overall** |
114
+ |---|---|---|---|---|---|---|---|
115
+ | **Agate Preview 002** | 0.925 | 0.629 | 0.425 | 0.755 | 0.273 | 0.455 | **0.577** |
116
+ | Agate Preview 001 | 0.916 | 0.581 | 0.381 | 0.753 | 0.212 | 0.458 | 0.550 |
117
+
118
+ With one image per prompt (the protocol of the chart above), 002 scores 0.581, against 001's
119
+ 0.535 and SD 1.5's 0.398. The same seeds generated on a workstation
120
+ GPU instead of the cluster score 0.586: bf16 and hardware nondeterminism move GenEval by about ±0.01, so
121
+ we quote the cluster number.
122
+
123
+ <p align="center"><img src="assets/geneval_categories.png" alt="GenEval by category for Preview 002, Preview 001 and SD 1.5" width="100%"></p>
124
+
125
+ ### Qwen-Image-Bench
126
+
127
+ [Qwen-Image-Bench](https://huggingface.co/Qwen/Qwen-Image-Bench) with its judge, Q-Judger (27B), run exactly as
128
+ published, on all 1,000 prompts:
129
+
130
+ <p align="center"><img src="assets/qib.png" alt="Qwen-Image-Bench for Preview 002, Preview 001 and similar-size open models" width="100%"></p>
131
+
132
+ | Model | Native | **Total** | Quality | Aesthetics | Alignment | Real-world Fidelity | Creative Generation |
133
+ |---|---|---|---|---|---|---|---|
134
+ | **Agate Preview 002** | 256 px | **28.9** | 26.4 | 34.5 | 29.7 | 37.0 | 14.5 |
135
+ | Agate Preview 001 | 256 px | 28.2 | 25.9 | 33.8 | 28.2 | 36.6 | 14.7 |
136
+ | Stable Diffusion 1.5 | 512 px | 29.1 | 36.7 | 28.0 | 25.7 | 38.9 | 15.5 |
137
+ | TinyDiT-256 | 256 px | 26.0 | 22.3 | 30.2 | 27.8 | 37.2 | 12.7 |
138
+ | HobbyLM-Image | 1024 px | 24.0 | 31.5 | 26.0 | 18.1 | 34.7 | 8.7 |
139
+ | Supra2-IMG | 256 px | 17.8 | 12.7 | 23.5 | 16.5 | 33.3 | 5.9 |
140
+
141
+ 002 improves on 001 in four of the five areas and closes most of the gap to SD 1.5 (29.1); like
142
+ 001, it leads SD 1.5 on alignment and aesthetics and trails on judged quality, where its 256 px images are upscaled
143
+ for the judge.
144
+
145
+ <p align="center"><img src="assets/pareto.png" alt="Qwen-Image-Bench total against model size" width="100%"></p>
146
+
147
+ <p align="center"><img src="assets/judge_detail.png" alt="Every Qwen-Image-Bench area" width="100%"></p>
148
+
149
+ ### Internal image metrics
150
+
151
+ COCO-5k, our own eval suite, 50 steps, CFG 3 (not comparable with other papers' FID):
152
+ FID 34.01 and FD-DINOv2 413 for 002, against 33.70 and 419 for
153
+ 001: flat, as expected for models that never saw a photograph.
154
+
155
+ ## Side by side
156
+
157
+ <p align="center"><img src="assets/side_by_side.png" alt="SD 1.5, Preview 001 and Preview 002 on 14 prompts, same seed" width="100%"></p>
158
+
159
+ ## Manual test battery
160
+
161
+ 60 prompts in 16 categories, two seeds each, rendered once with the released settings and shown uncurated.
162
+
163
+ <p align="center"><img src="assets/battery_part1.png" alt="Battery prompts 0 to 29" width="100%"></p>
164
+ <p align="center"><img src="assets/battery_part2.png" alt="Battery prompts 30 to 59" width="100%"></p>
165
+
166
+ The weaknesses are 001's: exact text, counts above four, negation, and anything above 256 px.
167
+
168
+ ## How Agate works
169
+
170
+ <p align="center"><img src="assets/concept.png" alt="Plan, then paint: the thinker plans the layout, the convolutional renderer paints it (figure from Preview 001)" width="100%"></p>
171
+
172
+ Unchanged from 001: a small recurrent transformer (the thinker) reads the prompt and plans a 16 × 16 region map;
173
+ a convolutional U-Net built on FCDM paints by following it. The figure and the numbers in it are from Preview 001's
174
+ card, which describes the design in full.
175
+
176
+ ## Training
177
+
178
+ | | |
179
+ |---|---|
180
+ | Steps 0 – 82,800 | Preview 001's run: phases 1 and 2, then the caption phase at constant lr (see 001's card) |
181
+ | Steps 82,800 – 121,510 | batch 1,024 on 2 nodes × 4 GH200, lr 2e-4 constant, caption mix, 512 text tokens, Ettin trained at 1e-5 |
182
+ | Steps 121,510 – 138,010 | cosine anneal to 2e-5 (3 epochs); EMA weights released |
183
+ | Continuation | job 3004575, 7 h 37 min, 61.0 GH200-hours |
184
+
185
+ <p align="center"><img src="assets/loss.png" alt="Training loss against epochs for every model, Preview 002 in red" width="100%"></p>
186
+
187
+ The loss kept following the same slow log-shaped decline at constant learning rate (no plateau), and the anneal
188
+ was worth about 0.02 of loss, the same as 001's.
189
+
190
+ <p align="center"><img src="assets/dashboard.png" alt="Preview 002 training dashboard" width="100%"></p>
191
+
192
+ ## Training data and safety
193
+
194
+ Preview 002 was trained on the same data as Preview 001: [FLUX-Reason-6M](https://huggingface.co/datasets/LucasFang/FLUX-Reason-6M),
195
+ a curated, fully synthetic dataset of compositional and reasoning prompts. Its authors document quality filtering
196
+ but no NSFW filter, and we have not audited all 5.65M images.
197
+
198
+ **Red-teaming.** Preview 001 was red-teamed before its release: it did not produce child sexual abuse material or
199
+ any sexualised depiction of a minor, and attempts at adult nudity gave at most a blurry figure without anatomical
200
+ detail. **We have not repeated these tests for Preview 002.** It has the same data and architecture, but it trained for 39% more steps, so
201
+ 001's results are an expectation for this model, not a measurement of it.
202
+
203
+ **Unprompted nudity.** On the benign battery prompt "a person waving hello, upper body", Agate (every preview,
204
+ including 001) can draw the person topless without being asked. The affected cells in the test battery are shown
205
+ blurred and labelled rather than replaced, so the sheet stays uncurated. Expect this on other prompts about people;
206
+ use a negative prompt (for example "nudity, topless") or an output filter where it matters.
207
+
208
+ Agate ships without a safety classifier; public-facing deployments should add one. Using Agate, or any model
209
+ derived from it, to depict minors sexually, to create non-consensual intimate imagery, or to depict real people
210
+ deceptively is prohibited and, in most jurisdictions, illegal. Report any such output to LogoLabs through
211
+ [logolabs.org](https://logolabs.org).
212
+
213
+ ## AI-generated content marking
214
+
215
+ Every image the pipeline returns is marked as AI-generated in two ways (on by default; `watermark=False` and
216
+ `metadata=False` switch them off):
217
+
218
+ - **An invisible watermark** in the pixels ([invisible-watermark](https://github.com/ShieldMnt/invisible-watermark),
219
+ method `dwtDctSvd`) carrying the fixed payload `AGATE002`. In our tests it survived a PNG round trip, a JPEG
220
+ re-save at quality 90 and a 0.75× resize, and was absent from images Agate did not generate
221
+ (38 dB PSNR against the unmarked image).
222
+ - **Provenance metadata** in `img.info`: `ai_generated: true`, `generator: Agate Preview 002 (LogoLabs)`,
223
+ `model: Logolabs/agate-preview-002`. Save with `agate.save(img, "out.png")` to keep it as PNG text chunks. The
224
+ prompt and seed are recorded only with `record_prompt=True`.
225
+
226
+ ```python
227
+ from PIL import Image
228
+ from agate import detect_watermark
229
+ print(detect_watermark(Image.open("out.png"))) # {'detected': True, 'bit_accuracy': 1.0, ...}
230
+ ```
231
+
232
+ Both marks can be removed: metadata is lost on most re-encodes, and heavy edits or deliberate attacks can erase the
233
+ watermark. They help tell Agate output apart; they are not proof of origin. Anyone deploying Agate must still label
234
+ AI-generated or manipulated content themselves where the EU AI Act (Art. 50) or other rules require it. C2PA content
235
+ credentials are planned, not yet implemented.
236
+
237
+ ## Compute and energy
238
+
239
+ <p align="center"><img src="assets/energy.png" alt="Energy of every GPU job in the Agate project" width="100%"></p>
240
+
241
+ Every GPU job was wrapped in [perun](https://github.com/Helmholtz-AI-Energy/perun). Energy at the wall assumes a PUE
242
+ of 1.3; CO₂e assumes 30 g/kWh (Swedish SE3 grid). Neither factor is confirmed by NAISS yet; seconds perun did not
243
+ cover count at idle power, so the totals are a floor.
244
+
245
+ | Run | Jobs | GH200-h | kWh | kg CO₂e |
246
+ |---|---|---|---|---|
247
+ | Latent cache (SD-VAE encode of the dataset) | 11 | 4.2 | 2.6 | 0.08 |
248
+ | FCDM v1, epochs 1-10 | 2 | 13.7 | 8.7 | 0.26 |
249
+ | FCDM v1, epochs 11-20 + Flan-T5 fine-tune | 1 | 20.6 | 13.5 | 0.41 |
250
+ | DiT reproduction, epochs 1-10 | 1 | 13.1 | 8.8 | 0.26 |
251
+ | fcdm2, all phases incl. restarts | 14 | 68.0 | 33.8 | 1.01 |
252
+ | Run 1 thinker, epochs 1-10 | 1 | 19.0 | 12.6 | 0.38 |
253
+ | T40r first try (diverged at step ~1,800) | 1 | 7.8 | 3.0 | 0.09 |
254
+ | **T40r phase 1 (epochs 1-10)** | 1 | 47.3 | 27.7 | 0.83 |
255
+ | **T40r phase 2 (joint Ettin training, to epoch 16)** | 1 | 37.1 | 18.8 | 0.56 |
256
+ | **T40r caption phase (2 nodes, 8 h, cosine anneal)** | 1 | 60.3 | 35.2 | 1.06 |
257
+ | T40r caption phase, two failed starts | 2 | 3.5 | 0.5 | 0.02 |
258
+ | **Agate 002: cap2 continuation, 82.8k to 138k** | 1 | 61.0 | 35.9 | 1.08 |
259
+ | 001 release benchmark and GenEval | 3 | 5.1 | 2.7 | 0.08 |
260
+ | A/B wave 1 (six 256 px arms) + noise-scale study | 9 | 17.5 | 8.7 | 0.26 |
261
+ | A/B wave 2 (does 512 px work?) | 2 | 12.1 | 6.7 | 0.20 |
262
+ | A/B wave 2, failed attempts | 4 | 3.0 | 1.4 | 0.04 |
263
+ | 512 px latents + saliency maps (data prep) | 21 | 22.5 | 14.7 | 0.44 |
264
+ | Perceptual-loss profiling | 2 | 1.3 | 0.5 | 0.02 |
265
+ | Perceptual-loss profiling, OOM | 2 | 0.6 | 0.1 | 0.00 |
266
+ | Research after 003: logo LoRA, router, MoE pilots | 34 | 68.5 | 32.7 | 0.98 |
267
+ | 512 px runs that became 003 (long1, long2, perc1) | 3 | 113.5 | 68.2 | 2.05 |
268
+ | Evaluations, smoke tests, benchmarks | 47 | 30.9 | 11.7 | 0.35 |
269
+ | **Whole Agate project to 2026-09-28** | 164 | **630.4** | **348.6** | **10.46** |
270
+
271
+ Preview 002's own lineage, counted from scratch with the caption-phase job pro-rated to the 82,800 steps 002
272
+ inherits, cost **187.7 GH200-hours, 107.1 kWh and 3.21 kg CO₂e**. The whole project to
273
+ date, including Preview 003 and every experiment, cost 630.4 GPU-hours.
274
+
275
+ **Training compute.** Estimated at **~6e19 FLOP** (5.8e19–7.2e19): measured forward FLOPs per image (94.4 GFLOP per 256 px image for the generator, 10.8 GFLOP for the text encoder at 128 tokens; `torch.utils.flop_counter`) × the 186.6M images seen in the whole lineage × 3 for the backward pass. Counting the pretraining of the Ettin-68M text encoder we started from (~8e20 FLOP, per its authors) gives ~9e20 FLOP. Both are far below the 1e23 FLOP indicative threshold for general-purpose AI models in the European Commission's guidelines. The compute that third parties used to generate the synthetic training images (FLUX-Reason-6M) is not included.
276
+
277
+ ## Limitations and intended use
278
+
279
+ - **256 × 256 only.** For 512 px, see Preview 003.
280
+ - **Text rendering is unreliable**, as are counts above four and negations ("no", "empty", "without").
281
+ - **Synthetic training data.** Every training image was generated by FLUX.1-dev; Agate inherits its look and biases.
282
+ - **No safety classifier** is bundled. Do not use Agate to depict real people or to deceive.
283
+ - Intended for research, education, prototyping and small-footprint deployment.
284
+
285
+ ## Licence
286
+
287
+ **MIT**, for the code and the weights (see `LICENSE`). Agate was trained on
288
+ [FLUX-Reason-6M](https://huggingface.co/datasets/LucasFang/FLUX-Reason-6M) (Apache-2.0 per its dataset card),
289
+ whose images were generated with FLUX.1-dev. The text encoder is fine-tuned from Ettin-68M (MIT); the SD-VAE and
290
+ TAESD decoders (MIT) are downloaded from their own repositories.
291
+
292
+ ## Acknowledgements
293
+
294
+ <p align="center"><img src="assets/acknowledgment-banner.png" alt="EuroHPC Joint Undertaking and Arrhenius" width="100%"></p>
295
+
296
+ **We acknowledge EuroHPC JU for awarding the project ID EHPC-AIF-2026PG01-907 access to resources on Arrhenius GPU
297
+ at NAISS, Sweden.**
298
+
299
+ Thank you to the EuroHPC Joint Undertaking, and to NAISS for running Arrhenius. A small team cannot usually train
300
+ a text-to-image model from scratch; this allocation made it possible, and made it possible to do it openly.
301
+ Every LogoLabs model in this card, Preview 002 and every checkpoint it descends from, was trained under that
302
+ EuroHPC AI Factory allocation.
303
+
304
+ Thanks also to:
305
+ - the authors of [FLUX-Reason-6M](https://huggingface.co/datasets/LucasFang/FLUX-Reason-6M);
306
+ - [Ettin](https://huggingface.co/jhu-clsp/ettin-encoder-68m) (JHU CLSP);
307
+ - [SD-VAE-ft-MSE](https://huggingface.co/stabilityai/sd-vae-ft-mse) (Stability AI);
308
+ - [TAESD](https://huggingface.co/madebyollin/taesd) (Ollin Boer Bohan);
309
+ - [GenEval](https://github.com/djghosh13/geneval) (Ghosh et al.);
310
+ - [Qwen-Image-Bench](https://huggingface.co/Qwen/Qwen-Image-Bench) (Qwen team);
311
+ - [perun](https://github.com/Helmholtz-AI-Energy/perun);
312
+ - [SupraLabs](https://huggingface.co/SupraLabs/Supra2-IMG), for Supra2-IMG, the baseline this work started from.
313
+
314
+ ## More from LogoLabs
315
+
316
+ [LogoLabs](https://logolabs.org) makes AI logo generation. Our open releases are all at
317
+ [huggingface.co/Logolabs](https://huggingface.co/Logolabs):
318
+
319
+ | | |
320
+ |---|---|
321
+ | [**Inkvec**](https://huggingface.co/spaces/Logolabs/inkvec) | Exact SVG from logos, icons and flat artwork, entirely in your browser (WebAssembly). |
322
+ | [**Inkvec Denoiser**](https://huggingface.co/Logolabs/inkvec-denoiser-001) | 19.7M-parameter cleanup of JPEG, WebP and VAE damage before tracing. |
323
+ | [**Inkvec Super-Resolution**](https://huggingface.co/Logolabs/inkvec-sr-001) | 4× upscaling for logos and icons, fine-tuned MambaIRv2-Small. |
324
+ | [**LogoBrief-10K**](https://huggingface.co/datasets/Logolabs/LogoBrief-10K) | 10,000 brand logos with SVGs, design briefs and style tags, opt-out audited before publication. |
325
+
326
+ ## References
327
+
328
+ Architecture and training:
329
+ - Kwon et al., *Reviving ConvNeXt for Efficient Convolutional Diffusion Models* (FCDM), [arXiv:2603.09408](https://arxiv.org/abs/2603.09408): the renderer's block and U-Net.
330
+ - Liu et al., *A ConvNet for the 2020s*, [arXiv:2201.03545](https://arxiv.org/abs/2201.03545); Woo et al., *ConvNeXt V2* (GRN), [arXiv:2301.00808](https://arxiv.org/abs/2301.00808).
331
+ - Jabri et al., *Scalable Adaptive Computation for Iterative Generation* (RIN), [arXiv:2212.11972](https://arxiv.org/abs/2212.11972); Jaegle et al., *Perceiver* / *Perceiver IO*, [arXiv:2103.03206](https://arxiv.org/abs/2103.03206), [arXiv:2107.14795](https://arxiv.org/abs/2107.14795): latent cells that read the image.
332
+ - Geiping et al., *Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach*, [arXiv:2502.05171](https://arxiv.org/abs/2502.05171): the thinker's looped core.
333
+ - Su et al., *RoFormer* (RoPE), [arXiv:2104.09864](https://arxiv.org/abs/2104.09864); Henry et al., *Query-Key Normalization*, [arXiv:2010.04245](https://arxiv.org/abs/2010.04245); Wortsman et al., *Small-scale proxies for large-scale Transformer training instabilities*, [arXiv:2309.14322](https://arxiv.org/abs/2309.14322).
334
+ - Perez et al., *FiLM*, [arXiv:1709.07871](https://arxiv.org/abs/1709.07871); Park et al., *SPADE*, [arXiv:1903.07291](https://arxiv.org/abs/1903.07291): per-region steering.
335
+ - Zhang et al., *ControlNet*, [arXiv:2302.05543](https://arxiv.org/abs/2302.05543): zero-initialised growth.
336
+ - Liu et al., *Rectified Flow*, [arXiv:2209.03003](https://arxiv.org/abs/2209.03003); Lipman et al., *Flow Matching*, [arXiv:2210.02747](https://arxiv.org/abs/2210.02747); Esser et al., *SD3*, [arXiv:2403.03206](https://arxiv.org/abs/2403.03206).
337
+ - Ho & Salimans, *Classifier-Free Guidance*, [arXiv:2207.12598](https://arxiv.org/abs/2207.12598); Karras et al., *Guiding a Diffusion Model with a Bad Version of Itself* (autoguidance), [arXiv:2406.02507](https://arxiv.org/abs/2406.02507).
338
+ - Weller et al., *Ettin* (Seq vs Seq), [arXiv:2507.11412](https://arxiv.org/abs/2507.11412); Warner et al., *ModernBERT*, [arXiv:2412.13663](https://arxiv.org/abs/2412.13663).
339
+ - Rombach et al., *Latent Diffusion*, [arXiv:2112.10752](https://arxiv.org/abs/2112.10752); SD-VAE-ft-MSE; TAESD.
340
+ - Loshchilov & Hutter, *AdamW*, [arXiv:1711.05101](https://arxiv.org/abs/1711.05101); Kumar et al., *Fine-Tuning can Distort Pretrained Features* (LP-FT), [arXiv:2202.10054](https://arxiv.org/abs/2202.10054).
341
+
342
+ Data and evaluation:
343
+ - Fang et al., *FLUX-Reason-6M & PRISM-Bench*, [arXiv:2509.09680](https://arxiv.org/abs/2509.09680).
344
+ - Ghosh et al., *GenEval*, [arXiv:2310.11513](https://arxiv.org/abs/2310.11513); Cheng et al., *Mask2Former*, [arXiv:2112.01527](https://arxiv.org/abs/2112.01527); Radford et al., *CLIP*, [arXiv:2103.00020](https://arxiv.org/abs/2103.00020).
345
+ - Li et al., *Qwen-Image-Bench*, [arXiv:2605.28091](https://arxiv.org/abs/2605.28091); Kwon et al., *vLLM*, [arXiv:2309.06180](https://arxiv.org/abs/2309.06180).
346
+ - Heusel et al., *FID*, [arXiv:1706.08500](https://arxiv.org/abs/1706.08500); Stein et al., *FD-DINOv2*, [arXiv:2306.04675](https://arxiv.org/abs/2306.04675); Oquab et al., *DINOv2*, [arXiv:2304.07193](https://arxiv.org/abs/2304.07193).
347
+ - Gutiérrez Hermosillo Muriedas et al., *perun*, Euro-Par 2023.
348
+
349
+ Compared and related models:
350
+ - Podell et al., *SDXL*, [arXiv:2307.01952](https://arxiv.org/abs/2307.01952); Chen et al., *PixArt-α*, [arXiv:2310.00426](https://arxiv.org/abs/2310.00426) and *PixArt-Σ*, [arXiv:2403.04692](https://arxiv.org/abs/2403.04692); Bai et al., *Meissonic*, [arXiv:2410.08261](https://arxiv.org/abs/2410.08261).
351
+ - Xie et al., *SANA*, [arXiv:2410.10629](https://arxiv.org/abs/2410.10629); Sehwag et al., *MicroDiT*, [arXiv:2407.15811](https://arxiv.org/abs/2407.15811); Pernias et al., *Würstchen*, [arXiv:2306.00637](https://arxiv.org/abs/2306.00637); Hu et al., *SnapGen*, [arXiv:2412.09619](https://arxiv.org/abs/2412.09619).
352
+ - [Supra2-IMG](https://huggingface.co/SupraLabs/Supra2-IMG), [TinyDiT-256](https://huggingface.co/ivanmikhnenkov/tinydit-256), [HobbyLM-Image](https://huggingface.co/rootxhacker/HobbyLM-Image).
353
+
354
+ The technical report cites 119 works in full.
355
+
356
+ ## Citation
357
+
358
+ ```bibtex
359
+ @misc{logolabs2026agate002,
360
+ title = {{Agate Preview 002: a 260M text-to-image model}},
361
+ author = {Deleanu, Stefan-Lucian},
362
+ organization = {LogoLabs},
363
+ year = {2026},
364
+ howpublished = {\url{https://huggingface.co/Logolabs/agate-preview-002}}
365
+ }
366
+ ```
367
+
368
+ <p align="center"><img src="assets/colophon.png" alt="LogoLabs, Agate Preview 002, released under the MIT licence" width="70%"></p>
agate/__init__.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ """Agate by LogoLabs: a 0.26B text-to-image model (thinker-steered convolutional flow model +
2
+ fine-tuned Ettin-68M text encoder + SD-VAE decoder). See AgatePipeline."""
3
+ from .marking import detect_watermark, provenance, save
4
+ from .pipeline import AgatePipeline
5
+
6
+ __all__ = ["AgatePipeline", "detect_watermark", "provenance", "save"]
agate/fcdm_planner.py ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FCDM-P: a pure-convolution denoiser driven by a recurrent planner with memory.
2
+
3
+ Design (2026-09-24, from the fcdm2 ablations; see research_notes/daily/2026-09-24.txt):
4
+ the denoiser has NO attention and NO timestep modulation of its own. All global reasoning
5
+ and all conditioning live in a small transformer PLANNER that runs once per sampling step:
6
+
7
+ PERCEIVER planner queries (64 grid tokens = an 8x8 plan, 16 global, 16 memory tokens)
8
+ read, by softmax cross-attention, the current noisy latent (2x2 patches) and
9
+ both memory canvases -- every position carries Fourier coordinates, so the
10
+ reads are position-aware. Cost is linear in the number of positions.
11
+ PLANNER self-attention over the queries + cross-attention to the text tokens, with
12
+ the timestep added to every query. It is the only place t and the text enter.
13
+ OUTPUTS (1) ONE spatial MODULATION MAP (d_mod = 2048 per region of the 8x8 grid, a
14
+ single linear layer on the planner's grid tokens -- the planner is a pure
15
+ transformer, no MLP heads), shared by the whole denoiser: every conv block
16
+ decodes its own shift/scale/gate from it with its own 1x1 at 8x8, bilinearly
17
+ upsampled to the block's resolution -- the plan is smooth, the convs do detail;
18
+ (2) the coarse canvas and the memory tokens for the next step (gated writes).
19
+
20
+ Memory carried from step to step (all start at zero, all writes gated and zero-initialised):
21
+ coarse canvas 8x8 x mem_c written by the planner's grid tokens (the plan, on the grid)
22
+ mid canvas 16x16 x mem_m written by the conv decoder at 16x16 (ConvGRU-style gate)
23
+ memory tokens 16 x mem_tok written by the planner (its working memory)
24
+ Both canvases are read by the convolutions (resized and added at every level) and by the
25
+ perceiver. Nothing in the loss constrains the memory: it is free to hold whatever helps
26
+ later steps (layout, bindings, counts, confidence).
27
+
28
+ Conventions: t=0 is noise, t=1 is data, the model predicts the velocity x1 - x0. One call
29
+ is one sampling step: forward(z, t, ctx, mask, state) -> (velocity, new_state); state=None
30
+ starts a chain. Classifier-free guidance keeps one state per branch.
31
+ """
32
+ from __future__ import annotations
33
+
34
+ import math
35
+
36
+ import torch
37
+ import torch.nn as nn
38
+ import torch.nn.functional as F
39
+
40
+ from .fcdm_t2i import GRN, LayerNorm2d, TimestepEmbedder
41
+
42
+ LEVELS = ("enc0", "enc1", "mid", "dec1", "dec0")
43
+
44
+
45
+ def fourier_coords(h: int, w: int, n_freq: int, device) -> torch.Tensor:
46
+ """(h*w, 4*n_freq) sin/cos of normalised pixel-centre coordinates in [-1, 1]."""
47
+ ys = (torch.arange(h, device=device, dtype=torch.float32) + 0.5) / h * 2 - 1
48
+ xs = (torch.arange(w, device=device, dtype=torch.float32) + 0.5) / w * 2 - 1
49
+ yy, xx = torch.meshgrid(ys, xs, indexing="ij")
50
+ f = (2.0 ** torch.arange(n_freq, device=device, dtype=torch.float32)) * math.pi
51
+ feats = [fn(c.reshape(-1, 1) * f) for c in (xx, yy) for fn in (torch.sin, torch.cos)]
52
+ return torch.cat(feats, 1)
53
+
54
+
55
+ class SpatialModBlock(nn.Module):
56
+ """FCDM block (7x7 DWConv -> LN -> modulate -> 1x1 expand -> GELU -> GRN -> 1x1 -> gate)
57
+ whose shift/scale/gate are per-PIXEL maps from the planner. The projection runs at the
58
+ planner grid (8x8) and the result is upsampled; zero-initialised, so the block starts
59
+ as the identity (gate 0)."""
60
+
61
+ def __init__(self, dim: int, d_mod: int, expansion: int = 3):
62
+ super().__init__()
63
+ self.dwconv = nn.Conv2d(dim, dim, 7, padding=3, groups=dim)
64
+ self.norm = LayerNorm2d(dim, affine=False)
65
+ self.pw1 = nn.Conv2d(dim, expansion * dim, 1)
66
+ self.act = nn.GELU()
67
+ self.grn = GRN(expansion * dim)
68
+ self.pw2 = nn.Conv2d(expansion * dim, dim, 1)
69
+ self.mod = nn.Conv2d(d_mod, 3 * dim, 1)
70
+ nn.init.zeros_(self.mod.weight)
71
+ nn.init.zeros_(self.mod.bias)
72
+
73
+ def forward(self, x: torch.Tensor, m: torch.Tensor) -> torch.Tensor:
74
+ mod = self.mod(m) # (B, 3C, 8, 8)
75
+ if mod.shape[-2:] != x.shape[-2:]:
76
+ mod = F.interpolate(mod, size=x.shape[-2:], mode="bilinear", align_corners=False)
77
+ shift, scale, gate = mod.chunk(3, dim=1)
78
+ h = self.norm(self.dwconv(x)) * (1 + scale) + shift
79
+ h = self.pw2(self.grn(self.act(self.pw1(h))))
80
+ return x + gate * h
81
+
82
+
83
+ class ConvLevel(nn.Module):
84
+ """`depth` modulated blocks at one resolution; the resized canvases are added first
85
+ through a zero-initialised 1x1 (the level starts blind to the memory)."""
86
+
87
+ def __init__(self, dim: int, depth: int, d_mod: int, expansion: int, mem_in: int):
88
+ super().__init__()
89
+ self.blocks = nn.ModuleList(SpatialModBlock(dim, d_mod, expansion) for _ in range(depth))
90
+ self.mem_in = nn.Conv2d(mem_in, dim, 1)
91
+ nn.init.zeros_(self.mem_in.weight)
92
+ nn.init.zeros_(self.mem_in.bias)
93
+
94
+ def forward(self, x, m, mem):
95
+ x = x + self.mem_in(F.interpolate(mem, size=x.shape[-2:], mode="bilinear", align_corners=False))
96
+ for blk in self.blocks:
97
+ x = blk(x, m)
98
+ return x
99
+
100
+
101
+ class XBlock(nn.Module):
102
+ """Pre-LN transformer layer: self-attention over the queries (optional), cross-attention
103
+ to a context (optional), MLP. Queries get the timestep embedding added by the caller."""
104
+
105
+ def __init__(self, dim: int, heads: int, ctx_dim: int | None, self_attn: bool = True, mlp: int = 2):
106
+ super().__init__()
107
+ self.sa = nn.MultiheadAttention(dim, heads, batch_first=True) if self_attn else None
108
+ self.n_sa = nn.LayerNorm(dim) if self_attn else None
109
+ self.xa = (nn.MultiheadAttention(dim, heads, batch_first=True, kdim=ctx_dim, vdim=ctx_dim)
110
+ if ctx_dim else None)
111
+ self.n_xa = nn.LayerNorm(dim) if ctx_dim else None
112
+ self.n_ctx = nn.LayerNorm(ctx_dim) if ctx_dim else None
113
+ self.n_mlp = nn.LayerNorm(dim)
114
+ self.mlp = nn.Sequential(nn.Linear(dim, mlp * dim), nn.GELU(), nn.Linear(mlp * dim, dim))
115
+
116
+ def forward(self, q, ctx=None, pad=None):
117
+ if self.sa is not None:
118
+ h = self.n_sa(q)
119
+ q = q + self.sa(h, h, h, need_weights=False)[0]
120
+ if self.xa is not None:
121
+ c = self.n_ctx(ctx)
122
+ q = q + self.xa(self.n_xa(q), c, c, key_padding_mask=pad, need_weights=False)[0]
123
+ return q + self.mlp(self.n_mlp(q))
124
+
125
+
126
+ class Planner(nn.Module):
127
+ """Perceiver (reads latent + canvases) + planner (reasons with the text and t)."""
128
+
129
+ def __init__(self, dim: int, ctx_dim: int, latent_ch: int, mem_c: int, mem_m: int, mem_tok: int,
130
+ n_global: int, n_mem: int, perceiver_depth: int, planner_depth: int, n_freq: int = 6,
131
+ grid: int = 8, p_dim: int = 256):
132
+ """Width grows through the stack: the perceiver READS at p_dim (its keys are the many
133
+ latent/canvas positions, so narrow is where width is cheapest to save), the planner
134
+ THINKS at dim, and the output heads (FCDMPlanner.heads) SPEAK wide."""
135
+ super().__init__()
136
+ self.grid, self.n_global, self.n_mem = grid, n_global, n_mem
137
+ nq = grid * grid + n_global + n_mem
138
+ self.queries = nn.Parameter(torch.randn(nq, p_dim) * 0.02)
139
+ self.t_embed = TimestepEmbedder(p_dim)
140
+ self.t_embed2 = TimestepEmbedder(dim)
141
+ self.n_freq = n_freq
142
+ pos = 4 * n_freq
143
+ self.in_latent = nn.Linear(latent_ch * 4 + pos, p_dim) # 2x2 patches
144
+ self.in_coarse = nn.Linear(mem_c + pos, p_dim)
145
+ self.in_mid = nn.Linear(mem_m + pos, p_dim)
146
+ self.src = nn.Parameter(torch.zeros(3, p_dim)) # which input a token is
147
+ self.grid_pos = nn.Linear(pos, p_dim)
148
+ self.mem_in = nn.Linear(mem_tok, p_dim)
149
+ self.perceiver = nn.ModuleList(XBlock(p_dim, max(1, p_dim // 64), p_dim, self_attn=False)
150
+ for _ in range(perceiver_depth))
151
+ self.lift = nn.Linear(p_dim, dim)
152
+ self.planner = nn.ModuleList(XBlock(dim, max(1, dim // 64), ctx_dim) for _ in range(planner_depth))
153
+ self.norm_out = nn.LayerNorm(dim)
154
+
155
+ def forward(self, z, t, ctx, mask, coarse, mid, mem_tokens):
156
+ B = z.shape[0]
157
+ dev = z.device
158
+ pos = lambda h, w: fourier_coords(h, w, self.n_freq, dev)[None].expand(B, -1, -1) # noqa: E731
159
+ H, W = z.shape[-2:]
160
+ lat = F.pixel_unshuffle(z, 2).flatten(2).transpose(1, 2) # (B, HW/4, 4C)
161
+ inputs = torch.cat([
162
+ self.in_latent(torch.cat([lat, pos(H // 2, W // 2)], -1)) + self.src[0],
163
+ self.in_coarse(torch.cat([coarse.flatten(2).transpose(1, 2), pos(*coarse.shape[-2:])], -1)) + self.src[1],
164
+ self.in_mid(torch.cat([mid.flatten(2).transpose(1, 2), pos(*mid.shape[-2:])], -1)) + self.src[2]], 1)
165
+ q = self.queries[None].expand(B, -1, -1).clone()
166
+ g2 = self.grid * self.grid
167
+ q[:, :g2] = q[:, :g2] + self.grid_pos(pos(self.grid, self.grid))
168
+ q[:, -self.n_mem:] = q[:, -self.n_mem:] + self.mem_in(mem_tokens)
169
+ q = q + self.t_embed(t)[:, None]
170
+ for blk in self.perceiver:
171
+ q = blk(q, inputs)
172
+ q = self.lift(q) + self.t_embed2(t)[:, None]
173
+ pad = ~mask.bool()
174
+ for blk in self.planner:
175
+ q = blk(q, ctx, pad)
176
+ return self.norm_out(q)
177
+
178
+
179
+ class FCDMPlanner(nn.Module):
180
+ def __init__(self, latent_ch: int = 4, C: int = 224, depths=(3, 6, 12, 6, 3), expansion: int = 3,
181
+ ctx_dim: int = 512, ctx_std: float = 1.0, dim: int = 640, d_mod: int = 2048,
182
+ p_dim: int = 256,
183
+ perceiver_depth: int = 4, planner_depth: int = 8, n_global: int = 16, n_mem: int = 16,
184
+ mem_c: int = 16, mem_m: int = 8, mem_tok: int = 256, grid: int = 8,
185
+ grad_checkpoint: bool = False):
186
+ super().__init__()
187
+ depths = tuple(int(d) for d in depths)
188
+ self.config = dict(latent_ch=latent_ch, C=C, depths=list(depths), expansion=expansion, ctx_dim=ctx_dim,
189
+ ctx_std=ctx_std, dim=dim, d_mod=d_mod, p_dim=p_dim,
190
+ perceiver_depth=perceiver_depth,
191
+ planner_depth=planner_depth, n_global=n_global, n_mem=n_mem, mem_c=mem_c,
192
+ mem_m=mem_m, mem_tok=mem_tok, grid=grid)
193
+ self.grad_checkpoint = grad_checkpoint
194
+ self.grid, self.mem_c, self.mem_m, self.mem_tok, self.n_mem = grid, mem_c, mem_m, mem_tok, n_mem
195
+ self.ctx_scale = nn.Parameter(torch.tensor(1.0 / ctx_std)) # one global scalar
196
+ self.planner = Planner(dim, ctx_dim, latent_ch, mem_c, mem_m, mem_tok, n_global, n_mem,
197
+ perceiver_depth, planner_depth, grid=grid, p_dim=p_dim)
198
+ # per-level decoding of the plan into a modulation map (+ the output head)
199
+ # the planner's grid tokens -> one d_mod-wide instruction per region, a single linear layer
200
+ self.to_mod = nn.Linear(dim, d_mod)
201
+ mem_in = mem_c + mem_m
202
+ self.stem = nn.Conv2d(latent_ch + mem_in, C, 3, padding=1)
203
+ widths = (C, 2 * C, 4 * C, 2 * C, C)
204
+ self.levels = nn.ModuleDict({k: ConvLevel(w, d, d_mod, expansion, mem_in)
205
+ for k, w, d in zip(LEVELS, widths, depths)})
206
+ self.down0 = nn.Sequential(LayerNorm2d(C), nn.Conv2d(C, 2 * C, 2, stride=2))
207
+ self.down1 = nn.Sequential(LayerNorm2d(2 * C), nn.Conv2d(2 * C, 4 * C, 2, stride=2))
208
+ self.up1 = nn.ConvTranspose2d(4 * C, 2 * C, 2, stride=2)
209
+ self.up0 = nn.ConvTranspose2d(2 * C, C, 2, stride=2)
210
+ self.final_norm = LayerNorm2d(C, affine=False)
211
+ self.final_mod = nn.Conv2d(d_mod, 2 * C, 1)
212
+ self.final_conv = nn.Conv2d(C, latent_ch, 3, padding=1)
213
+ for m in (self.final_mod, self.final_conv):
214
+ nn.init.zeros_(m.weight)
215
+ nn.init.zeros_(m.bias)
216
+ # memory writes (gated; candidate zero-initialised, gates biased shut -> memory starts ~0)
217
+ self.w_coarse = nn.Linear(dim, 2 * mem_c)
218
+ self.w_tokens = nn.Linear(dim, 2 * mem_tok)
219
+ self.w_mid = nn.Conv2d(2 * C + mem_m, 2 * mem_m, 3, padding=1)
220
+ for lin, n in ((self.w_coarse, mem_c), (self.w_tokens, mem_tok)):
221
+ nn.init.zeros_(lin.weight)
222
+ nn.init.zeros_(lin.bias)
223
+ lin.bias.data[:n] = -2.0 # update gate ~0.12
224
+ nn.init.zeros_(self.w_mid.weight)
225
+ nn.init.zeros_(self.w_mid.bias)
226
+ self.w_mid.bias.data[:mem_m] = -2.0
227
+
228
+ # ---- state ------------------------------------------------------------------------------
229
+ def init_state(self, B: int, H: int, W: int, device, dtype=torch.float32) -> dict:
230
+ g = self.grid
231
+ return {"coarse": torch.zeros(B, self.mem_c, g, g, device=device, dtype=dtype),
232
+ "mid": torch.zeros(B, self.mem_m, H // 2, W // 2, device=device, dtype=dtype),
233
+ "tokens": torch.zeros(B, self.n_mem, self.mem_tok, device=device, dtype=dtype)}
234
+
235
+ @staticmethod
236
+ def _gate(old, raw, n):
237
+ z, cand = torch.sigmoid(raw[..., :n]), torch.tanh(raw[..., n:])
238
+ return (1 - z) * old + z * cand
239
+
240
+ # ---- one sampling step -----------------------------------------------------------------
241
+ def forward(self, z, t, ctx, mask, state: dict | None = None):
242
+ """z: (B, 4, H, W) noisy latent (H, W divisible by 4 and by the 8x8 grid); t: (B,)
243
+ in [0, 1] (0 = noise); ctx: (B, L, ctx_dim) text states, mask (B, L).
244
+ Returns (velocity (B, 4, H, W), new state)."""
245
+ B, _, H, W = z.shape
246
+ if state is None:
247
+ state = self.init_state(B, H, W, z.device)
248
+ coarse, mid, tokens = state["coarse"], state["mid"], state["tokens"]
249
+ ctx = ctx.float() * self.ctx_scale
250
+ q = self.planner(z, t, ctx, mask, coarse, mid, tokens) # (B, Nq, dim)
251
+ g, grid_tok, mem_tok = self.grid, q[:, :self.grid ** 2], q[:, -self.n_mem:]
252
+ mod_map = self.to_mod(grid_tok).transpose(1, 2).reshape(B, -1, g, g) # (B, d_mod, 8, 8)
253
+ maps = {k: mod_map for k in LEVELS + ("out",)}
254
+ mem_full = torch.cat([F.interpolate(coarse.to(z.dtype), size=(H, W), mode="bilinear", align_corners=False),
255
+ F.interpolate(mid.to(z.dtype), size=(H, W), mode="bilinear", align_corners=False)], 1)
256
+
257
+ def run(level, x):
258
+ if self.grad_checkpoint and self.training:
259
+ from torch.utils.checkpoint import checkpoint
260
+ return checkpoint(self.levels[level], x, maps[level], mem_full, use_reentrant=False)
261
+ return self.levels[level](x, maps[level], mem_full)
262
+
263
+ x0 = run("enc0", self.stem(torch.cat([z, mem_full], 1)))
264
+ x1 = run("enc1", self.down0(x0))
265
+ x = run("mid", self.down1(x1))
266
+ x = run("dec1", self.up1(x) + x1)
267
+ new_mid = self._gate(mid.float().permute(0, 2, 3, 1),
268
+ self.w_mid(torch.cat([x, mid.to(x.dtype)], 1)).float().permute(0, 2, 3, 1),
269
+ self.mem_m).permute(0, 3, 1, 2)
270
+ x = run("dec0", self.up0(x) + x0)
271
+ fm = F.interpolate(self.final_mod(maps["out"]), size=(H, W), mode="bilinear", align_corners=False)
272
+ shift, scale = fm.chunk(2, dim=1)
273
+ v = self.final_conv(self.final_norm(x) * (1 + scale) + shift)
274
+ new_coarse = self._gate(coarse.float().permute(0, 2, 3, 1),
275
+ self.w_coarse(grid_tok).float().reshape(B, g, g, -1), self.mem_c).permute(0, 3, 1, 2)
276
+ new_tokens = self._gate(tokens.float(), self.w_tokens(mem_tok).float(), self.mem_tok)
277
+ return v, {"coarse": new_coarse, "mid": new_mid, "tokens": new_tokens}
278
+
279
+
280
+ @torch.no_grad()
281
+ def sample_chain(model, noise, ctx, mask, uncond_ctx=None, uncond_mask=None, steps: int = 32, cfg: float = 3.0):
282
+ """Euler over t = i/steps (Supra's schedule), carrying one memory state per CFG branch."""
283
+ z, dt = noise, 1.0 / steps
284
+ B = noise.shape[0]
285
+ use_cfg = cfg > 1.0 and uncond_ctx is not None
286
+ if use_cfg:
287
+ uc = uncond_ctx.expand(B, -1, -1) if uncond_ctx.shape[0] == 1 else uncond_ctx
288
+ um = uncond_mask.expand(B, -1) if uncond_mask.shape[0] == 1 else uncond_mask
289
+ s_c = s_u = None
290
+ for i in range(steps):
291
+ t = torch.full((B,), i / steps, device=z.device)
292
+ v_c, s_c = model(z, t, ctx, mask, s_c)
293
+ if use_cfg:
294
+ v_u, s_u = model(z, t, uc, um, s_u)
295
+ v_c = v_u + cfg * (v_c - v_u)
296
+ z = z + dt * v_c.float()
297
+ return z
agate/fcdm_t2i.py ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FCDM text-to-image backbone.
2
+
3
+ The block and U-Net follow "Reviving ConvNeXt for Efficient Convolutional Diffusion
4
+ Models" (Kwon et al., arXiv 2603.09408):
5
+
6
+ FCDM block 7x7 DWConv -> LayerNorm -> AdaLN (x*(1+gamma)+beta) -> 1x1 expand (r=3)
7
+ -> GELU -> GRN -> 1x1 project -> gate alpha -> residual. gamma, beta,
8
+ alpha come from the conditioning vector c through a zero-initialised
9
+ linear, so every block starts as the identity (DiT's adaLN-Zero).
10
+ U-Net 3 levels (32^2, 16^2, 8^2 for a 32x32 latent), channels C, 2C, 4C,
11
+ depths [L, 2L, 4L, 2L, L], encoder/decoder symmetric.
12
+
13
+ Two things the paper does not pin down, chosen here:
14
+ * down = LayerNorm + 2x2 stride-2 conv (the ConvNeXt downsampler); up = 2x2 stride-2
15
+ transposed conv; the skip is ADDED, as the paper's Figure 3c draws it.
16
+ * text. The paper's text-to-image appendix (H) conditions on a POOLED text vector only
17
+ and names token-level conditioning as future work. Pooled text cannot bind attributes
18
+ to objects ("red cube, blue sphere"), and Supra2-IMG -- the model this replicates --
19
+ cross-attends to the Flan-T5 tokens in every block. So text_mode="pooled_xattn" adds
20
+ cross-attention after every block at the 16^2 and 8^2 levels (cheap: 256 and 64
21
+ queries against <=128 keys); the 32^2 level stays pure convolution. text_mode="pooled"
22
+ is the paper-faithful variant.
23
+
24
+ Conventions match Supra2-IMG's sampler: t=0 is noise, t=1 is data, the model predicts
25
+ the velocity x1 - x0.
26
+ """
27
+ from __future__ import annotations
28
+
29
+ import math
30
+
31
+ import torch
32
+ import torch.nn as nn
33
+ import torch.nn.functional as F
34
+
35
+ T5_DIM = 768 # Flan-T5-Base hidden size
36
+
37
+
38
+ def modulate(x: torch.Tensor, shift: torch.Tensor, scale: torch.Tensor) -> torch.Tensor:
39
+ """AdaLN on a (B, C, H, W) map with (B, C) shift/scale."""
40
+ return x * (1 + scale[:, :, None, None]) + shift[:, :, None, None]
41
+
42
+
43
+ class LayerNorm2d(nn.Module):
44
+ """LayerNorm over channels of a (B, C, H, W) map (ConvNeXt's channels_first LN).
45
+
46
+ Routed through F.layer_norm so autocast runs it in fp32 under bf16 training."""
47
+
48
+ def __init__(self, dim: int, affine: bool = True, eps: float = 1e-6):
49
+ super().__init__()
50
+ self.ln = nn.LayerNorm(dim, eps=eps, elementwise_affine=affine)
51
+
52
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
53
+ return self.ln(x.permute(0, 2, 3, 1)).permute(0, 3, 1, 2)
54
+
55
+
56
+ class GRN(nn.Module):
57
+ """Global Response Normalization (ConvNeXt V2), channels_first. Identity at init."""
58
+
59
+ def __init__(self, dim: int, eps: float = 1e-6):
60
+ super().__init__()
61
+ self.gamma = nn.Parameter(torch.zeros(1, dim, 1, 1))
62
+ self.beta = nn.Parameter(torch.zeros(1, dim, 1, 1))
63
+ self.eps = eps
64
+
65
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
66
+ gx = torch.linalg.vector_norm(x.float(), dim=(2, 3), keepdim=True) # (B, C, 1, 1)
67
+ nx = gx / (gx.mean(dim=1, keepdim=True) + self.eps)
68
+ return self.gamma * (x * nx.to(x.dtype)) + self.beta + x
69
+
70
+
71
+ class FCDMBlock(nn.Module):
72
+ def __init__(self, dim: int, c_dim: int, expansion: int = 3):
73
+ super().__init__()
74
+ self.dwconv = nn.Conv2d(dim, dim, 7, padding=3, groups=dim)
75
+ self.norm = LayerNorm2d(dim, affine=False) # AdaLN supplies scale/shift
76
+ self.pw1 = nn.Conv2d(dim, expansion * dim, 1)
77
+ self.act = nn.GELU()
78
+ self.grn = GRN(expansion * dim)
79
+ self.pw2 = nn.Conv2d(expansion * dim, dim, 1)
80
+ self.ada = nn.Sequential(nn.SiLU(), nn.Linear(c_dim, 3 * dim))
81
+ nn.init.zeros_(self.ada[1].weight)
82
+ nn.init.zeros_(self.ada[1].bias)
83
+
84
+ def forward(self, x: torch.Tensor, c: torch.Tensor) -> torch.Tensor:
85
+ shift, scale, gate = self.ada(c).chunk(3, dim=1)
86
+ h = modulate(self.norm(self.dwconv(x)), shift, scale)
87
+ h = self.pw2(self.grn(self.act(self.pw1(h))))
88
+ return x + gate[:, :, None, None] * h
89
+
90
+
91
+ class CrossAttn2d(nn.Module):
92
+ """Image positions attend to the (masked) text tokens. Output projection is
93
+ zero-initialised, so the layer starts as the identity."""
94
+
95
+ def __init__(self, dim: int, ctx_dim: int = T5_DIM, head_dim: int = 64):
96
+ super().__init__()
97
+ if dim % head_dim:
98
+ raise ValueError(f"cross-attention width {dim} is not a multiple of head_dim {head_dim}")
99
+ self.heads, self.head_dim = dim // head_dim, head_dim
100
+ self.norm = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6)
101
+ self.q = nn.Linear(dim, dim)
102
+ self.kv = nn.Linear(ctx_dim, 2 * dim)
103
+ self.out = nn.Linear(dim, dim)
104
+ nn.init.zeros_(self.out.weight)
105
+ nn.init.zeros_(self.out.bias)
106
+
107
+ def forward(self, x: torch.Tensor, ctx: torch.Tensor, mask: torch.Tensor) -> torch.Tensor:
108
+ B, C, H, W = x.shape
109
+ s = x.flatten(2).transpose(1, 2) # (B, HW, C)
110
+ q = self.q(self.norm(s)).view(B, -1, self.heads, self.head_dim).transpose(1, 2)
111
+ k, v = self.kv(ctx).view(B, ctx.shape[1], 2, self.heads, self.head_dim).permute(2, 0, 3, 1, 4)
112
+ a = F.scaled_dot_product_attention(q, k, v, attn_mask=mask.bool()[:, None, None, :])
113
+ s = s + self.out(a.transpose(1, 2).reshape(B, -1, C))
114
+ return s.transpose(1, 2).reshape(B, C, H, W)
115
+
116
+
117
+ class TimestepEmbedder(nn.Module):
118
+ """Sinusoidal t (scaled x1000, as Supra2-IMG does) -> MLP."""
119
+
120
+ def __init__(self, dim: int, freq_dim: int = 256):
121
+ super().__init__()
122
+ self.freq_dim = freq_dim
123
+ self.mlp = nn.Sequential(nn.Linear(freq_dim, dim), nn.SiLU(), nn.Linear(dim, dim))
124
+
125
+ def forward(self, t: torch.Tensor) -> torch.Tensor:
126
+ half = self.freq_dim // 2
127
+ freqs = torch.exp(-math.log(10000.0) * torch.arange(half, device=t.device) / half)
128
+ args = t[:, None].float() * freqs[None] * 1000.0
129
+ return self.mlp(torch.cat([torch.cos(args), torch.sin(args)], dim=-1))
130
+
131
+
132
+ def masked_mean(ctx: torch.Tensor, mask: torch.Tensor) -> torch.Tensor:
133
+ """Mean over real tokens only. Flan-T5 has no pooled output; Sentence-T5 showed the
134
+ masked mean is a sound sentence embedding."""
135
+ m = mask.to(ctx.dtype).unsqueeze(-1)
136
+ return (ctx * m).sum(1) / m.sum(1).clamp(min=1.0)
137
+
138
+
139
+ class Level(nn.Module):
140
+ """`depth` FCDM blocks at one resolution, optionally each followed by cross-attention."""
141
+
142
+ def __init__(self, dim: int, depth: int, c_dim: int, expansion: int, xattn: bool,
143
+ ctx_dim: int, head_dim: int):
144
+ super().__init__()
145
+ self.blocks = nn.ModuleList(FCDMBlock(dim, c_dim, expansion) for _ in range(depth))
146
+ self.xattn = (nn.ModuleList(CrossAttn2d(dim, ctx_dim, head_dim) for _ in range(depth))
147
+ if xattn else None)
148
+
149
+ def forward(self, x, c, ctx, mask):
150
+ for i, blk in enumerate(self.blocks):
151
+ x = blk(x, c)
152
+ if self.xattn is not None:
153
+ x = self.xattn[i](x, ctx, mask)
154
+ return x
155
+
156
+
157
+ # Parameter-matched to Supra2-IMG's DiT (104.09M, measured by models.count_params):
158
+ # pooled_xattn C=224 c_dim=464 -> 104.087M pooled C=256 c_dim=778 -> 104.072M
159
+ # Trainable backbone only -- like Supra's 104.1M, excluding the frozen T5 and VAE.
160
+ PARAM_MATCHED = {"pooled_xattn": dict(C=224, c_dim=464), "pooled": dict(C=256, c_dim=778)}
161
+
162
+
163
+ class FCDMT2I(nn.Module):
164
+ TEXT_MODES = ("pooled", "pooled_xattn")
165
+
166
+ def __init__(self, latent_ch: int = 4, C: int = 224, L: int = 2, c_dim: int = 464,
167
+ expansion: int = 3, text_mode: str = "pooled_xattn", ctx_dim: int = T5_DIM,
168
+ head_dim: int = 64, grad_checkpoint: bool = False):
169
+ super().__init__()
170
+ if text_mode not in self.TEXT_MODES:
171
+ raise ValueError(f"text_mode must be one of {self.TEXT_MODES}")
172
+ xa = text_mode == "pooled_xattn"
173
+ self.config = dict(latent_ch=latent_ch, C=C, L=L, c_dim=c_dim, expansion=expansion,
174
+ text_mode=text_mode, ctx_dim=ctx_dim, head_dim=head_dim)
175
+ self.grad_checkpoint = grad_checkpoint
176
+
177
+ self.t_embed = TimestepEmbedder(c_dim)
178
+ self.text_pool = nn.Sequential(nn.LayerNorm(ctx_dim), nn.Linear(ctx_dim, c_dim),
179
+ nn.SiLU(), nn.Linear(c_dim, c_dim))
180
+ self.stem = nn.Conv2d(latent_ch, C, 3, padding=1)
181
+
182
+ mk = lambda d, n, x: Level(d, n, c_dim, expansion, x, ctx_dim, head_dim) # noqa: E731
183
+ self.enc0 = mk(C, L, False)
184
+ self.down0 = nn.Sequential(LayerNorm2d(C), nn.Conv2d(C, 2 * C, 2, stride=2))
185
+ self.enc1 = mk(2 * C, 2 * L, xa)
186
+ self.down1 = nn.Sequential(LayerNorm2d(2 * C), nn.Conv2d(2 * C, 4 * C, 2, stride=2))
187
+ self.mid = mk(4 * C, 4 * L, xa)
188
+ self.up1 = nn.ConvTranspose2d(4 * C, 2 * C, 2, stride=2)
189
+ self.dec1 = mk(2 * C, 2 * L, xa)
190
+ self.up0 = nn.ConvTranspose2d(2 * C, C, 2, stride=2)
191
+ self.dec0 = mk(C, L, False)
192
+
193
+ self.final_norm = LayerNorm2d(C, affine=False)
194
+ self.final_ada = nn.Sequential(nn.SiLU(), nn.Linear(c_dim, 2 * C))
195
+ self.final_conv = nn.Conv2d(C, latent_ch, 3, padding=1)
196
+ for m in (self.final_ada[1], self.final_conv):
197
+ nn.init.zeros_(m.weight)
198
+ nn.init.zeros_(m.bias)
199
+
200
+ def _run(self, level: Level, x, c, ctx, mask):
201
+ if self.grad_checkpoint and self.training:
202
+ from torch.utils.checkpoint import checkpoint
203
+ return checkpoint(level, x, c, ctx, mask, use_reentrant=False)
204
+ return level(x, c, ctx, mask)
205
+
206
+ def forward(self, z: torch.Tensor, t: torch.Tensor, ctx: torch.Tensor,
207
+ mask: torch.Tensor) -> torch.Tensor:
208
+ """z: (B, 4, H, W) latent (H, W divisible by 4); t: (B,) in [0, 1];
209
+ ctx: (B, L, 768) Flan-T5 hidden states; mask: (B, L), 1 = real token."""
210
+ c = self.t_embed(t) + self.text_pool(masked_mean(ctx.float(), mask))
211
+ x0 = self._run(self.enc0, self.stem(z), c, ctx, mask)
212
+ x1 = self._run(self.enc1, self.down0(x0), c, ctx, mask)
213
+ x = self._run(self.mid, self.down1(x1), c, ctx, mask)
214
+ x = self._run(self.dec1, self.up1(x) + x1, c, ctx, mask)
215
+ x = self._run(self.dec0, self.up0(x) + x0, c, ctx, mask)
216
+ shift, scale = self.final_ada(c).chunk(2, dim=1)
217
+ return self.final_conv(modulate(self.final_norm(x), shift, scale))
agate/fcdm_thinker2.py ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FCDM-T2: the thinker model (models/fcdm_thinker.py, "Run 1") rebuilt from its ablations.
2
+
3
+ A copy, not a subclass: Run 1's checkpoints must keep loading into the exact module they
4
+ trained with. What changed, and the measurement behind each change (2026-09-24 notes):
5
+
6
+ renderer Run 1's 8x8 level held 50.0M of 102.5M parameters in 8 blocks that each
7
+ cost <= 1.5% loss when removed, while the 32x32 blocks (enc0/dec0) were the
8
+ most critical in the model (+113-121%) and Run 1 trailed the DiT only at
9
+ t >= 0.8 (fine detail). Depths per level are now explicit: the default
10
+ (4, 6, 2) puts 4 blocks at 32^2, 6 at 16^2 and 2 at 8^2 on each side of the U.
11
+ thinking the planner is a RECURRENT core: `prelude` blocks, then `core` blocks applied
12
+ `loops` times (each loop re-injects the prelude output through a zero-init
13
+ adapter, as in recurrent-depth models), then `coda` blocks. Run 1's middle
14
+ planner layers each did 2-3% of the work; sharing weights across loops spends
15
+ that parameter budget once and lets inference choose the depth. Training draws
16
+ the loop count per step (all ranks agree), so one run yields the loss at
17
+ 1..max loops for free.
18
+ position 2D RoPE (fp32, applied after QK-norm) in the planner's self-attention and the
19
+ perceiver's cross-attention: attention scores between two cells depend on their
20
+ offset, the relation "left of" / "above" needs -- GenEval position was 0.14.
21
+ Coordinates are fractions of the image, so the same angles serve 256 and 512.
22
+ Global tokens are not rotated. The additive Fourier coordinates are kept.
23
+ stability QK RMSNorm on every attention from the first step (fcdm2 diverged from
24
+ attention-logit growth and needed QK-norm ramped in afterwards).
25
+ text any encoder via ctx_dim (Ettin-68M: 512); text tokens carry no 2D position.
26
+ widths per-level widths (32^2, 16^2, 8^2) instead of C/2C/4C, and a LOW-RANK steering
27
+ path (steer_rank): each level projects the region map once to r channels and its
28
+ blocks decode shift/scale/gate from those. Run 1's effective-rank analysis
29
+ (tools/effective_rank.py, 2026-09-24): 32^2 used 102-187 of 224 stream dims while
30
+ 16^2/8^2 MLPs used 93-96% of theirs, and the steering maps at 32^2 had participation
31
+ ratio 2-3 (weight stable rank 2-8) -- width and steering rank belong where they are used.
32
+
33
+ No memory: the nested-chain memory run (2936742) is still being evaluated; if it earns its
34
+ place it is ported here as its own copy.
35
+
36
+ Conventions match v1: t=0 noise, t=1 data, predicts the velocity x1 - x0.
37
+ """
38
+ from __future__ import annotations
39
+
40
+ import math
41
+ import random
42
+
43
+ import torch
44
+ import torch.nn as nn
45
+ import torch.nn.functional as F
46
+
47
+ from .fcdm_planner import SpatialModBlock, fourier_coords
48
+ from .fcdm_t2i import LayerNorm2d, TimestepEmbedder
49
+
50
+
51
+ def rope_freqs(head_dim: int, device) -> torch.Tensor:
52
+ """Angular frequencies for one axis: head_dim/4 of them (each rotates one channel pair;
53
+ x and y get half the pairs each), log-spaced from pi/2 (one half-turn across the image)
54
+ to 8 pi (a half-turn between neighbouring cells of a 16-cell grid)."""
55
+ n = head_dim // 4
56
+ return math.pi * 2.0 ** torch.linspace(-1.0, 3.0, n, device=device, dtype=torch.float32)
57
+
58
+
59
+ def grid_xy(h: int, w: int, device) -> torch.Tensor:
60
+ """(h*w, 2) cell-centre coordinates (x, y) in [-1, 1], row-major like pixel_unshuffle."""
61
+ ys = (torch.arange(h, device=device, dtype=torch.float32) + 0.5) / h * 2 - 1
62
+ xs = (torch.arange(w, device=device, dtype=torch.float32) + 0.5) / w * 2 - 1
63
+ yy, xx = torch.meshgrid(ys, xs, indexing="ij")
64
+ return torch.stack([xx.reshape(-1), yy.reshape(-1)], 1)
65
+
66
+
67
+ def rope_angles(xy: torch.Tensor, head_dim: int, n_unrotated: int = 0) -> torch.Tensor:
68
+ """(N, head_dim/2) rotation angles for positions xy (N, 2); `n_unrotated` extra rows of
69
+ zeros are APPENDED (global tokens: angle 0 is the identity rotation)."""
70
+ f = rope_freqs(head_dim, xy.device)
71
+ ang = torch.cat([xy[:, :1] * f, xy[:, 1:] * f], 1)
72
+ if n_unrotated:
73
+ ang = torch.cat([ang, ang.new_zeros(n_unrotated, ang.shape[1])], 0)
74
+ return ang
75
+
76
+
77
+ def apply_rope(x: torch.Tensor, ang: torch.Tensor | None) -> torch.Tensor:
78
+ """Rotate channel pairs of x (B, h, N, d) by ang (N, d/2) -- in fp32 whatever the autocast
79
+ state: a bf16 rotation scrambles positions (the Ideogram-4 rope bug, 2026-09-08)."""
80
+ if ang is None:
81
+ return x
82
+ with torch.autocast(x.device.type, enabled=False):
83
+ xf = x.float()
84
+ x1, x2 = xf[..., 0::2], xf[..., 1::2]
85
+ c, s = ang.cos(), ang.sin()
86
+ out = torch.stack([x1 * c - x2 * s, x1 * s + x2 * c], -1).flatten(-2)
87
+ return out.to(x.dtype)
88
+
89
+
90
+ class Attn(nn.Module):
91
+ """Multi-head attention with QK RMSNorm and optional 2D RoPE on either side."""
92
+
93
+ def __init__(self, dim: int, kv_dim: int, head_dim: int = 64):
94
+ super().__init__()
95
+ self.h, self.d = dim // head_dim, head_dim
96
+ self.q = nn.Linear(dim, dim)
97
+ self.kv = nn.Linear(kv_dim, 2 * dim)
98
+ self.qn, self.kn = nn.RMSNorm(head_dim), nn.RMSNorm(head_dim)
99
+ self.out = nn.Linear(dim, dim)
100
+
101
+ def forward(self, x, kv, pad=None, ang_q=None, ang_k=None):
102
+ B, N, _ = x.shape
103
+ q = self.q(x).view(B, N, self.h, self.d).transpose(1, 2)
104
+ k, v = self.kv(kv).view(B, kv.shape[1], 2, self.h, self.d).permute(2, 0, 3, 1, 4)
105
+ q, k = apply_rope(self.qn(q), ang_q), apply_rope(self.kn(k), ang_k)
106
+ m = None if pad is None else ~pad[:, None, None, :]
107
+ o = F.scaled_dot_product_attention(q, k, v, attn_mask=m)
108
+ return self.out(o.transpose(1, 2).reshape(B, N, -1))
109
+
110
+
111
+ class XBlock2(nn.Module):
112
+ """Pre-LN layer: self-attention (optional, RoPE), cross-attention to a context (RoPE when
113
+ the context has positions, i.e. the latent), MLP."""
114
+
115
+ def __init__(self, dim: int, ctx_dim: int | None, self_attn: bool = True, mlp: int = 2):
116
+ super().__init__()
117
+ self.sa = Attn(dim, dim) if self_attn else None
118
+ self.n_sa = nn.LayerNorm(dim) if self_attn else None
119
+ self.xa = Attn(dim, ctx_dim) if ctx_dim else None
120
+ self.n_xa = nn.LayerNorm(dim) if ctx_dim else None
121
+ self.n_ctx = nn.LayerNorm(ctx_dim) if ctx_dim else None
122
+ self.n_mlp = nn.LayerNorm(dim)
123
+ self.mlp = nn.Sequential(nn.Linear(dim, mlp * dim), nn.GELU(), nn.Linear(mlp * dim, dim))
124
+
125
+ def forward(self, q, ctx=None, pad=None, ang_q=None, ang_ctx=None):
126
+ if self.sa is not None:
127
+ h = self.n_sa(q)
128
+ q = q + self.sa(h, h, None, ang_q, ang_q)
129
+ if self.xa is not None:
130
+ c = self.n_ctx(ctx)
131
+ q = q + self.xa(self.n_xa(q), c, pad, ang_q if ang_ctx is not None else None, ang_ctx)
132
+ return q + self.mlp(self.n_mlp(q))
133
+
134
+
135
+ class Thinker2(nn.Module):
136
+ """read (perceiver over 2x2 latent patches, RoPE) -> think (prelude, `loops` x core, coda;
137
+ self-attention with RoPE + cross-attention to the text) -> region map."""
138
+
139
+ def __init__(self, ctx_dim: int, latent_ch: int, dim: int, p_dim: int, perceiver_depth: int,
140
+ prelude: int, core: int, coda: int, loops: int, grid: int, n_global: int, n_freq: int = 6,
141
+ rope: bool = True):
142
+ super().__init__()
143
+ self.grid, self.n_global, self.n_freq, self.rope = grid, n_global, n_freq, rope
144
+ self.loops = loops
145
+ pos = 4 * n_freq
146
+ self.queries = nn.Parameter(torch.randn(grid * grid + n_global, p_dim) * 0.02)
147
+ self.q_pos = nn.Linear(pos, p_dim)
148
+ self.t1 = TimestepEmbedder(p_dim)
149
+ self.t2 = TimestepEmbedder(dim)
150
+ self.in_latent = nn.Linear(latent_ch * 4 + pos, p_dim)
151
+ self.perceiver = nn.ModuleList(XBlock2(p_dim, p_dim, self_attn=False) for _ in range(perceiver_depth))
152
+ self.lift = nn.Linear(p_dim, dim)
153
+ self.prelude = nn.ModuleList(XBlock2(dim, ctx_dim) for _ in range(prelude))
154
+ self.core = nn.ModuleList(XBlock2(dim, ctx_dim) for _ in range(core))
155
+ self.coda = nn.ModuleList(XBlock2(dim, ctx_dim) for _ in range(coda))
156
+ # loop input: the state and the prelude output, merged; zero-init on the prelude half
157
+ # so loop 1 sees exactly the prelude output (state == prelude output there)
158
+ self.adapter = nn.Linear(2 * dim, dim)
159
+ with torch.no_grad():
160
+ self.adapter.weight.zero_()
161
+ self.adapter.weight[:, :dim].copy_(torch.eye(dim))
162
+ self.adapter.bias.zero_()
163
+ self.norm = nn.LayerNorm(dim)
164
+
165
+ def forward(self, z, t, ctx, mask, loops: int | None = None):
166
+ B, _, H, W = z.shape
167
+ g, dev = self.grid, z.device
168
+ loops = self.loops if loops is None else loops
169
+ pos = lambda h, w: fourier_coords(h, w, self.n_freq, dev)[None].expand(B, -1, -1) # noqa: E731
170
+ lat = F.pixel_unshuffle(z, 2).flatten(2).transpose(1, 2)
171
+ kv = self.in_latent(torch.cat([lat, pos(H // 2, W // 2)], -1))
172
+ q = self.queries[None].expand(B, -1, -1).clone()
173
+ q[:, :g * g] = q[:, :g * g] + self.q_pos(pos(g, g))
174
+ q = q + self.t1(t)[:, None]
175
+ ang_pq = ang_pk = ang_q = None
176
+ if self.rope:
177
+ ang_pq = rope_angles(grid_xy(g, g, dev), 64, self.n_global) # perceiver width p_dim
178
+ ang_pk = rope_angles(grid_xy(H // 2, W // 2, dev), 64)
179
+ ang_q = ang_pq
180
+ for blk in self.perceiver:
181
+ q = blk(q, kv, None, ang_pq, ang_pk)
182
+ q = self.lift(q) + self.t2(t)[:, None]
183
+ pad = ~mask.bool()
184
+ for blk in self.prelude:
185
+ q = blk(q, ctx, pad, ang_q)
186
+ e, s = q, q
187
+ for _ in range(loops):
188
+ s = self.adapter(torch.cat([s, e], -1))
189
+ for blk in self.core:
190
+ s = blk(s, ctx, pad, ang_q)
191
+ for blk in self.coda:
192
+ s = blk(s, ctx, pad, ang_q)
193
+ out = self.norm(s)
194
+ return out[:, :g * g].transpose(1, 2).reshape(B, -1, g, g)
195
+
196
+
197
+ class FCDMThinker2(nn.Module):
198
+ def __init__(self, latent_ch: int = 4, C: int = 224, depths: tuple = (4, 6, 2), expansion: int = 3,
199
+ ctx_dim: int = 512, dim: int = 512, p_dim: int = 256, perceiver_depth: int = 4,
200
+ prelude: int = 2, core: int = 2, coda: int = 2, loops: int = 4,
201
+ loop_probs: tuple = (0.1, 0.1, 0.2, 0.6), grid: int = 16, n_global: int = 16,
202
+ rope: bool = True, widths: tuple | None = None, steer_rank: tuple | None = None,
203
+ grad_checkpoint: bool = False):
204
+ """widths: (32^2, 16^2, 8^2) level widths, default (C, 2C, 4C). steer_rank: per-level rank
205
+ of the steering path, 0 = full (each block decodes straight from the dim-wide map)."""
206
+ super().__init__()
207
+ depths = tuple(depths)
208
+ widths = tuple(widths) if widths else (C, 2 * C, 4 * C)
209
+ steer_rank = tuple(steer_rank) if steer_rank else (0, 0, 0)
210
+ self.config = dict(latent_ch=latent_ch, C=C, depths=depths, expansion=expansion, ctx_dim=ctx_dim,
211
+ dim=dim, p_dim=p_dim, perceiver_depth=perceiver_depth, prelude=prelude, core=core,
212
+ coda=coda, loops=loops, loop_probs=tuple(loop_probs), grid=grid, n_global=n_global,
213
+ rope=rope, widths=widths, steer_rank=steer_rank)
214
+ if len(loop_probs) != loops or abs(sum(loop_probs) - 1) > 1e-6:
215
+ raise ValueError(f"loop_probs {loop_probs} must give one probability per loop count 1..{loops}")
216
+ self.loop_probs = tuple(loop_probs)
217
+ self.grad_checkpoint = grad_checkpoint
218
+ self.stateful = False
219
+ self.thinker = Thinker2(ctx_dim, latent_ch, dim, p_dim, perceiver_depth, prelude, core, coda, loops,
220
+ grid, n_global, rope=rope)
221
+ self.loops = loops # used by forward; the trainer sets it per step
222
+ d0, d1, d2 = depths
223
+ w0, w1, w2 = widths
224
+ # steering path per level: the region map (dim) -> r channels once, shared by the level's
225
+ # blocks (r = 0: no projection, every block reads the full map)
226
+ self.steer_in = nn.ModuleDict({lvl: nn.Conv2d(dim, r, 1) for lvl, r in zip(("l0", "l1", "l2"), steer_rank)
227
+ if r})
228
+ d_in = [r or dim for r in steer_rank]
229
+ self.stem = nn.Conv2d(latent_ch, w0, 3, padding=1)
230
+ mk = lambda w, dm, n: nn.ModuleList(SpatialModBlock(w, dm, expansion) for _ in range(n)) # noqa: E731
231
+ self.enc0, self.enc1, self.mid = mk(w0, d_in[0], d0), mk(w1, d_in[1], d1), mk(w2, d_in[2], 2 * d2)
232
+ self.dec1, self.dec0 = mk(w1, d_in[1], d1), mk(w0, d_in[0], d0)
233
+ self.down0 = nn.Sequential(LayerNorm2d(w0), nn.Conv2d(w0, w1, 2, stride=2))
234
+ self.down1 = nn.Sequential(LayerNorm2d(w1), nn.Conv2d(w1, w2, 2, stride=2))
235
+ self.up1 = nn.ConvTranspose2d(w2, w1, 2, stride=2)
236
+ self.up0 = nn.ConvTranspose2d(w1, w0, 2, stride=2)
237
+ self.final_norm = LayerNorm2d(w0, affine=False)
238
+ self.final_mod = nn.Conv2d(dim, 2 * w0, 1)
239
+ self.final_conv = nn.Conv2d(w0, latent_ch, 3, padding=1)
240
+ for m in (self.final_mod, self.final_conv):
241
+ nn.init.zeros_(m.weight)
242
+ nn.init.zeros_(m.bias)
243
+
244
+ def draw_loops(self, step: int, seed: int = 0) -> int:
245
+ """The loop count for one training step: seeded by the step, so every rank (and a
246
+ resumed run) draws the same number."""
247
+ r = random.Random(seed * 1_000_003 + step).random()
248
+ acc = 0.0
249
+ for n, p in enumerate(self.loop_probs, 1):
250
+ acc += p
251
+ if r < acc:
252
+ return n
253
+ return len(self.loop_probs)
254
+
255
+ @staticmethod
256
+ def _at(m, x):
257
+ return F.adaptive_avg_pool2d(m, x.shape[-2:]) if m.shape[-1] > x.shape[-1] else m
258
+
259
+ def _level(self, blocks, x, m, lvl):
260
+ if lvl in self.steer_in: # low-rank steering: project once per level
261
+ m = self.steer_in[lvl](m)
262
+ m = self._at(m, x)
263
+ for blk in blocks:
264
+ if self.grad_checkpoint and self.training:
265
+ from torch.utils.checkpoint import checkpoint
266
+ x = checkpoint(blk, x, m, use_reentrant=False)
267
+ else:
268
+ x = blk(x, m)
269
+ return x
270
+
271
+ def forward(self, z, t, ctx, mask, loops: int | None = None):
272
+ """z: (B, 4, H, W), H and W divisible by 4 and by the grid; t: (B,) in [0, 1];
273
+ ctx: (B, L, ctx_dim) text states; mask: (B, L), 1 = real token; loops: thinking
274
+ loops (default self.loops). -> velocity."""
275
+ m = self.thinker(z, t, ctx.float(), mask, self.loops if loops is None else loops)
276
+ x0 = self._level(self.enc0, self.stem(z), m, "l0")
277
+ x1 = self._level(self.enc1, self.down0(x0), m, "l1")
278
+ x = self._level(self.mid, self.down1(x1), m, "l2")
279
+ x = self._level(self.dec1, self.up1(x) + x1, m, "l1")
280
+ x = self._level(self.dec0, self.up0(x) + x0, m, "l0")
281
+ fm = self.final_mod(m)
282
+ if fm.shape[-2:] != x.shape[-2:]:
283
+ fm = F.interpolate(fm, size=x.shape[-2:], mode="bilinear", align_corners=False)
284
+ shift, scale = fm.chunk(2, dim=1)
285
+ return self.final_conv(self.final_norm(x) * (1 + scale) + shift)
agate/marking.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """AI-generated content marking for Agate outputs (EU AI Act Art. 50(2): machine-readable, detectable marking).
2
+
3
+ Two layers, both ON by default in AgatePipeline:
4
+ * an invisible watermark in the pixels: invisible-watermark (imwatermark, MIT), method 'dwtDctSvd', a fixed 64-bit
5
+ payload b"AGATE" + the release id (e.g. b"AGATE002"). detect_watermark(img) reads it back.
6
+ * provenance metadata: text entries in img.info ("ai_generated", "generator", "model", optionally "prompt" /
7
+ "seed"). PIL only writes them to disk through a PngInfo: use save(img, path), which does that for PNG.
8
+
9
+ Neither layer is tamper-proof: metadata disappears on most re-encodes and screenshots, and the watermark can be
10
+ removed by heavy edits or deliberately. Deployers still have to label AI-generated output themselves (Art. 50).
11
+ C2PA content credentials are future work.
12
+ """
13
+ from __future__ import annotations
14
+
15
+ RELEASE = "002"
16
+ PAYLOAD = b"AGATE" + RELEASE.encode() # 8 bytes = 64 bits, fixed
17
+ GENERATOR = f"Agate Preview {RELEASE} (LogoLabs)"
18
+ MODEL = f"Logolabs/agate-preview-{RELEASE}"
19
+ METHOD = "dwtDctSvd" # dwtDct (the library default) read back only 36-61% of the bits on Agate images, 2026-09-29
20
+
21
+
22
+ def _lib():
23
+ try:
24
+ from imwatermark import WatermarkDecoder, WatermarkEncoder
25
+ except ImportError as e: # the pipeline asks for it only when watermark=True
26
+ raise ImportError("Agate's output watermark needs the invisible-watermark package: "
27
+ "pip install invisible-watermark (or pass watermark=False)") from e
28
+ return WatermarkEncoder, WatermarkDecoder
29
+
30
+
31
+ def add_watermark(img, payload: bytes = PAYLOAD):
32
+ """PIL RGB image -> a new PIL image carrying `payload` invisibly (dwtDct)."""
33
+ import numpy as np
34
+ from PIL import Image
35
+ Enc, _ = _lib()
36
+ enc = Enc()
37
+ enc.set_watermark("bytes", payload)
38
+ bgr = np.ascontiguousarray(np.asarray(img.convert("RGB"))[:, :, ::-1])
39
+ out = enc.encode(bgr, METHOD)
40
+ return Image.fromarray(np.ascontiguousarray(out[:, :, ::-1]))
41
+
42
+
43
+ def read_watermark(img, n_bytes: int = len(PAYLOAD), size: int | None = None) -> bytes:
44
+ """The payload bytes read from img, optionally after resizing it to size x size (the library needs at least
45
+ 256 x 256; the mark is read best at the size it was embedded at)."""
46
+ import numpy as np
47
+ from PIL import Image
48
+ img = img.convert("RGB")
49
+ if size is not None and img.size != (size, size):
50
+ img = img.resize((size, size), Image.LANCZOS)
51
+ _, Dec = _lib()
52
+ dec = Dec("bytes", 8 * n_bytes)
53
+ return bytes(dec.decode(np.ascontiguousarray(np.asarray(img)[:, :, ::-1]), METHOD))
54
+
55
+
56
+ def detect_watermark(img, payload: bytes = PAYLOAD, min_bit_accuracy: float = 0.9) -> dict:
57
+ """-> {"detected": bool, "bit_accuracy": float, "payload": bytes read}. Detected when at least
58
+ `min_bit_accuracy` of the 64 payload bits match (a random image matches ~50%; up to three reads are tried, so a little more).
59
+ Images are read as given and resized to 256 and 512 px squares, which recovers marks after a resize."""
60
+ sizes = ([None] if min(img.size) >= 256 else []) + [s for s in (256, 512) if img.size != (s, s)]
61
+ best = None
62
+ for size in sizes: # as given, then at Agate's two output sizes
63
+ got = read_watermark(img, len(payload), size)
64
+ acc = sum(8 - bin(a ^ b).count("1") for a, b in zip(got, payload)) / (8 * len(payload))
65
+ if best is None or acc > best[0]:
66
+ best = (acc, got, size)
67
+ return {"detected": best[0] >= min_bit_accuracy, "bit_accuracy": best[0], "payload": best[1], "read_at": best[2]}
68
+
69
+
70
+ def provenance(prompt: str | None = None, seed: int | None = None, extra: dict | None = None) -> dict:
71
+ info = {"ai_generated": "true", "generator": GENERATOR, "model": MODEL,
72
+ "watermark": f"invisible-watermark {METHOD}, payload {PAYLOAD.decode()}"}
73
+ if prompt is not None:
74
+ info["prompt"] = prompt
75
+ if seed is not None:
76
+ info["seed"] = str(seed)
77
+ info.update(extra or {})
78
+ return info
79
+
80
+
81
+ def save(img, path, **kw) -> None:
82
+ """Save keeping the provenance entries: PNG text chunks via PngInfo (other formats: PIL's own handling, which
83
+ for JPEG drops them -- the pixel watermark is then the remaining mark)."""
84
+ from pathlib import Path
85
+ from PIL.PngImagePlugin import PngInfo
86
+ if Path(path).suffix.lower() == ".png":
87
+ meta = PngInfo()
88
+ for k, v in img.info.items():
89
+ if isinstance(v, str):
90
+ meta.add_text(k, v)
91
+ img.save(path, pnginfo=meta, **kw)
92
+ else:
93
+ img.save(path, **kw)
agate/pipeline.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """AgatePipeline: prompt -> 256x256 image.
2
+
3
+ from agate import AgatePipeline
4
+ pipe = AgatePipeline.from_pretrained("Logolabs/agate-preview-002", device="cuda")
5
+ images = pipe("a red cube on top of a blue sphere", seed=0) # list of PIL images
6
+ images = pipe("a portrait of an old sailor", autoguide=1.0, cfg=4.0) # sharper faces (loads the guide)
7
+
8
+ Sampler: Euler from t=0 (noise) to t=1 (data), 50 steps, classifier-free guidance 3 against the
9
+ empty prompt; the model predicts the velocity. On CUDA each denoising step is recorded once as a
10
+ CUDA graph and replayed (the model is small enough that kernel launches, not arithmetic, dominate
11
+ an eager step); on CPU it runs eagerly.
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import json
16
+ from pathlib import Path
17
+
18
+ import torch
19
+ import torch.nn.functional as F
20
+
21
+ from .fcdm_thinker2 import FCDMThinker2
22
+ from .text_encoder import EttinTextEncoder
23
+ from .marking import add_watermark, provenance
24
+
25
+ BUCKETS = (64, 128, 256, 512)
26
+
27
+
28
+ def _resolve(repo_or_dir: str) -> Path:
29
+ p = Path(repo_or_dir)
30
+ if p.is_dir():
31
+ return p
32
+ from huggingface_hub import snapshot_download
33
+ return Path(snapshot_download(repo_or_dir))
34
+
35
+
36
+ def _pad_to(ctx: torch.Tensor, mask: torch.Tensor, L: int):
37
+ return F.pad(ctx, (0, 0, 0, L - ctx.shape[1])), F.pad(mask, (0, L - mask.shape[1]))
38
+
39
+
40
+ def _bucket(*lengths: int) -> int:
41
+ need = max(lengths)
42
+ return next((b for b in BUCKETS if b >= need), BUCKETS[-1])
43
+
44
+
45
+ class _Graphed:
46
+ """model(z, t, ctx, mask) recorded as a CUDA graph per input shape and replayed."""
47
+
48
+ def __init__(self, model):
49
+ self.model, self.cache = model, {}
50
+
51
+ def _run(self, *a):
52
+ with torch.autocast("cuda", dtype=torch.bfloat16):
53
+ return self.model(*a)
54
+
55
+ def __call__(self, z, t, ctx, mask):
56
+ key = (tuple(z.shape), tuple(ctx.shape))
57
+ if key not in self.cache:
58
+ static = [z.clone(), t.clone(), ctx.clone(), mask.clone()]
59
+ side = torch.cuda.Stream()
60
+ side.wait_stream(torch.cuda.current_stream())
61
+ with torch.cuda.stream(side):
62
+ for _ in range(2): # warm-up: cuDNN autotune, allocator
63
+ self._run(*static)
64
+ torch.cuda.current_stream().wait_stream(side)
65
+ graph = torch.cuda.CUDAGraph()
66
+ with torch.cuda.graph(graph):
67
+ out = self._run(*static)
68
+ self.cache[key] = (graph, static, out)
69
+ graph, static, out = self.cache[key]
70
+ for dst, src in zip(static, (z, t, ctx, mask)):
71
+ dst.copy_(src)
72
+ graph.replay()
73
+ return out.float()
74
+
75
+
76
+ class _Eager:
77
+ def __init__(self, model):
78
+ self.model = model
79
+
80
+ def __call__(self, z, t, ctx, mask):
81
+ with torch.autocast(z.device.type, dtype=torch.bfloat16, enabled=z.device.type == "cuda"):
82
+ return self.model(z, t, ctx, mask).float()
83
+
84
+
85
+ class AgatePipeline:
86
+ def __init__(self, root: Path, device: str = "cuda", fast_vae: bool = False, cuda_graphs: bool = True):
87
+ from diffusers import AutoencoderKL, AutoencoderTiny
88
+ self.root, self.device = Path(root), torch.device(device)
89
+ self.cfg = json.loads((self.root / "config.json").read_text())
90
+ on_cuda = self.device.type == "cuda"
91
+ if on_cuda:
92
+ torch.backends.cudnn.benchmark = True
93
+ torch.backends.cuda.enable_cudnn_sdp(False) # the attention kernels Agate was trained with
94
+ self._graphs = on_cuda and cuda_graphs
95
+ self._dtype = torch.bfloat16 if on_cuda else torch.float32
96
+ self.model = self._load_generator(self.root / "generator.safetensors")
97
+ self.text = self._load_text(self.root / self.cfg["text_encoder"], self.cfg["text_max_len"])
98
+ self.guide = self.guide_text = None
99
+ vdtype = torch.float16 if on_cuda else torch.float32
100
+ if fast_vae:
101
+ self.vae = AutoencoderTiny.from_pretrained(self.cfg["fast_vae"], torch_dtype=vdtype)
102
+ self.vae_div = 1.0 # TAESD decodes the scaled latents directly
103
+ else:
104
+ self.vae = AutoencoderKL.from_pretrained(self.cfg["vae"], torch_dtype=vdtype)
105
+ self.vae_div = self.cfg["vae_scale"]
106
+ self.vae = self.vae.to(self.device).eval()
107
+
108
+ @classmethod
109
+ def from_pretrained(cls, repo_or_dir: str = "Logolabs/agate-preview-002", device: str = "cuda", **kw):
110
+ return cls(_resolve(repo_or_dir), device=device, **kw)
111
+
112
+ def _load_generator(self, path: Path):
113
+ from safetensors.torch import load_file
114
+ m = FCDMThinker2(**self.cfg["model_kw"])
115
+ m.load_state_dict(load_file(str(path)))
116
+ m = m.to(self.device, dtype=self._dtype).eval()
117
+ if self.device.type == "cuda":
118
+ m = m.to(memory_format=torch.channels_last)
119
+ return _Graphed(m) if self._graphs else _Eager(m)
120
+
121
+ def _load_text(self, path: Path, max_len: int) -> EttinTextEncoder:
122
+ text = EttinTextEncoder(str(path), self.device, max_len=max_len)
123
+ text.model.to(dtype=self._dtype)
124
+ return text
125
+
126
+ def _load_guide(self):
127
+ g = self.cfg["guide"]
128
+ self.guide = self._load_generator(self.root / g["generator"])
129
+ self.guide_text = self._load_text(self.root / g["text_encoder"], g["text_max_len"])
130
+
131
+ @torch.no_grad()
132
+ def __call__(self, prompt: str, negative_prompt: str = "", seed: int = 0, steps: int = 50, cfg: float = 3.0,
133
+ num_images: int = 1, autoguide: float = 0.0, watermark: bool = True, metadata: bool = True,
134
+ record_prompt: bool = False):
135
+ """autoguide > 0 also steers away from the guide model (an early Agate checkpoint, T40r step 27,600, the same guide 001 ships):
136
+ v = v_uncond + cfg (v_cond - v_uncond) + autoguide (v_cond - v_guide). Try 1.0 with cfg 4.
137
+ watermark (default True): an invisible dwtDct watermark (marking.PAYLOAD) in every image; metadata (default
138
+ True): provenance entries in img.info ("ai_generated", "generator", "model"); record_prompt (default False)
139
+ also stores the prompt and seed there. Save with agate.save(img, path) to keep the entries in a PNG."""
140
+ n, dev = int(num_images), self.device
141
+ if autoguide and self.guide is None:
142
+ self._load_guide()
143
+ ctx, mask = self.text([prompt] * n)
144
+ u_ctx, u_mask = self.text([negative_prompt] * n)
145
+ L = _bucket(ctx.shape[1], u_ctx.shape[1])
146
+ ctx, mask = _pad_to(ctx, mask, L)
147
+ u_ctx, u_mask = _pad_to(u_ctx, u_mask, L)
148
+ both_ctx, both_mask = torch.cat([ctx, u_ctx]), torch.cat([mask, u_mask])
149
+ if autoguide:
150
+ g_ctx, g_mask = self.guide_text([prompt] * n)
151
+ g_ctx, g_mask = _pad_to(g_ctx, g_mask, _bucket(g_ctx.shape[1]))
152
+ gen = torch.Generator(device=dev).manual_seed(int(seed))
153
+ hw = self.cfg["latent_hw"]
154
+ z = torch.randn(n, 4, hw, hw, device=dev, generator=gen)
155
+ dt = 1.0 / steps
156
+ for i in range(steps):
157
+ t = torch.full((n,), i * dt, device=dev)
158
+ vc, vu = self.model(torch.cat([z, z]), torch.cat([t, t]), both_ctx, both_mask).chunk(2)
159
+ v = vu + cfg * (vc - vu)
160
+ if autoguide:
161
+ v = v + autoguide * (vc - self.guide(z, t, g_ctx, g_mask))
162
+ z = z + dt * v
163
+ x = self.vae.decode((z / self.vae_div).to(self.vae.dtype)).sample
164
+ x = ((x.float().clamp(-1, 1) + 1) * 127.5).round().byte().permute(0, 2, 3, 1).cpu().numpy()
165
+ from PIL import Image
166
+ imgs = [Image.fromarray(a) for a in x]
167
+ if watermark:
168
+ imgs = [add_watermark(im) for im in imgs]
169
+ if metadata:
170
+ for k, im in enumerate(imgs):
171
+ im.info.update(provenance(prompt if record_prompt else None, int(seed) if record_prompt else None,
172
+ {"image_index": str(k)} if n > 1 else None))
173
+ return imgs
agate/text_encoder.py ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Flan-T5-Base encoder, used exactly as Supra2-IMG's inference.py uses it -- frozen by
2
+ default, optionally with its top blocks trainable.
3
+
4
+ Supra: tokenizer("google/flan-t5-base"), max_length 128, truncation, fp32 weights run
5
+ under bf16 autocast, `last_hidden_state`, and the empty string "" encoded as the
6
+ unconditional context for CFG. The only difference is padding="longest" instead of
7
+ padding="max_length": T5 masks padded keys, so real-token outputs are unchanged and
8
+ typical batches (FLUX-Reason captions: p50 ~48, p90 ~70 tokens) run ~2x cheaper.
9
+
10
+ train_blocks=N unfreezes the top N of the 12 encoder blocks plus the final layer norm.
11
+ The lower blocks (and the relative-position bias, which lives in block 0) stay frozen, so
12
+ general language knowledge is kept while the top re-shapes caption embeddings for the
13
+ image model. Dropout stays off (eval mode) either way.
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import torch
18
+
19
+
20
+ def unfreeze_top_blocks(t5_encoder_model, n: int) -> list:
21
+ """Freeze everything, then unfreeze the top `n` encoder blocks and the final layer norm;
22
+ n < 0 unfreezes the WHOLE encoder (token embeddings and relative-position bias too).
23
+ Returns the trainable (name, parameter) pairs."""
24
+ t5_encoder_model.requires_grad_(n < 0)
25
+ if n > 0:
26
+ enc = t5_encoder_model.encoder
27
+ if not 0 < n <= len(enc.block):
28
+ raise ValueError(f"train_blocks={n}, but the encoder has {len(enc.block)} blocks")
29
+ for blk in enc.block[-n:]:
30
+ blk.requires_grad_(True)
31
+ enc.final_layer_norm.requires_grad_(True)
32
+ return [(name, p) for name, p in t5_encoder_model.named_parameters() if p.requires_grad]
33
+
34
+
35
+ class T5TextEncoder:
36
+ def __init__(self, path: str, device, max_len: int = 128, train_blocks: int = 0):
37
+ from transformers import AutoTokenizer, T5EncoderModel
38
+ self.device, self.max_len = torch.device(device), max_len
39
+ self.tok = AutoTokenizer.from_pretrained(path)
40
+ self.model = T5EncoderModel.from_pretrained(path, torch_dtype=torch.float32).to(self.device)
41
+ self.model.eval().requires_grad_(False)
42
+ self.dim = self.model.config.d_model
43
+ # (name, parameter) of everything that trains; empty when frozen
44
+ self.trainable = unfreeze_top_blocks(self.model, train_blocks)
45
+
46
+ def tokenize(self, captions: list[str], pad_to: int = 1) -> tuple[torch.Tensor, torch.Tensor]:
47
+ """CPU only -- safe to run on the prefetch thread. `pad_to` rounds the length up
48
+ (masked padding) so a compiled model sees few distinct shapes."""
49
+ t = self.tok(captions, padding="longest", truncation=True, max_length=self.max_len,
50
+ return_tensors="pt")
51
+ ids, mask = t["input_ids"], t["attention_mask"]
52
+ extra = (-ids.shape[1]) % pad_to
53
+ if extra:
54
+ ids = torch.nn.functional.pad(ids, (0, extra), value=self.tok.pad_token_id)
55
+ mask = torch.nn.functional.pad(mask, (0, extra))
56
+ return ids, mask
57
+
58
+ def encode(self, ids: torch.Tensor, mask: torch.Tensor, grad: bool = False
59
+ ) -> tuple[torch.Tensor, torch.Tensor]:
60
+ ids, mask = ids.to(self.device, non_blocking=True), mask.to(self.device, non_blocking=True)
61
+ with torch.set_grad_enabled(grad and bool(self.trainable)), \
62
+ torch.autocast(self.device.type, dtype=torch.bfloat16, enabled=self.device.type == "cuda"):
63
+ h = self.model(input_ids=ids, attention_mask=mask).last_hidden_state
64
+ return h.float(), mask
65
+
66
+ def __call__(self, captions: list[str]) -> tuple[torch.Tensor, torch.Tensor]:
67
+ """-> (ctx (B, L, 768) fp32, mask (B, L) long). Never builds a graph."""
68
+ return self.encode(*self.tokenize(captions))
69
+
70
+
71
+ def _load_modernbert(path: str):
72
+ """AutoModel.from_pretrained, or -- where transformers refuses a .bin checkpoint on
73
+ torch < 2.6 (Ettin ships only pytorch_model.bin) -- build from the config and load the
74
+ state dict with weights_only=True. The MLM head's tensors are dropped."""
75
+ from transformers import AutoConfig, AutoModel
76
+ try:
77
+ return AutoModel.from_pretrained(path, torch_dtype=torch.float32)
78
+ except ValueError:
79
+ import os
80
+ m = AutoModel.from_config(AutoConfig.from_pretrained(path))
81
+ f = os.path.join(path, "pytorch_model.bin") if os.path.isdir(path) else None
82
+ if f is None:
83
+ from huggingface_hub import hf_hub_download
84
+ f = hf_hub_download(path, "pytorch_model.bin")
85
+ sd = {k.removeprefix("model."): v for k, v in torch.load(f, map_location="cpu", weights_only=True).items()}
86
+ missing, _ = m.load_state_dict(sd, strict=False)
87
+ if missing:
88
+ raise KeyError(f"{path}: encoder tensors missing from the checkpoint: {missing[:5]}")
89
+ return m
90
+
91
+
92
+ class EttinTextEncoder:
93
+ """Ettin (jhu-clsp/ettin-encoder-68m, MIT): a ModernBERT encoder, 68M, hidden 512,
94
+ byte-level BPE (keeps case, punctuation, accents and non-Latin brand names that
95
+ Flan-T5's SentencePiece maps to <unk>). Same interface as T5TextEncoder.
96
+
97
+ train_blocks != 0 trains the WHOLE encoder (there is no "top blocks" option: it is
98
+ small, and the conditioning space has to be learned anew anyway). The empty string
99
+ encodes as [CLS][SEP], the unconditional context for CFG."""
100
+
101
+ def __init__(self, path: str, device, max_len: int = 128, train_blocks: int = 0, grad_ckpt: bool = False):
102
+ from transformers import AutoTokenizer
103
+ self.device, self.max_len = torch.device(device), max_len
104
+ self.tok = AutoTokenizer.from_pretrained(path)
105
+ self.model = _load_modernbert(path).to(self.device)
106
+ self.model.eval().requires_grad_(bool(train_blocks))
107
+ if grad_ckpt and train_blocks:
108
+ # HF only checkpoints in train() mode; every Ettin dropout is 0.0 (config), so train()
109
+ # changes nothing numerically. Recomputes each layer in the backward: trainable Ettin
110
+ # activations were ~22 GB/GPU at 128 x 416 tokens uncompiled (2026-09-25 OOM).
111
+ if any(getattr(self.model.config, k, 0) for k in ("attention_dropout", "mlp_dropout", "embedding_dropout")):
112
+ raise ValueError("Ettin checkpointing needs train() mode, but this config has dropout")
113
+ self.model.gradient_checkpointing_enable(gradient_checkpointing_kwargs={"use_reentrant": False})
114
+ self.model.train()
115
+ self.dim = self.model.config.hidden_size
116
+ self.trainable = [(n, p) for n, p in self.model.named_parameters() if p.requires_grad]
117
+
118
+ def tokenize(self, captions: list[str], pad_to: int = 1) -> tuple[torch.Tensor, torch.Tensor]:
119
+ t = self.tok(captions, padding="longest", truncation=True, max_length=self.max_len,
120
+ return_tensors="pt")
121
+ ids, mask = t["input_ids"], t["attention_mask"]
122
+ extra = (-ids.shape[1]) % pad_to
123
+ if extra:
124
+ ids = torch.nn.functional.pad(ids, (0, extra), value=self.tok.pad_token_id)
125
+ mask = torch.nn.functional.pad(mask, (0, extra))
126
+ return ids, mask
127
+
128
+ def encode(self, ids: torch.Tensor, mask: torch.Tensor, grad: bool = False
129
+ ) -> tuple[torch.Tensor, torch.Tensor]:
130
+ ids, mask = ids.to(self.device, non_blocking=True), mask.to(self.device, non_blocking=True)
131
+ with torch.set_grad_enabled(grad and bool(self.trainable)), \
132
+ torch.autocast(self.device.type, dtype=torch.bfloat16, enabled=self.device.type == "cuda"):
133
+ h = self.model(input_ids=ids, attention_mask=mask).last_hidden_state
134
+ return h.float(), mask
135
+
136
+ def __call__(self, captions: list[str]) -> tuple[torch.Tensor, torch.Tensor]:
137
+ return self.encode(*self.tokenize(captions))
138
+
139
+
140
+ def build_text_encoder(kind: str, path: str, device, max_len: int = 128, train_blocks: int = 0,
141
+ grad_ckpt: bool = False):
142
+ if kind == "t5":
143
+ return T5TextEncoder(path, device, max_len=max_len, train_blocks=train_blocks)
144
+ if kind == "ettin":
145
+ return EttinTextEncoder(path, device, max_len=max_len, train_blocks=train_blocks, grad_ckpt=grad_ckpt)
146
+ raise ValueError(f"unknown text encoder {kind!r} (expected t5 or ettin)")
147
+
148
+
149
+ class HashTextEncoder:
150
+ """Stand-in for tests and --debug_tiny: deterministic per-character embeddings, same
151
+ interface and masking behaviour, no download. "" gives one token, like T5's </s>.
152
+ train_blocks > 0 makes the embedding table trainable (the whole "encoder")."""
153
+
154
+ def __init__(self, dim: int = 768, device="cpu", max_len: int = 128, seed: int = 0,
155
+ train_blocks: int = 0):
156
+ g = torch.Generator().manual_seed(seed)
157
+ self.table = torch.nn.Parameter(torch.randn(257, dim, generator=g), requires_grad=bool(train_blocks))
158
+ self.device, self.max_len, self.dim = torch.device(device), max_len, dim
159
+ self.trainable = [("table", self.table)] if train_blocks else []
160
+
161
+ def tokenize(self, captions: list[str], pad_to: int = 1) -> tuple[torch.Tensor, torch.Tensor]:
162
+ ids = [[256] + [b for b in c.encode("utf-8")][: self.max_len - 1] for c in captions]
163
+ L = max(len(i) for i in ids)
164
+ L += (-L) % pad_to
165
+ mask = torch.zeros(len(ids), L, dtype=torch.long)
166
+ idx = torch.zeros(len(ids), L, dtype=torch.long)
167
+ for r, i in enumerate(ids):
168
+ idx[r, : len(i)] = torch.tensor(i)
169
+ mask[r, : len(i)] = 1
170
+ return idx, mask
171
+
172
+ def encode(self, ids: torch.Tensor, mask: torch.Tensor, grad: bool = False
173
+ ) -> tuple[torch.Tensor, torch.Tensor]:
174
+ with torch.set_grad_enabled(grad and bool(self.trainable)):
175
+ return self.table[ids.cpu()].to(self.device), mask.to(self.device)
176
+
177
+ def __call__(self, captions: list[str]) -> tuple[torch.Tensor, torch.Tensor]:
178
+ return self.encode(*self.tokenize(captions))
assets/acknowledgment-banner.png ADDED
assets/battery_part1.png ADDED

Git LFS Details

  • SHA256: c7b81a4c02fe4342d7eea182b93d219a53afaf02855774e59a66b5d1b8b69856
  • Pointer size: 132 Bytes
  • Size of remote file: 2.98 MB
assets/battery_part2.png ADDED

Git LFS Details

  • SHA256: 0fece8261647e1f307fac9e1c07d1a715d8c1f29832e91273300a41db087d78e
  • Pointer size: 132 Bytes
  • Size of remote file: 2.92 MB
assets/colophon.png ADDED
assets/concept.png ADDED

Git LFS Details

  • SHA256: 8d0e8a11ac34eef12ebe682d1bff6b9530956b3e7acebd1d26fc3fc929873daf
  • Pointer size: 131 Bytes
  • Size of remote file: 978 kB
assets/dashboard.png ADDED

Git LFS Details

  • SHA256: 87a128261db26acbb8c3546d9b4f331447ed1ffc2b0db609531aad0d8a08941b
  • Pointer size: 131 Bytes
  • Size of remote file: 241 kB
assets/energy.png ADDED

Git LFS Details

  • SHA256: b3b5551fc9273990ff445b5028090b3f9fcf2ffd860ed50ef960268205683f4f
  • Pointer size: 131 Bytes
  • Size of remote file: 412 kB
assets/geneval_categories.png ADDED

Git LFS Details

  • SHA256: 96f8b256a2e14f63cc73137db03024cb17c117047d35a73e9f02fd290d59ddf0
  • Pointer size: 131 Bytes
  • Size of remote file: 160 kB
assets/geneval_lineage.png ADDED

Git LFS Details

  • SHA256: f71fc15d5fcf9d1ab1f0f08ac7f6182e8f2c89abca123b6b8ecfbcd74cd30561
  • Pointer size: 131 Bytes
  • Size of remote file: 345 kB
assets/hero_samples.png ADDED

Git LFS Details

  • SHA256: 968d3a80269c0a0c4c99381e561d36185c92ca9ec4ada35e6758ff42a4fd83df
  • Pointer size: 131 Bytes
  • Size of remote file: 949 kB
assets/judge_detail.png ADDED

Git LFS Details

  • SHA256: b9ddb63b0a413cbf9383122176801b6ce955760757ce8fdb77e7da54a73664b1
  • Pointer size: 131 Bytes
  • Size of remote file: 334 kB
assets/loss.png ADDED

Git LFS Details

  • SHA256: f7af92f068d0a7b51bede0840dc890a2f3c874f002893ff1bcc69a757f35f6b9
  • Pointer size: 131 Bytes
  • Size of remote file: 269 kB
assets/masthead.png ADDED

Git LFS Details

  • SHA256: 2bcf0e353ff2c75040b986638dee98b67d0b940bfafee174ab033617593341be
  • Pointer size: 132 Bytes
  • Size of remote file: 1.21 MB
assets/numbers.png ADDED

Git LFS Details

  • SHA256: 1f9bdb913faed26af09fae08055fd594ce6ddae971b835a8110f33211fe0f6dd
  • Pointer size: 131 Bytes
  • Size of remote file: 123 kB
assets/pareto.png ADDED

Git LFS Details

  • SHA256: 176ca55077b149440d62e1ec28ce91ed9ce1c28df1f4b1693a15dcefb0f5e8f1
  • Pointer size: 131 Bytes
  • Size of remote file: 166 kB
assets/qib.png ADDED

Git LFS Details

  • SHA256: 9f0af2b959bd53a729c6145bc01baed3e0328a24791a4233dfeaf0545dee7b52
  • Pointer size: 131 Bytes
  • Size of remote file: 195 kB
assets/side_by_side.png ADDED

Git LFS Details

  • SHA256: 179965865e426e667a168c89cbebf01897e31bbcce3be8ccbec01282554620f8
  • Pointer size: 132 Bytes
  • Size of remote file: 4.36 MB
config.json ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "agate",
3
+ "arch": "fcdm_t2",
4
+ "model_kw": {
5
+ "widths": [
6
+ 288,
7
+ 832,
8
+ 1664
9
+ ],
10
+ "depths": [
11
+ 4,
12
+ 6,
13
+ 2
14
+ ],
15
+ "steer_rank": [
16
+ 128,
17
+ 256,
18
+ 256
19
+ ],
20
+ "ctx_dim": 512,
21
+ "dim": 640,
22
+ "prelude": 3,
23
+ "core": 3,
24
+ "coda": 2,
25
+ "loops": 4,
26
+ "loop_probs": [
27
+ 0.0,
28
+ 0.0,
29
+ 0.0,
30
+ 1.0
31
+ ]
32
+ },
33
+ "params_generator": 190929092,
34
+ "text_encoder": "text_encoder",
35
+ "text_max_len": 512,
36
+ "guide": {
37
+ "generator": "guide/generator.safetensors",
38
+ "text_encoder": "guide/text_encoder",
39
+ "text_max_len": 128,
40
+ "step": 27600
41
+ },
42
+ "vae": "stabilityai/sd-vae-ft-mse",
43
+ "vae_scale": 0.18215,
44
+ "fast_vae": "madebyollin/taesd",
45
+ "resolution": 256,
46
+ "latent_hw": 32,
47
+ "sampler": {
48
+ "kind": "euler",
49
+ "steps": 50,
50
+ "cfg": 3.0,
51
+ "t0_is_noise": true,
52
+ "uncond_prompt": ""
53
+ },
54
+ "training": {
55
+ "step": 138010,
56
+ "samples_seen": 186634240,
57
+ "continued_from": "T40r caption phase, step 82,800 (the run that became Agate Preview 001)",
58
+ "gpu_hours_gh200_lineage": 187.7,
59
+ "energy_kwh_at_wall_lineage": 107.1,
60
+ "co2e_kg_lineage": 3.21,
61
+ "dataset": "LucasFang/FLUX-Reason-6M",
62
+ "lineage_note": "whole lineage from scratch, jobs pro-rated by steps where this release branched mid-run (perun ledger, PUE 1.3, 30 g/kWh)"
63
+ },
64
+ "training_compute_flop": {
65
+ "estimate": 6.5e+19,
66
+ "range": [
67
+ 5.8e+19,
68
+ 7.2e+19
69
+ ],
70
+ "including_text_encoder_pretraining": 8.6e+20,
71
+ "method": "measured forward FLOPs per image (torch.utils.flop_counter, batch 1, 128-token context) x images seen x 3 (forward + backward); Ettin at 128 tokens (low) to 4x (high); excludes the compute used by third parties to generate the synthetic training images",
72
+ "forward_gflop_per_image": {
73
+ "256": 94.4
74
+ }
75
+ },
76
+ "output_marking": {
77
+ "watermark": "invisible-watermark dwtDctSvd",
78
+ "payload": "AGATE002",
79
+ "metadata_keys": [
80
+ "ai_generated",
81
+ "generator",
82
+ "model",
83
+ "watermark"
84
+ ],
85
+ "default": "on",
86
+ "detect": "agate.detect_watermark(img)"
87
+ }
88
+ }
generator.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83bd6fe59c8f4adb964fd45c2021c2630f59d938fa5776db69e5a5ca43b82608
3
+ size 763771176
guide/generator.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88aa017bf600cae1cd50f794e227f30c9aadff500476940ff41758459b65f499
3
+ size 763771176
guide/text_encoder/config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 50281,
8
+ "causal_mask": false,
9
+ "classifier_activation": "gelu",
10
+ "classifier_bias": false,
11
+ "classifier_dropout": 0.0,
12
+ "classifier_pooling": "mean",
13
+ "cls_token_id": 50281,
14
+ "decoder_bias": true,
15
+ "deterministic_flash_attn": false,
16
+ "dtype": "float32",
17
+ "embedding_dropout": 0.0,
18
+ "eos_token_id": 50282,
19
+ "global_attn_every_n_layers": 3,
20
+ "global_rope_theta": 160000.0,
21
+ "gradient_checkpointing": false,
22
+ "hidden_activation": "gelu",
23
+ "hidden_size": 512,
24
+ "initializer_cutoff_factor": 2.0,
25
+ "initializer_range": 0.02,
26
+ "intermediate_size": 768,
27
+ "is_causal": false,
28
+ "layer_norm_eps": 1e-05,
29
+ "local_attention": 128,
30
+ "local_rope_theta": 160000.0,
31
+ "max_position_embeddings": 7999,
32
+ "mlp_bias": false,
33
+ "mlp_dropout": 0.0,
34
+ "model_type": "modernbert",
35
+ "norm_bias": false,
36
+ "norm_eps": 1e-05,
37
+ "num_attention_heads": 8,
38
+ "num_hidden_layers": 19,
39
+ "pad_token_id": 50283,
40
+ "position_embedding_type": "sans_pos",
41
+ "repad_logits_with_grad": false,
42
+ "sep_token_id": 50282,
43
+ "sparse_pred_ignore_index": -100,
44
+ "sparse_prediction": false,
45
+ "transformers_version": "4.57.6",
46
+ "vocab_size": 50368
47
+ }
guide/text_encoder/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8ea1796feb8f3613be192db6a2dd04e475ab44c5f3da3f9b3641f44ab48c806
3
+ size 272589832
guide/text_encoder/special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": true,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
guide/text_encoder/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
guide/text_encoder/tokenizer_config.json ADDED
@@ -0,0 +1,945 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "|||IP_ADDRESS|||",
5
+ "lstrip": false,
6
+ "normalized": true,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": false
10
+ },
11
+ "1": {
12
+ "content": "<|padding|>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "50254": {
20
+ "content": " ",
21
+ "lstrip": false,
22
+ "normalized": true,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": false
26
+ },
27
+ "50255": {
28
+ "content": " ",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": false
34
+ },
35
+ "50256": {
36
+ "content": " ",
37
+ "lstrip": false,
38
+ "normalized": true,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": false
42
+ },
43
+ "50257": {
44
+ "content": " ",
45
+ "lstrip": false,
46
+ "normalized": true,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": false
50
+ },
51
+ "50258": {
52
+ "content": " ",
53
+ "lstrip": false,
54
+ "normalized": true,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": false
58
+ },
59
+ "50259": {
60
+ "content": " ",
61
+ "lstrip": false,
62
+ "normalized": true,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": false
66
+ },
67
+ "50260": {
68
+ "content": " ",
69
+ "lstrip": false,
70
+ "normalized": true,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": false
74
+ },
75
+ "50261": {
76
+ "content": " ",
77
+ "lstrip": false,
78
+ "normalized": true,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": false
82
+ },
83
+ "50262": {
84
+ "content": " ",
85
+ "lstrip": false,
86
+ "normalized": true,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": false
90
+ },
91
+ "50263": {
92
+ "content": " ",
93
+ "lstrip": false,
94
+ "normalized": true,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": false
98
+ },
99
+ "50264": {
100
+ "content": " ",
101
+ "lstrip": false,
102
+ "normalized": true,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": false
106
+ },
107
+ "50265": {
108
+ "content": " ",
109
+ "lstrip": false,
110
+ "normalized": true,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": false
114
+ },
115
+ "50266": {
116
+ "content": " ",
117
+ "lstrip": false,
118
+ "normalized": true,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": false
122
+ },
123
+ "50267": {
124
+ "content": " ",
125
+ "lstrip": false,
126
+ "normalized": true,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": false
130
+ },
131
+ "50268": {
132
+ "content": " ",
133
+ "lstrip": false,
134
+ "normalized": true,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": false
138
+ },
139
+ "50269": {
140
+ "content": " ",
141
+ "lstrip": false,
142
+ "normalized": true,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": false
146
+ },
147
+ "50270": {
148
+ "content": " ",
149
+ "lstrip": false,
150
+ "normalized": true,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": false
154
+ },
155
+ "50271": {
156
+ "content": " ",
157
+ "lstrip": false,
158
+ "normalized": true,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": false
162
+ },
163
+ "50272": {
164
+ "content": " ",
165
+ "lstrip": false,
166
+ "normalized": true,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": false
170
+ },
171
+ "50273": {
172
+ "content": " ",
173
+ "lstrip": false,
174
+ "normalized": true,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": false
178
+ },
179
+ "50274": {
180
+ "content": " ",
181
+ "lstrip": false,
182
+ "normalized": true,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": false
186
+ },
187
+ "50275": {
188
+ "content": " ",
189
+ "lstrip": false,
190
+ "normalized": true,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": false
194
+ },
195
+ "50276": {
196
+ "content": " ",
197
+ "lstrip": false,
198
+ "normalized": true,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": false
202
+ },
203
+ "50277": {
204
+ "content": "|||EMAIL_ADDRESS|||",
205
+ "lstrip": false,
206
+ "normalized": true,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": false
210
+ },
211
+ "50278": {
212
+ "content": "|||PHONE_NUMBER|||",
213
+ "lstrip": false,
214
+ "normalized": true,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": false
218
+ },
219
+ "50279": {
220
+ "content": "<|endoftext|>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "50280": {
228
+ "content": "[UNK]",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "50281": {
236
+ "content": "[CLS]",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "50282": {
244
+ "content": "[SEP]",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "50283": {
252
+ "content": "[PAD]",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "50284": {
260
+ "content": "[MASK]",
261
+ "lstrip": true,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "50285": {
268
+ "content": "[unused0]",
269
+ "lstrip": false,
270
+ "normalized": true,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": false
274
+ },
275
+ "50286": {
276
+ "content": "[unused1]",
277
+ "lstrip": false,
278
+ "normalized": true,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": false
282
+ },
283
+ "50287": {
284
+ "content": "[unused2]",
285
+ "lstrip": false,
286
+ "normalized": true,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": false
290
+ },
291
+ "50288": {
292
+ "content": "[unused3]",
293
+ "lstrip": false,
294
+ "normalized": true,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": false
298
+ },
299
+ "50289": {
300
+ "content": "[unused4]",
301
+ "lstrip": false,
302
+ "normalized": true,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": false
306
+ },
307
+ "50290": {
308
+ "content": "[unused5]",
309
+ "lstrip": false,
310
+ "normalized": true,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": false
314
+ },
315
+ "50291": {
316
+ "content": "[unused6]",
317
+ "lstrip": false,
318
+ "normalized": true,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": false
322
+ },
323
+ "50292": {
324
+ "content": "[unused7]",
325
+ "lstrip": false,
326
+ "normalized": true,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": false
330
+ },
331
+ "50293": {
332
+ "content": "[unused8]",
333
+ "lstrip": false,
334
+ "normalized": true,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": false
338
+ },
339
+ "50294": {
340
+ "content": "[unused9]",
341
+ "lstrip": false,
342
+ "normalized": true,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": false
346
+ },
347
+ "50295": {
348
+ "content": "[unused10]",
349
+ "lstrip": false,
350
+ "normalized": true,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": false
354
+ },
355
+ "50296": {
356
+ "content": "[unused11]",
357
+ "lstrip": false,
358
+ "normalized": true,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": false
362
+ },
363
+ "50297": {
364
+ "content": "[unused12]",
365
+ "lstrip": false,
366
+ "normalized": true,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": false
370
+ },
371
+ "50298": {
372
+ "content": "[unused13]",
373
+ "lstrip": false,
374
+ "normalized": true,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": false
378
+ },
379
+ "50299": {
380
+ "content": "[unused14]",
381
+ "lstrip": false,
382
+ "normalized": true,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": false
386
+ },
387
+ "50300": {
388
+ "content": "[unused15]",
389
+ "lstrip": false,
390
+ "normalized": true,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": false
394
+ },
395
+ "50301": {
396
+ "content": "[unused16]",
397
+ "lstrip": false,
398
+ "normalized": true,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": false
402
+ },
403
+ "50302": {
404
+ "content": "[unused17]",
405
+ "lstrip": false,
406
+ "normalized": true,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": false
410
+ },
411
+ "50303": {
412
+ "content": "[unused18]",
413
+ "lstrip": false,
414
+ "normalized": true,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": false
418
+ },
419
+ "50304": {
420
+ "content": "[unused19]",
421
+ "lstrip": false,
422
+ "normalized": true,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": false
426
+ },
427
+ "50305": {
428
+ "content": "[unused20]",
429
+ "lstrip": false,
430
+ "normalized": true,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": false
434
+ },
435
+ "50306": {
436
+ "content": "[unused21]",
437
+ "lstrip": false,
438
+ "normalized": true,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": false
442
+ },
443
+ "50307": {
444
+ "content": "[unused22]",
445
+ "lstrip": false,
446
+ "normalized": true,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": false
450
+ },
451
+ "50308": {
452
+ "content": "[unused23]",
453
+ "lstrip": false,
454
+ "normalized": true,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": false
458
+ },
459
+ "50309": {
460
+ "content": "[unused24]",
461
+ "lstrip": false,
462
+ "normalized": true,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": false
466
+ },
467
+ "50310": {
468
+ "content": "[unused25]",
469
+ "lstrip": false,
470
+ "normalized": true,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": false
474
+ },
475
+ "50311": {
476
+ "content": "[unused26]",
477
+ "lstrip": false,
478
+ "normalized": true,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": false
482
+ },
483
+ "50312": {
484
+ "content": "[unused27]",
485
+ "lstrip": false,
486
+ "normalized": true,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": false
490
+ },
491
+ "50313": {
492
+ "content": "[unused28]",
493
+ "lstrip": false,
494
+ "normalized": true,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": false
498
+ },
499
+ "50314": {
500
+ "content": "[unused29]",
501
+ "lstrip": false,
502
+ "normalized": true,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": false
506
+ },
507
+ "50315": {
508
+ "content": "[unused30]",
509
+ "lstrip": false,
510
+ "normalized": true,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": false
514
+ },
515
+ "50316": {
516
+ "content": "[unused31]",
517
+ "lstrip": false,
518
+ "normalized": true,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": false
522
+ },
523
+ "50317": {
524
+ "content": "[unused32]",
525
+ "lstrip": false,
526
+ "normalized": true,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": false
530
+ },
531
+ "50318": {
532
+ "content": "[unused33]",
533
+ "lstrip": false,
534
+ "normalized": true,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": false
538
+ },
539
+ "50319": {
540
+ "content": "[unused34]",
541
+ "lstrip": false,
542
+ "normalized": true,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": false
546
+ },
547
+ "50320": {
548
+ "content": "[unused35]",
549
+ "lstrip": false,
550
+ "normalized": true,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": false
554
+ },
555
+ "50321": {
556
+ "content": "[unused36]",
557
+ "lstrip": false,
558
+ "normalized": true,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": false
562
+ },
563
+ "50322": {
564
+ "content": "[unused37]",
565
+ "lstrip": false,
566
+ "normalized": true,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": false
570
+ },
571
+ "50323": {
572
+ "content": "[unused38]",
573
+ "lstrip": false,
574
+ "normalized": true,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": false
578
+ },
579
+ "50324": {
580
+ "content": "[unused39]",
581
+ "lstrip": false,
582
+ "normalized": true,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": false
586
+ },
587
+ "50325": {
588
+ "content": "[unused40]",
589
+ "lstrip": false,
590
+ "normalized": true,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": false
594
+ },
595
+ "50326": {
596
+ "content": "[unused41]",
597
+ "lstrip": false,
598
+ "normalized": true,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": false
602
+ },
603
+ "50327": {
604
+ "content": "[unused42]",
605
+ "lstrip": false,
606
+ "normalized": true,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": false
610
+ },
611
+ "50328": {
612
+ "content": "[unused43]",
613
+ "lstrip": false,
614
+ "normalized": true,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": false
618
+ },
619
+ "50329": {
620
+ "content": "[unused44]",
621
+ "lstrip": false,
622
+ "normalized": true,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": false
626
+ },
627
+ "50330": {
628
+ "content": "[unused45]",
629
+ "lstrip": false,
630
+ "normalized": true,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": false
634
+ },
635
+ "50331": {
636
+ "content": "[unused46]",
637
+ "lstrip": false,
638
+ "normalized": true,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": false
642
+ },
643
+ "50332": {
644
+ "content": "[unused47]",
645
+ "lstrip": false,
646
+ "normalized": true,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": false
650
+ },
651
+ "50333": {
652
+ "content": "[unused48]",
653
+ "lstrip": false,
654
+ "normalized": true,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": false
658
+ },
659
+ "50334": {
660
+ "content": "[unused49]",
661
+ "lstrip": false,
662
+ "normalized": true,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": false
666
+ },
667
+ "50335": {
668
+ "content": "[unused50]",
669
+ "lstrip": false,
670
+ "normalized": true,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": false
674
+ },
675
+ "50336": {
676
+ "content": "[unused51]",
677
+ "lstrip": false,
678
+ "normalized": true,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": false
682
+ },
683
+ "50337": {
684
+ "content": "[unused52]",
685
+ "lstrip": false,
686
+ "normalized": true,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": false
690
+ },
691
+ "50338": {
692
+ "content": "[unused53]",
693
+ "lstrip": false,
694
+ "normalized": true,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": false
698
+ },
699
+ "50339": {
700
+ "content": "[unused54]",
701
+ "lstrip": false,
702
+ "normalized": true,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": false
706
+ },
707
+ "50340": {
708
+ "content": "[unused55]",
709
+ "lstrip": false,
710
+ "normalized": true,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": false
714
+ },
715
+ "50341": {
716
+ "content": "[unused56]",
717
+ "lstrip": false,
718
+ "normalized": true,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": false
722
+ },
723
+ "50342": {
724
+ "content": "[unused57]",
725
+ "lstrip": false,
726
+ "normalized": true,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": false
730
+ },
731
+ "50343": {
732
+ "content": "[unused58]",
733
+ "lstrip": false,
734
+ "normalized": true,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": false
738
+ },
739
+ "50344": {
740
+ "content": "[unused59]",
741
+ "lstrip": false,
742
+ "normalized": true,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": false
746
+ },
747
+ "50345": {
748
+ "content": "[unused60]",
749
+ "lstrip": false,
750
+ "normalized": true,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": false
754
+ },
755
+ "50346": {
756
+ "content": "[unused61]",
757
+ "lstrip": false,
758
+ "normalized": true,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": false
762
+ },
763
+ "50347": {
764
+ "content": "[unused62]",
765
+ "lstrip": false,
766
+ "normalized": true,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": false
770
+ },
771
+ "50348": {
772
+ "content": "[unused63]",
773
+ "lstrip": false,
774
+ "normalized": true,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": false
778
+ },
779
+ "50349": {
780
+ "content": "[unused64]",
781
+ "lstrip": false,
782
+ "normalized": true,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": false
786
+ },
787
+ "50350": {
788
+ "content": "[unused65]",
789
+ "lstrip": false,
790
+ "normalized": true,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": false
794
+ },
795
+ "50351": {
796
+ "content": "[unused66]",
797
+ "lstrip": false,
798
+ "normalized": true,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": false
802
+ },
803
+ "50352": {
804
+ "content": "[unused67]",
805
+ "lstrip": false,
806
+ "normalized": true,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": false
810
+ },
811
+ "50353": {
812
+ "content": "[unused68]",
813
+ "lstrip": false,
814
+ "normalized": true,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": false
818
+ },
819
+ "50354": {
820
+ "content": "[unused69]",
821
+ "lstrip": false,
822
+ "normalized": true,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": false
826
+ },
827
+ "50355": {
828
+ "content": "[unused70]",
829
+ "lstrip": false,
830
+ "normalized": true,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": false
834
+ },
835
+ "50356": {
836
+ "content": "[unused71]",
837
+ "lstrip": false,
838
+ "normalized": true,
839
+ "rstrip": false,
840
+ "single_word": false,
841
+ "special": false
842
+ },
843
+ "50357": {
844
+ "content": "[unused72]",
845
+ "lstrip": false,
846
+ "normalized": true,
847
+ "rstrip": false,
848
+ "single_word": false,
849
+ "special": false
850
+ },
851
+ "50358": {
852
+ "content": "[unused73]",
853
+ "lstrip": false,
854
+ "normalized": true,
855
+ "rstrip": false,
856
+ "single_word": false,
857
+ "special": false
858
+ },
859
+ "50359": {
860
+ "content": "[unused74]",
861
+ "lstrip": false,
862
+ "normalized": true,
863
+ "rstrip": false,
864
+ "single_word": false,
865
+ "special": false
866
+ },
867
+ "50360": {
868
+ "content": "[unused75]",
869
+ "lstrip": false,
870
+ "normalized": true,
871
+ "rstrip": false,
872
+ "single_word": false,
873
+ "special": false
874
+ },
875
+ "50361": {
876
+ "content": "[unused76]",
877
+ "lstrip": false,
878
+ "normalized": true,
879
+ "rstrip": false,
880
+ "single_word": false,
881
+ "special": false
882
+ },
883
+ "50362": {
884
+ "content": "[unused77]",
885
+ "lstrip": false,
886
+ "normalized": true,
887
+ "rstrip": false,
888
+ "single_word": false,
889
+ "special": false
890
+ },
891
+ "50363": {
892
+ "content": "[unused78]",
893
+ "lstrip": false,
894
+ "normalized": true,
895
+ "rstrip": false,
896
+ "single_word": false,
897
+ "special": false
898
+ },
899
+ "50364": {
900
+ "content": "[unused79]",
901
+ "lstrip": false,
902
+ "normalized": true,
903
+ "rstrip": false,
904
+ "single_word": false,
905
+ "special": false
906
+ },
907
+ "50365": {
908
+ "content": "[unused80]",
909
+ "lstrip": false,
910
+ "normalized": true,
911
+ "rstrip": false,
912
+ "single_word": false,
913
+ "special": false
914
+ },
915
+ "50366": {
916
+ "content": "[unused81]",
917
+ "lstrip": false,
918
+ "normalized": true,
919
+ "rstrip": false,
920
+ "single_word": false,
921
+ "special": false
922
+ },
923
+ "50367": {
924
+ "content": "[unused82]",
925
+ "lstrip": false,
926
+ "normalized": true,
927
+ "rstrip": false,
928
+ "single_word": false,
929
+ "special": false
930
+ }
931
+ },
932
+ "clean_up_tokenization_spaces": true,
933
+ "cls_token": "[CLS]",
934
+ "extra_special_tokens": {},
935
+ "mask_token": "[MASK]",
936
+ "model_input_names": [
937
+ "input_ids",
938
+ "attention_mask"
939
+ ],
940
+ "model_max_length": 8192,
941
+ "pad_token": "[PAD]",
942
+ "sep_token": "[SEP]",
943
+ "tokenizer_class": "PreTrainedTokenizerFast",
944
+ "unk_token": "[UNK]"
945
+ }
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ torch>=2.4
2
+ transformers>=4.48
3
+ diffusers>=0.30
4
+ safetensors
5
+ huggingface_hub
6
+ Pillow
7
+ invisible-watermark
text_encoder/config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 50281,
8
+ "causal_mask": false,
9
+ "classifier_activation": "gelu",
10
+ "classifier_bias": false,
11
+ "classifier_dropout": 0.0,
12
+ "classifier_pooling": "mean",
13
+ "cls_token_id": 50281,
14
+ "decoder_bias": true,
15
+ "deterministic_flash_attn": false,
16
+ "dtype": "float32",
17
+ "embedding_dropout": 0.0,
18
+ "eos_token_id": 50282,
19
+ "global_attn_every_n_layers": 3,
20
+ "global_rope_theta": 160000.0,
21
+ "gradient_checkpointing": false,
22
+ "hidden_activation": "gelu",
23
+ "hidden_size": 512,
24
+ "initializer_cutoff_factor": 2.0,
25
+ "initializer_range": 0.02,
26
+ "intermediate_size": 768,
27
+ "is_causal": false,
28
+ "layer_norm_eps": 1e-05,
29
+ "local_attention": 128,
30
+ "local_rope_theta": 160000.0,
31
+ "max_position_embeddings": 7999,
32
+ "mlp_bias": false,
33
+ "mlp_dropout": 0.0,
34
+ "model_type": "modernbert",
35
+ "norm_bias": false,
36
+ "norm_eps": 1e-05,
37
+ "num_attention_heads": 8,
38
+ "num_hidden_layers": 19,
39
+ "pad_token_id": 50283,
40
+ "position_embedding_type": "sans_pos",
41
+ "repad_logits_with_grad": false,
42
+ "sep_token_id": 50282,
43
+ "sparse_pred_ignore_index": -100,
44
+ "sparse_prediction": false,
45
+ "transformers_version": "4.57.6",
46
+ "vocab_size": 50368
47
+ }
text_encoder/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d9dc54182970c96923464a0b1db2d77cc8f4b299ddab9d83230a2ecc9b6dbd07
3
+ size 272589832
text_encoder/special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": true,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
text_encoder/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
text_encoder/tokenizer_config.json ADDED
@@ -0,0 +1,945 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "|||IP_ADDRESS|||",
5
+ "lstrip": false,
6
+ "normalized": true,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": false
10
+ },
11
+ "1": {
12
+ "content": "<|padding|>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "50254": {
20
+ "content": " ",
21
+ "lstrip": false,
22
+ "normalized": true,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": false
26
+ },
27
+ "50255": {
28
+ "content": " ",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": false
34
+ },
35
+ "50256": {
36
+ "content": " ",
37
+ "lstrip": false,
38
+ "normalized": true,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": false
42
+ },
43
+ "50257": {
44
+ "content": " ",
45
+ "lstrip": false,
46
+ "normalized": true,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": false
50
+ },
51
+ "50258": {
52
+ "content": " ",
53
+ "lstrip": false,
54
+ "normalized": true,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": false
58
+ },
59
+ "50259": {
60
+ "content": " ",
61
+ "lstrip": false,
62
+ "normalized": true,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": false
66
+ },
67
+ "50260": {
68
+ "content": " ",
69
+ "lstrip": false,
70
+ "normalized": true,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": false
74
+ },
75
+ "50261": {
76
+ "content": " ",
77
+ "lstrip": false,
78
+ "normalized": true,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": false
82
+ },
83
+ "50262": {
84
+ "content": " ",
85
+ "lstrip": false,
86
+ "normalized": true,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": false
90
+ },
91
+ "50263": {
92
+ "content": " ",
93
+ "lstrip": false,
94
+ "normalized": true,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": false
98
+ },
99
+ "50264": {
100
+ "content": " ",
101
+ "lstrip": false,
102
+ "normalized": true,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": false
106
+ },
107
+ "50265": {
108
+ "content": " ",
109
+ "lstrip": false,
110
+ "normalized": true,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": false
114
+ },
115
+ "50266": {
116
+ "content": " ",
117
+ "lstrip": false,
118
+ "normalized": true,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": false
122
+ },
123
+ "50267": {
124
+ "content": " ",
125
+ "lstrip": false,
126
+ "normalized": true,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": false
130
+ },
131
+ "50268": {
132
+ "content": " ",
133
+ "lstrip": false,
134
+ "normalized": true,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": false
138
+ },
139
+ "50269": {
140
+ "content": " ",
141
+ "lstrip": false,
142
+ "normalized": true,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": false
146
+ },
147
+ "50270": {
148
+ "content": " ",
149
+ "lstrip": false,
150
+ "normalized": true,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": false
154
+ },
155
+ "50271": {
156
+ "content": " ",
157
+ "lstrip": false,
158
+ "normalized": true,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": false
162
+ },
163
+ "50272": {
164
+ "content": " ",
165
+ "lstrip": false,
166
+ "normalized": true,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": false
170
+ },
171
+ "50273": {
172
+ "content": " ",
173
+ "lstrip": false,
174
+ "normalized": true,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": false
178
+ },
179
+ "50274": {
180
+ "content": " ",
181
+ "lstrip": false,
182
+ "normalized": true,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": false
186
+ },
187
+ "50275": {
188
+ "content": " ",
189
+ "lstrip": false,
190
+ "normalized": true,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": false
194
+ },
195
+ "50276": {
196
+ "content": " ",
197
+ "lstrip": false,
198
+ "normalized": true,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": false
202
+ },
203
+ "50277": {
204
+ "content": "|||EMAIL_ADDRESS|||",
205
+ "lstrip": false,
206
+ "normalized": true,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": false
210
+ },
211
+ "50278": {
212
+ "content": "|||PHONE_NUMBER|||",
213
+ "lstrip": false,
214
+ "normalized": true,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": false
218
+ },
219
+ "50279": {
220
+ "content": "<|endoftext|>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "50280": {
228
+ "content": "[UNK]",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "50281": {
236
+ "content": "[CLS]",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "50282": {
244
+ "content": "[SEP]",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "50283": {
252
+ "content": "[PAD]",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "50284": {
260
+ "content": "[MASK]",
261
+ "lstrip": true,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "50285": {
268
+ "content": "[unused0]",
269
+ "lstrip": false,
270
+ "normalized": true,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": false
274
+ },
275
+ "50286": {
276
+ "content": "[unused1]",
277
+ "lstrip": false,
278
+ "normalized": true,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": false
282
+ },
283
+ "50287": {
284
+ "content": "[unused2]",
285
+ "lstrip": false,
286
+ "normalized": true,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": false
290
+ },
291
+ "50288": {
292
+ "content": "[unused3]",
293
+ "lstrip": false,
294
+ "normalized": true,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": false
298
+ },
299
+ "50289": {
300
+ "content": "[unused4]",
301
+ "lstrip": false,
302
+ "normalized": true,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": false
306
+ },
307
+ "50290": {
308
+ "content": "[unused5]",
309
+ "lstrip": false,
310
+ "normalized": true,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": false
314
+ },
315
+ "50291": {
316
+ "content": "[unused6]",
317
+ "lstrip": false,
318
+ "normalized": true,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": false
322
+ },
323
+ "50292": {
324
+ "content": "[unused7]",
325
+ "lstrip": false,
326
+ "normalized": true,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": false
330
+ },
331
+ "50293": {
332
+ "content": "[unused8]",
333
+ "lstrip": false,
334
+ "normalized": true,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": false
338
+ },
339
+ "50294": {
340
+ "content": "[unused9]",
341
+ "lstrip": false,
342
+ "normalized": true,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": false
346
+ },
347
+ "50295": {
348
+ "content": "[unused10]",
349
+ "lstrip": false,
350
+ "normalized": true,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": false
354
+ },
355
+ "50296": {
356
+ "content": "[unused11]",
357
+ "lstrip": false,
358
+ "normalized": true,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": false
362
+ },
363
+ "50297": {
364
+ "content": "[unused12]",
365
+ "lstrip": false,
366
+ "normalized": true,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": false
370
+ },
371
+ "50298": {
372
+ "content": "[unused13]",
373
+ "lstrip": false,
374
+ "normalized": true,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": false
378
+ },
379
+ "50299": {
380
+ "content": "[unused14]",
381
+ "lstrip": false,
382
+ "normalized": true,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": false
386
+ },
387
+ "50300": {
388
+ "content": "[unused15]",
389
+ "lstrip": false,
390
+ "normalized": true,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": false
394
+ },
395
+ "50301": {
396
+ "content": "[unused16]",
397
+ "lstrip": false,
398
+ "normalized": true,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": false
402
+ },
403
+ "50302": {
404
+ "content": "[unused17]",
405
+ "lstrip": false,
406
+ "normalized": true,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": false
410
+ },
411
+ "50303": {
412
+ "content": "[unused18]",
413
+ "lstrip": false,
414
+ "normalized": true,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": false
418
+ },
419
+ "50304": {
420
+ "content": "[unused19]",
421
+ "lstrip": false,
422
+ "normalized": true,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": false
426
+ },
427
+ "50305": {
428
+ "content": "[unused20]",
429
+ "lstrip": false,
430
+ "normalized": true,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": false
434
+ },
435
+ "50306": {
436
+ "content": "[unused21]",
437
+ "lstrip": false,
438
+ "normalized": true,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": false
442
+ },
443
+ "50307": {
444
+ "content": "[unused22]",
445
+ "lstrip": false,
446
+ "normalized": true,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": false
450
+ },
451
+ "50308": {
452
+ "content": "[unused23]",
453
+ "lstrip": false,
454
+ "normalized": true,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": false
458
+ },
459
+ "50309": {
460
+ "content": "[unused24]",
461
+ "lstrip": false,
462
+ "normalized": true,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": false
466
+ },
467
+ "50310": {
468
+ "content": "[unused25]",
469
+ "lstrip": false,
470
+ "normalized": true,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": false
474
+ },
475
+ "50311": {
476
+ "content": "[unused26]",
477
+ "lstrip": false,
478
+ "normalized": true,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": false
482
+ },
483
+ "50312": {
484
+ "content": "[unused27]",
485
+ "lstrip": false,
486
+ "normalized": true,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": false
490
+ },
491
+ "50313": {
492
+ "content": "[unused28]",
493
+ "lstrip": false,
494
+ "normalized": true,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": false
498
+ },
499
+ "50314": {
500
+ "content": "[unused29]",
501
+ "lstrip": false,
502
+ "normalized": true,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": false
506
+ },
507
+ "50315": {
508
+ "content": "[unused30]",
509
+ "lstrip": false,
510
+ "normalized": true,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": false
514
+ },
515
+ "50316": {
516
+ "content": "[unused31]",
517
+ "lstrip": false,
518
+ "normalized": true,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": false
522
+ },
523
+ "50317": {
524
+ "content": "[unused32]",
525
+ "lstrip": false,
526
+ "normalized": true,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": false
530
+ },
531
+ "50318": {
532
+ "content": "[unused33]",
533
+ "lstrip": false,
534
+ "normalized": true,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": false
538
+ },
539
+ "50319": {
540
+ "content": "[unused34]",
541
+ "lstrip": false,
542
+ "normalized": true,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": false
546
+ },
547
+ "50320": {
548
+ "content": "[unused35]",
549
+ "lstrip": false,
550
+ "normalized": true,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": false
554
+ },
555
+ "50321": {
556
+ "content": "[unused36]",
557
+ "lstrip": false,
558
+ "normalized": true,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": false
562
+ },
563
+ "50322": {
564
+ "content": "[unused37]",
565
+ "lstrip": false,
566
+ "normalized": true,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": false
570
+ },
571
+ "50323": {
572
+ "content": "[unused38]",
573
+ "lstrip": false,
574
+ "normalized": true,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": false
578
+ },
579
+ "50324": {
580
+ "content": "[unused39]",
581
+ "lstrip": false,
582
+ "normalized": true,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": false
586
+ },
587
+ "50325": {
588
+ "content": "[unused40]",
589
+ "lstrip": false,
590
+ "normalized": true,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": false
594
+ },
595
+ "50326": {
596
+ "content": "[unused41]",
597
+ "lstrip": false,
598
+ "normalized": true,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": false
602
+ },
603
+ "50327": {
604
+ "content": "[unused42]",
605
+ "lstrip": false,
606
+ "normalized": true,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": false
610
+ },
611
+ "50328": {
612
+ "content": "[unused43]",
613
+ "lstrip": false,
614
+ "normalized": true,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": false
618
+ },
619
+ "50329": {
620
+ "content": "[unused44]",
621
+ "lstrip": false,
622
+ "normalized": true,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": false
626
+ },
627
+ "50330": {
628
+ "content": "[unused45]",
629
+ "lstrip": false,
630
+ "normalized": true,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": false
634
+ },
635
+ "50331": {
636
+ "content": "[unused46]",
637
+ "lstrip": false,
638
+ "normalized": true,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": false
642
+ },
643
+ "50332": {
644
+ "content": "[unused47]",
645
+ "lstrip": false,
646
+ "normalized": true,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": false
650
+ },
651
+ "50333": {
652
+ "content": "[unused48]",
653
+ "lstrip": false,
654
+ "normalized": true,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": false
658
+ },
659
+ "50334": {
660
+ "content": "[unused49]",
661
+ "lstrip": false,
662
+ "normalized": true,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": false
666
+ },
667
+ "50335": {
668
+ "content": "[unused50]",
669
+ "lstrip": false,
670
+ "normalized": true,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": false
674
+ },
675
+ "50336": {
676
+ "content": "[unused51]",
677
+ "lstrip": false,
678
+ "normalized": true,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": false
682
+ },
683
+ "50337": {
684
+ "content": "[unused52]",
685
+ "lstrip": false,
686
+ "normalized": true,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": false
690
+ },
691
+ "50338": {
692
+ "content": "[unused53]",
693
+ "lstrip": false,
694
+ "normalized": true,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": false
698
+ },
699
+ "50339": {
700
+ "content": "[unused54]",
701
+ "lstrip": false,
702
+ "normalized": true,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": false
706
+ },
707
+ "50340": {
708
+ "content": "[unused55]",
709
+ "lstrip": false,
710
+ "normalized": true,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": false
714
+ },
715
+ "50341": {
716
+ "content": "[unused56]",
717
+ "lstrip": false,
718
+ "normalized": true,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": false
722
+ },
723
+ "50342": {
724
+ "content": "[unused57]",
725
+ "lstrip": false,
726
+ "normalized": true,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": false
730
+ },
731
+ "50343": {
732
+ "content": "[unused58]",
733
+ "lstrip": false,
734
+ "normalized": true,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": false
738
+ },
739
+ "50344": {
740
+ "content": "[unused59]",
741
+ "lstrip": false,
742
+ "normalized": true,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": false
746
+ },
747
+ "50345": {
748
+ "content": "[unused60]",
749
+ "lstrip": false,
750
+ "normalized": true,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": false
754
+ },
755
+ "50346": {
756
+ "content": "[unused61]",
757
+ "lstrip": false,
758
+ "normalized": true,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": false
762
+ },
763
+ "50347": {
764
+ "content": "[unused62]",
765
+ "lstrip": false,
766
+ "normalized": true,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": false
770
+ },
771
+ "50348": {
772
+ "content": "[unused63]",
773
+ "lstrip": false,
774
+ "normalized": true,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": false
778
+ },
779
+ "50349": {
780
+ "content": "[unused64]",
781
+ "lstrip": false,
782
+ "normalized": true,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": false
786
+ },
787
+ "50350": {
788
+ "content": "[unused65]",
789
+ "lstrip": false,
790
+ "normalized": true,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": false
794
+ },
795
+ "50351": {
796
+ "content": "[unused66]",
797
+ "lstrip": false,
798
+ "normalized": true,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": false
802
+ },
803
+ "50352": {
804
+ "content": "[unused67]",
805
+ "lstrip": false,
806
+ "normalized": true,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": false
810
+ },
811
+ "50353": {
812
+ "content": "[unused68]",
813
+ "lstrip": false,
814
+ "normalized": true,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": false
818
+ },
819
+ "50354": {
820
+ "content": "[unused69]",
821
+ "lstrip": false,
822
+ "normalized": true,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": false
826
+ },
827
+ "50355": {
828
+ "content": "[unused70]",
829
+ "lstrip": false,
830
+ "normalized": true,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": false
834
+ },
835
+ "50356": {
836
+ "content": "[unused71]",
837
+ "lstrip": false,
838
+ "normalized": true,
839
+ "rstrip": false,
840
+ "single_word": false,
841
+ "special": false
842
+ },
843
+ "50357": {
844
+ "content": "[unused72]",
845
+ "lstrip": false,
846
+ "normalized": true,
847
+ "rstrip": false,
848
+ "single_word": false,
849
+ "special": false
850
+ },
851
+ "50358": {
852
+ "content": "[unused73]",
853
+ "lstrip": false,
854
+ "normalized": true,
855
+ "rstrip": false,
856
+ "single_word": false,
857
+ "special": false
858
+ },
859
+ "50359": {
860
+ "content": "[unused74]",
861
+ "lstrip": false,
862
+ "normalized": true,
863
+ "rstrip": false,
864
+ "single_word": false,
865
+ "special": false
866
+ },
867
+ "50360": {
868
+ "content": "[unused75]",
869
+ "lstrip": false,
870
+ "normalized": true,
871
+ "rstrip": false,
872
+ "single_word": false,
873
+ "special": false
874
+ },
875
+ "50361": {
876
+ "content": "[unused76]",
877
+ "lstrip": false,
878
+ "normalized": true,
879
+ "rstrip": false,
880
+ "single_word": false,
881
+ "special": false
882
+ },
883
+ "50362": {
884
+ "content": "[unused77]",
885
+ "lstrip": false,
886
+ "normalized": true,
887
+ "rstrip": false,
888
+ "single_word": false,
889
+ "special": false
890
+ },
891
+ "50363": {
892
+ "content": "[unused78]",
893
+ "lstrip": false,
894
+ "normalized": true,
895
+ "rstrip": false,
896
+ "single_word": false,
897
+ "special": false
898
+ },
899
+ "50364": {
900
+ "content": "[unused79]",
901
+ "lstrip": false,
902
+ "normalized": true,
903
+ "rstrip": false,
904
+ "single_word": false,
905
+ "special": false
906
+ },
907
+ "50365": {
908
+ "content": "[unused80]",
909
+ "lstrip": false,
910
+ "normalized": true,
911
+ "rstrip": false,
912
+ "single_word": false,
913
+ "special": false
914
+ },
915
+ "50366": {
916
+ "content": "[unused81]",
917
+ "lstrip": false,
918
+ "normalized": true,
919
+ "rstrip": false,
920
+ "single_word": false,
921
+ "special": false
922
+ },
923
+ "50367": {
924
+ "content": "[unused82]",
925
+ "lstrip": false,
926
+ "normalized": true,
927
+ "rstrip": false,
928
+ "single_word": false,
929
+ "special": false
930
+ }
931
+ },
932
+ "clean_up_tokenization_spaces": true,
933
+ "cls_token": "[CLS]",
934
+ "extra_special_tokens": {},
935
+ "mask_token": "[MASK]",
936
+ "model_input_names": [
937
+ "input_ids",
938
+ "attention_mask"
939
+ ],
940
+ "model_max_length": 8192,
941
+ "pad_token": "[PAD]",
942
+ "sep_token": "[SEP]",
943
+ "tokenizer_class": "PreTrainedTokenizerFast",
944
+ "unk_token": "[UNK]"
945
+ }