AbstractPhil commited on
Commit
7fa9242
Β·
verified Β·
1 Parent(s): 6d9d7f8

Update README - Run 20251012_031919

Browse files
Files changed (1) hide show
  1. README.md +182 -0
README.md ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: mit
4
+ tags:
5
+ - image-classification
6
+ - imagenet
7
+ - multi-scale
8
+ - crystal-geometry
9
+ - david
10
+ datasets:
11
+ - imagenet-1k
12
+ metrics:
13
+ - accuracy
14
+ model-index:
15
+ - name: David-decoupled-deep_efficiency
16
+ results:
17
+ - task:
18
+ type: image-classification
19
+ dataset:
20
+ name: ImageNet-1K
21
+ type: imagenet-1k
22
+ metrics:
23
+ - type: accuracy
24
+ value: 71.75
25
+ ---
26
+
27
+ # David: Multi-Scale Crystal Classifier
28
+
29
+ **David** is a multi-scale deep learning classifier that uses crystal geometry (pentachora/4-simplexes)
30
+ as class prototypes with role-weighted similarity computation (Rose Loss).
31
+
32
+ ## Model Details
33
+
34
+ ### Architecture
35
+ - **Preset**: high_accuracy
36
+ - **Sharing Mode**: decoupled
37
+ - **Fusion Mode**: deep_efficiency
38
+ - **Scales**: [256, 512, 768, 1024, 1280]
39
+ - **Feature Dim**: 512
40
+ - **Parameters**: ~8.8M
41
+
42
+ ### Training Configuration
43
+ - **Dataset**: AbstractPhil/imagenet-clip-features-orderly
44
+ - **Model Variant**: clip_vit_b16
45
+ - **Epochs**: 20
46
+ - **Batch Size**: 1024
47
+ - **Learning Rate**: 0.01
48
+ - **Rose Loss Weight**: 0.1 β†’ 0.5
49
+ - **Cayley Loss**: False
50
+
51
+ ## Performance
52
+
53
+ ### Best Results
54
+ - **Validation Accuracy**: 71.75%
55
+ - **Best Epoch**: 0
56
+ - **Final Train Accuracy**: 66.63%
57
+
58
+ ### Per-Scale Performance
59
+ - **Scale 256**: 71.75%
60
+
61
+
62
+ ## Usage
63
+
64
+ ### Repository Structure
65
+
66
+ ```
67
+ AbstractPhil/gated-david/
68
+ β”œβ”€β”€ weights/
69
+ β”‚ β”œβ”€β”€ best_model.pth # Best model weights (PyTorch)
70
+ β”‚ β”œβ”€β”€ best_model.safetensors # Best model weights (SafeTensors)
71
+ β”‚ β”œβ”€β”€ best_model_metadata.json # Training metadata
72
+ β”‚ β”œβ”€β”€ final_model.pth # Final epoch weights
73
+ β”‚ β”œβ”€β”€ final_model.safetensors
74
+ β”‚ β”œβ”€β”€ david_config.json # Model architecture config
75
+ β”‚ └── train_config.json # Training configuration
76
+ β”œβ”€β”€ runs/
77
+ β”‚ └── events.out.tfevents.* # TensorBoard logs
78
+ β”œβ”€β”€ README.md # This file
79
+ └── best_model.json # Performance summary
80
+ ```
81
+
82
+ ### Loading the Model
83
+
84
+ ```python
85
+ from geovocab2.train.model.core.david import David, DavidArchitectureConfig
86
+ from huggingface_hub import hf_hub_download
87
+
88
+ # Download config
89
+ config_path = hf_hub_download(repo_id="AbstractPhil/gated-david",
90
+ filename="weights/david_config.json")
91
+ config = DavidArchitectureConfig.from_json(config_path)
92
+
93
+ # Download weights
94
+ weights_path = hf_hub_download(repo_id="AbstractPhil/gated-david",
95
+ filename="weights/best_model.pth")
96
+
97
+ # Initialize model
98
+ david = David.from_config(config)
99
+ checkpoint = torch.load(weights_path)
100
+ david.load_state_dict(checkpoint['model_state_dict'])
101
+ david.eval()
102
+ ```
103
+
104
+ ### Inference
105
+
106
+ ```python
107
+ import torch
108
+ import torch.nn.functional as F
109
+
110
+ # Assuming you have CLIP features (512-dim for ViT-B/16)
111
+ features = get_clip_features(image) # [1, 512]
112
+
113
+ # Load anchors
114
+ anchors_dict = torch.load("anchors.pth")
115
+
116
+ # Forward pass
117
+ with torch.no_grad():
118
+ logits, _ = david(features, anchors_dict)
119
+ predictions = logits.argmax(dim=-1)
120
+ ```
121
+
122
+ ## Architecture Overview
123
+
124
+ ### Multi-Scale Processing
125
+ David processes inputs at multiple scales (256, 512, 768, 1024, 1280),
126
+ allowing it to capture both coarse and fine-grained features.
127
+
128
+ ### Crystal Geometry
129
+ Each class is represented by a pentachoron (4-simplex) in embedding space with 5 vertices:
130
+ - **Anchor**: Primary class representative
131
+ - **Need**: Complementary direction
132
+ - **Relation**: Contextual alignment
133
+ - **Purpose**: Functional direction
134
+ - **Observer**: Meta-perspective
135
+
136
+ ### Rose Loss
137
+ Similarity computation uses role-weighted cosine similarities:
138
+ ```
139
+ score = w_anchor * sim(z, anchor) + w_need * sim(z, need) + ...
140
+ ```
141
+
142
+ ### Fusion Strategy
143
+ **deep_efficiency**: Intelligently combines predictions from multiple scales.
144
+
145
+ ## Training Details
146
+
147
+ ### Loss Components
148
+ - **Cross-Entropy**: Standard classification loss
149
+ - **Rose Loss**: Pentachora role-weighted margin loss (weight: 0.1β†’0.5)
150
+ - **Cayley Loss**: Geometric regularization (disabled)
151
+
152
+ ### Optimization
153
+ - **Optimizer**: AdamW
154
+ - **Weight Decay**: 1e-05
155
+ - **Scheduler**: cosine_restarts
156
+ - **Gradient Clip**: 5.0
157
+ - **Mixed Precision**: False
158
+
159
+ ## Citation
160
+
161
+ ```bibtex
162
+ @software{david_classifier_2025,
163
+ title = {David: Multi-Scale Crystal Classifier},
164
+ author = {AbstractPhil},
165
+ year = {2025},
166
+ url = {https://huggingface.co/AbstractPhil/gated-david},
167
+ note = {Run ID: 20251012_031919}
168
+ }
169
+ ```
170
+
171
+ ## License
172
+
173
+ MIT License
174
+
175
+ ## Acknowledgments
176
+
177
+ Built with crystal lattice geometry and multi-scale deep learning.
178
+ Special thanks to Claude (Anthropic) for debugging assistance.
179
+
180
+ ---
181
+
182
+ *Generated on 2025-10-12 03:21:13*