Disya kaupane commited on
Commit
fa02a35
·
0 Parent(s):

Duplicate from kaupane/Inko

Browse files

Co-authored-by: Wang Weiyi <kaupane@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
+ demo/showcase/bookshop.png filter=lfs diff=lfs merge=lfs -text
37
+ demo/showcase/garden.png filter=lfs diff=lfs merge=lfs -text
38
+ demo/showcase/harbor.png filter=lfs diff=lfs merge=lfs -text
39
+ demo/showcase/lemons.png filter=lfs diff=lfs merge=lfs -text
40
+ demo/showcase/misty-mountains.png filter=lfs diff=lfs merge=lfs -text
41
+ demo/showcase/portrait.png filter=lfs diff=lfs merge=lfs -text
42
+ assets/benchmark_overview.png filter=lfs diff=lfs merge=lfs -text
43
+ assets/hero1-banner.jpg filter=lfs diff=lfs merge=lfs -text
44
+ assets/hero2-banner.jpg filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - zh
5
+ pipeline_tag: text-to-image
6
+ tags:
7
+ - pytorch
8
+ - flow-matching
9
+ - art
10
+ datasets:
11
+ - kaupane/chinese-painting-collection
12
+ - kaupane/wikiart-captions
13
+ - kaupane/human-recaption
14
+ - kaupane/pexels-people-captions
15
+ - kaupane/relaion-art-recap-zh
16
+ - kaupane/vintage-photography-captions
17
+ - kaupane/z-image-turbo-gen
18
+ - kaupane/inko-rollout-25k
19
+ - opendiffusionai/cc12m-a_woman
20
+ - Spawning/PD12M
21
+ - sirus/inaturalist-2024-2.8k-claude-opus-5-recaptioned
22
+ - sirus/megalith-10m-5.5k-claude-opus-5-recaptioned
23
+ ---
24
+
25
+ <h1 align="center">Inko</h1>
26
+
27
+ <p align="center"><strong>A 0.5B text-to-image model for fine art, in English and Chinese.</strong></p>
28
+
29
+ <p align="center">
30
+ <a href="https://github.com/Mtrya/inko">GitHub &amp; technical report</a> ·
31
+ <a href="https://huggingface.co/spaces/kaupane/Inko">Try the demo</a>
32
+ </p>
33
+
34
+ Inko is a text-to-image model trained for painting and illustration across Chinese and Western traditions. Its 532M-parameter flow-matching transformer pairs a curated four-domain art corpus with caption and resolution curricula, chunked Muon optimization on Ascend, and DiffusionART post-training against a self-produced prompt and rubric pool. The full engineering record — data, pretraining, post-training and evaluation — is in the [GitHub repository](https://github.com/Mtrya/inko).
35
+
36
+ **Release model: the EMA of the specialized post-training run** (60 DiffusionART rounds on the completed 300-round main run), built on the 600k pretrained EMA. The pretrained base remains available at tag [`pretrain-base`](https://huggingface.co/kaupane/Inko/tree/pretrain-base).
37
+
38
+ ## Gallery
39
+
40
+ ![Inko generations: ink-wash landscape and figure, gongbi bird and peony on silk, blue-green landscape with palace, hanfu in an Impressionist garden, a classical garden, dim sum and a lantern-lit canal](assets/hero1-banner.jpg)
41
+
42
+ ![Inko generations: Monet, Renoir, Pissarro, Van Gogh, an Art Nouveau portrait, Fauvist harbor, Symbolist garden, Baroque pomegranates and a red fox in snow](assets/hero2-banner.jpg)
43
+
44
+ All images are generated by the release model at 20 Euler steps and CFG 4.5. Prompts, seeds and canvas sizes are in the manifests ([hero1](https://github.com/Mtrya/inko/blob/main/notes/assets/gallery/hero1/manifest.jsonl), [hero2](https://github.com/Mtrya/inko/blob/main/notes/assets/gallery/hero2/manifest.jsonl)).
45
+
46
+ ## Results
47
+
48
+ ![Full-catalog results on GenEval, DPG, OneIG alignment, TIIF long and Qwen-Image. The seven references are ranked within each panel. Inko base and Inko are separated on the right, and a dashed line marks Inko's score across the references.](assets/benchmark_overview.png)
49
+
50
+ The chart compares nine models on five public benchmarks (GenEval, DPG, OneIG English, TIIF testmini and Qwen-Image-Bench), each run under its native inference recipe: Inko, the pretrained Inko base, and seven external references. Inko competes directly with the similarly sized DreamLite, SANA-0.6B and PixArt-Σ, and approaches the much larger SD3.5 Medium on DPG, OneIG alignment and Qwen-Image-Bench. Dense prompt alignment is its strongest general result, and its diversity is high relative to models with comparable alignment. Protocol, full tables, per-benchmark analysis and a fine-art comparison suite: [the evaluation chapter](https://github.com/Mtrya/inko/blob/main/notes/evaluation.md).
51
+
52
+ ## Quickstart
53
+
54
+ ```bash
55
+ git clone https://github.com/Mtrya/inko
56
+ cd inko
57
+ pip install -e .
58
+ ```
59
+
60
+ ```python
61
+ import torch
62
+ from src.pipeline import InkoPipeline
63
+
64
+ pipe = InkoPipeline.from_pretrained(
65
+ "kaupane/Inko", torch_dtype=torch.bfloat16
66
+ ).to("cuda")
67
+
68
+ image = pipe(
69
+ "中国水墨画,远山笼罩在薄雾中,近处一棵松树伸向江面,一叶小舟停在岸边。",
70
+ width=1920,
71
+ height=1088,
72
+ generator=torch.Generator(device="cpu").manual_seed(42),
73
+ ).images[0]
74
+ image.save("inko.png")
75
+ ```
76
+
77
+ The release defaults are 896 × 896, 20 Euler steps, and CFG 4.5. Width and height must be multiples of 16, up to 1920 per axis; above the 1184-pixel training reference, Dy-YaRN scaling applies automatically. Use Python 3.12 and a CUDA GPU.
78
+
79
+ ## Model at a glance
80
+
81
+ | Dimension | Choice |
82
+ |---|---|
83
+ | Model | Hidden width 1152, 16 heads, 1 double-stream + 24 single-stream blocks, FFN width 3072, 532,496,992 parameters |
84
+ | Text | Frozen Qwen3-0.6B, encoded online with an early exit after layer 20 |
85
+ | Latents | Qwen-Image VAE, 16 channels, factor 8; 2×2 latent patches |
86
+ | Objective | Rectified flow with logit-normal timestep sampling and resolution time shift |
87
+ | Resolution | Variable-aspect 256p → 640p → 896p; 75:20:5 split of 600,000 optimizer updates |
88
+ | Post-training | DiffusionART with attention LoRA (rank 64), Muon 1e-3, EMA 0.999; seven reward channels dominated by five rubric categories |
89
+ | Training hardware | Ascend (16×910B2C) for both pretraining and post-training |
90
+
91
+ ## Training journey
92
+
93
+ - [Data](https://github.com/Mtrya/inko/blob/main/notes/data.md): four domains (Chinese painting, Western art, people and anatomy, world knowledge), about 1.7M eligible rows at 256p, bilingual 50:50 captions, with per-dataset galleries and the curation story of each source.
94
+ - [Pretraining](https://github.com/Mtrya/inko/blob/main/notes/pretraining.md): architecture under the 0.6B budget, packing and the measured CUDA/Ascend kernel work (+33.92% throughput), the loss-spike investigation, and the full-run stability record.
95
+ - [Post-training](https://github.com/Mtrya/inko/blob/main/notes/posttraining.md): the DiffusionART selection campaign, the 24.6k-row rollout pool ([kaupane/inko-rollout-25k](https://huggingface.co/datasets/kaupane/inko-rollout-25k)), the rubric reward, and the two production runs.
96
+ - [Evaluation](https://github.com/Mtrya/inko/blob/main/notes/evaluation.md): five benchmark catalogs, nine models, and a fixed fine-art comparison suite with per-case analysis.
97
+
98
+ ## Limitations
99
+
100
+ - Exact rendered text and spatial relations remain weak.
101
+ - Anatomy still breaks at times; reasoning, counting and world knowledge remain weak.
102
+ - Negation in dense scenes is unreliable: asked for a busy intersection with no blue cars, Inko, like most references, paints the cars.
103
+ - The corpus includes research-only sources; per-sample license metadata is preserved in the training configuration.
assets/benchmark_overview.png ADDED

Git LFS Details

  • SHA256: 9206fb66d2545ccc7dca0d75650f67121fa23a5ce1e2697de2cb1b21d2e7006d
  • Pointer size: 131 Bytes
  • Size of remote file: 295 kB
assets/hero1-banner.jpg ADDED

Git LFS Details

  • SHA256: d2fd59e2ac4afbed9164368c7c3f968c88abdaff8e62df58bbaab01f3fdc97cb
  • Pointer size: 131 Bytes
  • Size of remote file: 502 kB
assets/hero2-banner.jpg ADDED

Git LFS Details

  • SHA256: 5dd20b11a273c81a633c7a416c9e2cfadf0e9180f38467963ec6827067577317
  • Pointer size: 131 Bytes
  • Size of remote file: 506 kB
demo/showcase/bookshop.png ADDED

Git LFS Details

  • SHA256: d9ff090312737bc27eb11b6a9c08d31f77336556f6cdb44ec415f05410b0538d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.16 MB
demo/showcase/garden.png ADDED

Git LFS Details

  • SHA256: 7f3b2c415eae8ee74abddedadb28c625d4c6ea85a808d93fbef188559492066d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.31 MB
demo/showcase/harbor.png ADDED

Git LFS Details

  • SHA256: e17347dea8ad5195ec10de67ed7bd067364c8d46820d4cd908a3e628a5d7fdf7
  • Pointer size: 132 Bytes
  • Size of remote file: 1.17 MB
demo/showcase/lemons.png ADDED

Git LFS Details

  • SHA256: ec39fe81390a82b51f8fc51f9ca0f8c4a77fc709197c7446fc60df277107fe75
  • Pointer size: 132 Bytes
  • Size of remote file: 1.33 MB
demo/showcase/misty-mountains.png ADDED

Git LFS Details

  • SHA256: d38404af5ba937663f32bb59ba1c5f07d8e1f89d283d868bf53ed07a74c23384
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
demo/showcase/portrait.png ADDED

Git LFS Details

  • SHA256: 437a0fbe97f9ef756426e9ccfb757adbd3b5a22c2846bfe3e18baccc6b90a119
  • Pointer size: 132 Bytes
  • Size of remote file: 1.12 MB
demo/showcase/prompts.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "height": 896,
3
+ "width": 896,
4
+ "num_inference_steps": 20,
5
+ "guidance_scale": 1.0,
6
+ "examples": [
7
+ {
8
+ "name": "misty-mountains",
9
+ "title": "Misty mountains · 水墨山水",
10
+ "prompt": "中国传统水墨山水画,淡墨晕染的层峦叠嶂在晨雾中渐渐远去。画面左下角一株苍劲的松树生长在岩石上,弯曲的树干伸向江面;江上有一叶小舟,舟中一位戴斗笠的渔翁。右侧和上方留有大片空白,远处的山峰只用几笔淡灰色墨痕勾勒。宣纸细腻的纤维质感,干湿浓淡相间的笔触,静谧悠远的意境,简洁而富有层次的构图。",
11
+ "seed": 42
12
+ },
13
+ {
14
+ "name": "harbor",
15
+ "title": "Harbor at dawn · 晨光港湾",
16
+ "prompt": "A luminous watercolor painting of a small Mediterranean fishing harbor at dawn. Three wooden fishing boats rest on pale turquoise water in the foreground, their reflections broken into loose washes of blue and rose. Cream and ochre houses with terracotta roofs climb a gentle hill behind the quay. The sky glows softly with peach and pale lavender light. Delicate pencil lines show through transparent pigments, with wet-on-wet edges, visible cold-pressed paper texture, and generous areas of light. The composition feels quiet, airy, and inviting.",
17
+ "seed": 7
18
+ },
19
+ {
20
+ "name": "garden",
21
+ "title": "Spring garden · 春日庭院",
22
+ "prompt": "一幅清新明亮的水彩画,春日江南庭院,一扇圆形月洞门通向安静的花园。门边一株粉色桃花正在盛开,细小的花瓣散落在青石小径上。白墙与深灰色瓦檐被柔和的阳光照亮,小径尽头有一张木椅,旁边摆着蓝白瓷花盆。透明的水彩颜料自然晕染,浅绿色、粉红色与温暖的米白色相互映衬,画纸纹理清晰可见,构图通透,气氛宁静而温柔。",
23
+ "seed": 73
24
+ },
25
+ {
26
+ "name": "bookshop",
27
+ "title": "The evening bookshop",
28
+ "prompt": "A cozy gouache illustration of a tiny bookshop on a narrow cobblestone street at dusk. Warm amber light spills from a large arched display window filled with colorful books and a small potted fern. A sleeping ginger cat curls up on the doorstep under a dark green awning. The wet cobblestones reflect the glowing window, while the surrounding buildings fade into muted blue and mauve shadows. Hand-painted shapes, soft opaque colors, gentle paper texture, and small thoughtful details create the feeling of a welcoming storybook scene.",
29
+ "seed": 31
30
+ },
31
+ {
32
+ "name": "portrait",
33
+ "title": "A quiet portrait",
34
+ "prompt": "A painterly oil portrait of a young woman in a simple ivory blouse, shown from the shoulders up in three-quarter view. Her dark brown hair is loosely gathered at the back of her head, with a few strands framing her face. She looks calmly toward a window just outside the frame. Soft natural light falls on one cheek and catches the warm brown of her eyes. The background is a muted terracotta and olive wash. Natural facial proportions, subtle skin tones, visible expressive brushwork, and a restrained earthy palette, like an intimate study painted from life.",
35
+ "seed": 57
36
+ },
37
+ {
38
+ "name": "lemons",
39
+ "title": "Lemons in afternoon light",
40
+ "prompt": "An intimate oil painting of a still life on a rustic wooden table. A deep cobalt-blue ceramic jug stands beside a shallow white bowl filled with ripe yellow lemons, with one cut lemon and a small leafy branch resting on a folded linen cloth. Warm afternoon sunlight enters from the left, casting soft long shadows across the table. The background is a muted sage-green wall. Thick, confident brushstrokes and subtle impasto give the lemons and pottery a tactile surface. A balanced, simple composition with rich blue and yellow color contrasts.",
41
+ "seed": 23
42
+ }
43
+ ]
44
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6714b15d0d5d234849a57ed04c6261f11935ceaabf555392138fb2f0fb508894
3
+ size 2148460368
pipeline_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "text_encoder": "Qwen/Qwen3-0.6B",
3
+ "vae": "REPA-E/e2e-qwenimage-vae",
4
+ "text_exit_layer": 20,
5
+ "height": 896,
6
+ "width": 896,
7
+ "num_inference_steps": 20,
8
+ "guidance_scale": 4.5
9
+ }
transformer_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "inko",
3
+ "hidden_size": 1152,
4
+ "num_heads": 16,
5
+ "double_stream_depth": 1,
6
+ "single_stream_depth": 24,
7
+ "mlp_ratio": 2.6666666666666665
8
+ }