File size: 3,757 Bytes
648f1ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b299e7b
 
 
 
 
 
 
 
 
 
 
 
648f1ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b299e7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
648f1ca
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
license: mit
library_name: sd15-flow-trainer
tags:
  - geometric-deep-learning
  - stable-diffusion
  - ksimplex
  - pentachoron
  - flow-matching
  - cross-attention-prior
base_model: sd-legacy/stable-diffusion-v1-5
pipeline_tag: text-to-image
---

# KSimplex Geometric Attention Prior

Geometric cross-attention prior for SD1.5 using pentachoron (4-simplex) structures.

# Before and After

## Pretrain

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/TgjI7uFi0hlwR0SZ_L5Lg.png)
![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/9f1AsA8IQC04rCFUJqIEL.png)

## Final

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/6v44zbXNRmEqyGFClqDxx.png)
![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/CD1F_1RNkU4s1jAtx8Jl3.png)

## Architecture

| Component | Params |
|-----------|--------|
| SD1.5 UNet (frozen) | 859,520,964 |
| **Geo prior (trained)** | **4,845,725** |

The geometric prior modulates CLIP encoder hidden states through
4-layer stacked k-simplex attention before they reach
the 16 cross-attention blocks in the UNet.

## Simplex Configuration

| Parameter | Value |
|-----------|-------|
| k (simplex dim) | 4 |
| Embedding dim | 32 |
| Feature dim | 768 |
| Stacked layers | 4 |
| Attention heads | 8 |
| Base deformation | 0.25 |
| Residual blend | learnable |
| Timestep conditioned | True |

## Usage

```python
from sd15_trainer_geo.pipeline import load_pipeline, load_geo_from_hub

# Load base SD1.5 + fresh geo prior
pipe = load_pipeline()

# Load trained geo weights from this repo
load_geo_from_hub(pipe, "AbstractPhil/sd15-geoflow-characters")

# Or one-shot: load base + geo in one call
pipe = load_pipeline(geo_repo_id="AbstractPhil/sd15-geoflow-characters")
```

## Training Info

- **dataset**: AbstractPhil/synthetic-characters (schnell_simple_2)
- **samples**: 50000
- **epochs**: 1
- **steps**: 8333
- **shift**: 2.5
- **base_lr**: 5e-05
- **min_snr_gamma**: 5.0
- **cfg_dropout**: 0.1
- **batch_size**: 6
- **geo_loss_weight**: 0.01
- **loss_final**: 0.3177722838521004


# Assessment

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/Huyg1bNgCDRR849gsGej4.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/AqiP6uRJsETZPTo0hUbNy.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/0xulkeQ9-xeyQmECjVEC_.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/D2-inlMATNEMOqe-ofBpk.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/NiBxkekTSZ_Yu_ybUEymc.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/anM-EEgsnTJCefLyh5KWJ.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/9Dpar0p8Dz503yoEClRuB.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/cHwGnTsvjBTHnadUoiy1U.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/dMA5RiIHui1_QQ32qHqx2.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/X18f5tbwEJKRAtd5_9vLz.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/g2WWIwptvGGjikhQ4zx5Q.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/gkJZhlo1CRLRZS0yI2bDu.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/630cf55b15433862cfc9556f/UyOGpSD71MBaOyCv1c2oy.png)

## License

MIT — [AbstractPhil](https://huggingface.co/AbstractPhil)