AbstractPhil commited on
Commit
6f3163c
·
verified ·
1 Parent(s): c532321

Checkpoint epoch 10 - 30.86% acc

Browse files
README.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ license: apache-2.0
4
+ tags:
5
+ - vision
6
+ - image-classification
7
+ - geometric-deep-learning
8
+ - vit
9
+ - cantor-routing
10
+ - pentachoron
11
+ - multi-scale
12
+ datasets:
13
+ - cifar100
14
+ metrics:
15
+ - accuracy
16
+ model-index:
17
+ - name: DavidBeans
18
+ results:
19
+ - task:
20
+ type: image-classification
21
+ name: Image Classification
22
+ dataset:
23
+ name: CIFAR-100
24
+ type: cifar100
25
+ metrics:
26
+ - type: accuracy
27
+ value: 30.86
28
+ name: Top-1 Accuracy
29
+ ---
30
+
31
+ # 🫘💎 DavidBeans: Unified Vision-to-Crystal Architecture
32
+
33
+ DavidBeans combines **ViT-Beans** (Cantor-routed sparse attention) with **David** (multi-scale crystal classification) into a unified geometric deep learning architecture.
34
+
35
+ ## Model Description
36
+
37
+ This model implements several novel techniques:
38
+
39
+ - **Hybrid Cantor Routing**: Combines fractal Cantor set distances with positional proximity for sparse attention patterns
40
+ - **Pentachoron Experts**: 5-vertex simplex structure with Cayley-Menger geometric regularization
41
+ - **Multi-Scale Crystal Projection**: Projects features to multiple representation scales with learned fusion
42
+ - **Cross-Contrastive Learning**: Aligns patch-level features with crystal anchors
43
+
44
+ ## Architecture
45
+
46
+ ```
47
+ Image [B, 3, 32, 32]
48
+
49
+
50
+ ┌─────────────────────────────────────────┐
51
+ │ BEANS BACKBONE │
52
+ │ ├─ Patch Embed → [64 patches, 512d]
53
+ │ ├─ Hybrid Cantor Router (α=0.3)
54
+ │ ├─ 4 × Attention Blocks (16 heads)
55
+ │ └─ 4 × Pentachoron Expert Layers
56
+ └─────────────────────────────────────────┘
57
+
58
+
59
+ ┌─────────────────────────────────────────┐
60
+ │ DAVID HEAD │
61
+ │ ├─ Multi-scale projection: [256, 384, 512, 640, 768]
62
+ │ ├─ Per-scale Crystal Heads
63
+ │ └─ Geometric Fusion (learned weights)
64
+ └─────────────────────────────────────────┘
65
+
66
+
67
+ [100 classes]
68
+ ```
69
+
70
+ ## Training Details
71
+
72
+ | Parameter | Value |
73
+ |-----------|-------|
74
+ | Dataset | CIFAR-100 |
75
+ | Classes | 100 |
76
+ | Image Size | 32×32 |
77
+ | Patch Size | 4×4 |
78
+ | Embedding Dim | 512 |
79
+ | Layers | 4 |
80
+ | Attention Heads | 16 |
81
+ | Experts | 5 (pentachoron) |
82
+ | Sparse Neighbors | k=32 |
83
+ | Scales | [256, 384, 512, 640, 768] |
84
+ | Epochs | 200 |
85
+ | Batch Size | 128 |
86
+ | Learning Rate | 0.0005 |
87
+ | Weight Decay | 0.1 |
88
+ | Mixup α | 0.3 |
89
+ | CutMix α | 1.0 |
90
+ | Label Smoothing | 0.1 |
91
+
92
+ ## Results
93
+
94
+ | Metric | Value |
95
+ |--------|-------|
96
+ | **Top-1 Accuracy** | **30.86%** |
97
+
98
+ ## TensorBoard Logs
99
+
100
+ Training logs are included in the `tensorboard/` directory. To view:
101
+
102
+ ```bash
103
+ tensorboard --logdir tensorboard/
104
+ ```
105
+
106
+ ## Usage
107
+
108
+ ```python
109
+ import torch
110
+ from safetensors.torch import load_file
111
+ from david_beans import DavidBeans, DavidBeansConfig
112
+
113
+ # Load config
114
+ config = DavidBeansConfig(
115
+ image_size=32,
116
+ patch_size=4,
117
+ dim=512,
118
+ num_layers=4,
119
+ num_heads=16,
120
+ num_experts=5,
121
+ k_neighbors=32,
122
+ cantor_weight=0.3,
123
+ scales=[256, 384, 512, 640, 768],
124
+ num_classes=100
125
+ )
126
+
127
+ # Create model and load weights
128
+ model = DavidBeans(config)
129
+ state_dict = load_file("model.safetensors")
130
+ model.load_state_dict(state_dict)
131
+
132
+ # Inference
133
+ model.eval()
134
+ with torch.no_grad():
135
+ output = model(images)
136
+ predictions = output['logits'].argmax(dim=-1)
137
+ ```
138
+
139
+ ## Citation
140
+
141
+ ```bibtex
142
+ @misc{davidbeans2025,
143
+ author = {AbstractPhil},
144
+ title = {DavidBeans: Unified Vision-to-Crystal Architecture},
145
+ year = {2025},
146
+ publisher = {HuggingFace},
147
+ url = {https://huggingface.co/AbstractPhil/geovit-david-beans}
148
+ }
149
+ ```
150
+
151
+ ## License
152
+
153
+ Apache 2.0
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "DavidBeans",
3
+ "model_type": "david_beans",
4
+ "image_size": 32,
5
+ "patch_size": 4,
6
+ "in_channels": 3,
7
+ "dim": 512,
8
+ "num_layers": 4,
9
+ "num_heads": 16,
10
+ "num_experts": 5,
11
+ "k_neighbors": 32,
12
+ "cantor_weight": 0.3,
13
+ "mlp_ratio": 4.0,
14
+ "scales": [
15
+ 256,
16
+ 384,
17
+ 512,
18
+ 640,
19
+ 768
20
+ ],
21
+ "num_classes": 100,
22
+ "use_belly": true,
23
+ "belly_expand": 2.0,
24
+ "contrast_temperature": 0.07,
25
+ "contrast_weight": 0.5,
26
+ "cayley_weight": 0.01,
27
+ "volume_floor": 0.0001,
28
+ "dropout": 0.15,
29
+ "pooling": "cls"
30
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9289e3b29f245c20d06db0ca2540cebe3e00994b885667ded9be9c184864a051
3
+ size 75434940
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a8f26949e19b83369f733a0e95895a131ee7759ef55baeba8ae21cd4b9ba98e
3
+ size 75464207
tensorboard/events.out.tfevents.1764436353.86289bf9c07c.408448.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8dbcd87978d749ce5a74554a36e4f4828130ea2e43cee84e17e84e2f3e87ef30
3
+ size 47755
training_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "run_name": "5expert_5scale",
3
+ "run_number": null,
4
+ "dataset": "cifar100",
5
+ "image_size": 32,
6
+ "batch_size": 128,
7
+ "num_workers": 4,
8
+ "epochs": 200,
9
+ "warmup_epochs": 20,
10
+ "learning_rate": 0.0005,
11
+ "weight_decay": 0.1,
12
+ "betas": [
13
+ 0.9,
14
+ 0.999
15
+ ],
16
+ "scheduler": "cosine",
17
+ "min_lr": 1e-06,
18
+ "ce_weight": 1.0,
19
+ "cayley_weight": 0.01,
20
+ "contrast_weight": 0.5,
21
+ "scale_ce_weight": 0.1,
22
+ "gradient_clip": 1.0,
23
+ "label_smoothing": 0.1,
24
+ "use_augmentation": true,
25
+ "mixup_alpha": 0.3,
26
+ "cutmix_alpha": 1.0,
27
+ "save_interval": 10,
28
+ "output_dir": "./checkpoints/cifar100",
29
+ "resume_from": null,
30
+ "use_tensorboard": true,
31
+ "log_interval": 50,
32
+ "push_to_hub": true,
33
+ "hub_repo_id": "AbstractPhil/geovit-david-beans",
34
+ "hub_private": false,
35
+ "hub_append_run": true,
36
+ "device": "cuda"
37
+ }
training_history.json ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "loss": [
3
+ 9.14811771343916,
4
+ 8.643415237084414,
5
+ 8.412463459601769,
6
+ 8.140621100939237,
7
+ 7.911913275107359,
8
+ 7.716725044984084,
9
+ 7.681668006456816,
10
+ 7.530832956998776,
11
+ 7.425180815427732
12
+ ],
13
+ "ce": [
14
+ 4.456742456631782,
15
+ 4.246037974724403,
16
+ 4.117695839588459,
17
+ 3.994500890144935,
18
+ 3.877463692273849,
19
+ 3.7859254867602616,
20
+ 3.7558192497644667,
21
+ 3.655832992455898,
22
+ 3.6306867299935757
23
+ ],
24
+ "geo": [
25
+ 0.003279420401593551,
26
+ 0.00022009814308078673,
27
+ 0.00026651134823437014,
28
+ 0.00033277957815862,
29
+ 0.0003850076214010374,
30
+ 0.0004454412114006491,
31
+ 0.0005292222191854261,
32
+ 0.0005809825301044979,
33
+ 0.0006250078629445619
34
+ ],
35
+ "contrast": [
36
+ 4.855305493183625,
37
+ 4.490192336302537,
38
+ 4.363886697475727,
39
+ 4.2106811761856076,
40
+ 4.097067264410166,
41
+ 3.9898384222617516,
42
+ 3.977252336648794,
43
+ 3.9234435209861167,
44
+ 3.84050482297555
45
+ ],
46
+ "expert_vol": [
47
+ 9.612834081706704e-06,
48
+ 9.694315777335596e-06,
49
+ 9.655668553676104e-06,
50
+ 9.613265119230327e-06,
51
+ 9.574969063135377e-06,
52
+ 9.548803586184452e-06,
53
+ 9.560007872959175e-06,
54
+ 9.609137787964964e-06,
55
+ 9.700101159418968e-06
56
+ ],
57
+ "expert_collapse": [
58
+ 9.03871649568781e-05,
59
+ 9.030568329856181e-05,
60
+ 9.034433044293202e-05,
61
+ 9.038673395899913e-05,
62
+ 9.042502984252328e-05,
63
+ 9.045119536145089e-05,
64
+ 9.043999131954012e-05,
65
+ 9.03908609567831e-05,
66
+ 9.029989781153676e-05
67
+ ],
68
+ "expert_edge": [
69
+ 0.00637806647577329,
70
+ 0.0002595849193778868,
71
+ 0.00035233403524706286,
72
+ 0.0004847856876903023,
73
+ 0.000589165182184213,
74
+ 0.0007099800328992737,
75
+ 0.0008775644565526492,
76
+ 0.0009811833403849354,
77
+ 0.0010694159361987541
78
+ ],
79
+ "lr": [
80
+ 2.5e-05,
81
+ 5e-05,
82
+ 7.500000000000001e-05,
83
+ 0.0001,
84
+ 0.000125,
85
+ 0.00015000000000000001,
86
+ 0.00017500000000000003,
87
+ 0.0002,
88
+ 0.00022500000000000002
89
+ ]
90
+ }