AbstractPhil commited on
Commit
89458a5
Β·
verified Β·
1 Parent(s): 172bea9

Update README - Run 20251104_122236

Browse files
Files changed (1) hide show
  1. README.md +53 -63
README.md CHANGED
@@ -5,14 +5,14 @@ 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-partial_shared-deep_efficiency
16
  results:
17
  - task:
18
  type: image-classification
@@ -21,28 +21,28 @@ model-index:
21
  type: imagenet-1k
22
  metrics:
23
  - type: accuracy
24
- value: 84.73
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**: clip_vit_bigg14
36
  - **Sharing Mode**: partial_shared
37
- - **Fusion Mode**: deep_efficiency
38
- - **Scales**: [384, 512, 768, 1024, 1280, 1536, 1792, 2048]
39
- - **Feature Dim**: 1280
40
- - **Parameters**: 60,814,373
41
 
42
  ### Training Configuration
43
  - **Dataset**: AbstractPhil/imagenet-clip-features-orderly
44
- - **Model Variant**: clip_vit_laion_bigg14
45
- - **Epochs**: 10
46
  - **Batch Size**: 1024
47
  - **Learning Rate**: 0.001
48
  - **Rose Loss Weight**: 0.1 β†’ 0.5
@@ -51,19 +51,15 @@ as class prototypes with role-weighted similarity computation (Rose Loss).
51
  ## Performance
52
 
53
  ### Best Results
54
- - **Validation Accuracy**: 84.73%
55
- - **Best Epoch**: 2
56
- - **Final Train Accuracy**: 96.34%
57
 
58
  ### Per-Scale Performance
59
- - **Scale 384**: 84.39%
60
- - **Scale 512**: 84.67%
61
- - **Scale 768**: 84.52%
62
- - **Scale 1024**: 84.71%
63
- - **Scale 1280**: 84.73%
64
- - **Scale 1536**: 84.57%
65
- - **Scale 1792**: 84.58%
66
- - **Scale 2048**: 84.59%
67
 
68
 
69
  ## Usage
@@ -80,43 +76,24 @@ AbstractPhil/gated-david/
80
  β”œβ”€β”€ README.md # This file
81
  β”œβ”€β”€ best_model.json # Latest best model info
82
  β”œβ”€β”€ weights/
83
- β”‚ └── david_clip_vit_bigg14/
84
- β”‚ └── 20251012_181608/
85
  β”‚ β”œβ”€β”€ MODEL_SUMMARY.txt # 🎯 Human-readable performance summary
86
  β”‚ β”œβ”€β”€ training_history.json # πŸ“ˆ Epoch-by-epoch training curve
87
- β”‚ β”œβ”€β”€ best_model_acc84.73.safetensors # ⭐ Accuracy in filename!
88
- β”‚ β”œβ”€β”€ best_model_acc84.73_metadata.json
89
  β”‚ β”œβ”€β”€ final_model.safetensors
90
  β”‚ β”œβ”€β”€ checkpoint_epoch_X_accYY.YY.safetensors
91
  β”‚ β”œβ”€β”€ david_config.json
92
  β”‚ └── train_config.json
93
  └── runs/
94
- └── david_clip_vit_bigg14/
95
- └── 20251012_181608/
96
  └── events.out.tfevents.* # TensorBoard logs
97
  ```
98
 
99
  ### Loading the Model
100
 
101
- The description below is terrible.
102
-
103
- Load a clip-vit and then load one of the pretrains. There is no anchors file nor any of that anymore.
104
-
105
- I don't know why this piece of the readme got preserved, but I'll need to fix it.
106
-
107
- 1. Install the repo in your environment
108
-
109
- ```python
110
- try:
111
- !pip uninstall -qy geometricvocab
112
- except:
113
- pass
114
-
115
- !pip install -q git+https://github.com/AbstractEyes/lattice_vocabulary.git
116
- ```
117
-
118
- Find your target model, likely not all of this below will work currently.
119
-
120
  ```python
121
  from geovocab2.train.model.core.david import David, DavidArchitectureConfig
122
  from huggingface_hub import hf_hub_download
@@ -124,26 +101,26 @@ from huggingface_hub import hf_hub_download
124
  # Browse available models in MODELS_INDEX.json first!
125
 
126
  # Specify model variant and run
127
- model_name = "david_clip_vit_bigg14"
128
- run_id = "20251012_181608"
129
- accuracy = "84.73" # From MODELS_INDEX.json
130
 
131
  # Download config
132
  config_path = hf_hub_download(
133
- repo_id="AbstractPhil/gated-david",
134
  filename=f"weights/{model_name}/{run_id}/david_config.json"
135
  )
136
  config = DavidArchitectureConfig.from_json(config_path)
137
 
138
  # Download weights (accuracy in filename!)
139
  weights_path = hf_hub_download(
140
- repo_id="AbstractPhil/gated-david",
141
  filename=f"weights/{model_name}/{run_id}/best_model_acc{accuracy}.safetensors"
142
  )
143
 
144
  # Download training history (optional - see full training curve)
145
  history_path = hf_hub_download(
146
- repo_id="AbstractPhil/gated-david",
147
  filename=f"weights/{model_name}/{run_id}/training_history.json"
148
  )
149
 
@@ -154,18 +131,31 @@ david.load_state_dict(load_file(weights_path))
154
  david.eval()
155
  ```
156
 
157
- 3. When in eval mode pass the output from clip-vit's feature into david. The feature does not require the token nor the label, simply pass the feature in and assess the outputs.
 
 
 
 
 
 
 
158
 
159
- I'll need to ensure this process is perfected later, so the trainings can actually be utilized.
 
160
 
 
 
 
 
 
161
 
162
  ## Architecture Overview
163
 
164
  ### Multi-Scale Processing
165
- David processes inputs at multiple scales (384, 512, 768, 1024, 1280, 1536, 1792, 2048),
166
  allowing it to capture both coarse and fine-grained features.
167
 
168
- ### Crystal Geometry
169
  Each class is represented by a pentachoron (4-simplex) in embedding space with 5 vertices:
170
  - **Anchor**: Primary class representative
171
  - **Need**: Complementary direction
@@ -180,7 +170,7 @@ score = w_anchor * sim(z, anchor) + w_need * sim(z, need) + ...
180
  ```
181
 
182
  ### Fusion Strategy
183
- **deep_efficiency**: Intelligently combines predictions from multiple scales.
184
 
185
  ## Training Details
186
 
@@ -200,11 +190,11 @@ score = w_anchor * sim(z, anchor) + w_need * sim(z, need) + ...
200
 
201
  ```bibtex
202
  @software{david_classifier_2025,
203
- title = {David: Multi-Scale Crystal Classifier},
204
  author = {AbstractPhil},
205
  year = {2025},
206
  url = {https://huggingface.co/AbstractPhil/gated-david},
207
- note = {Run ID: 20251012_181608}
208
  }
209
  ```
210
 
@@ -214,9 +204,9 @@ MIT License
214
 
215
  ## Acknowledgments
216
 
217
- Built with crystal lattice geometry and multi-scale deep learning.
218
  Special thanks to Claude (Anthropic) for debugging assistance.
219
 
220
  ---
221
 
222
- *Generated on 2025-10-12 18:49:29*
 
5
  - image-classification
6
  - imagenet
7
  - multi-scale
8
+ - feature-geometry
9
  - david
10
  datasets:
11
  - imagenet-1k
12
  metrics:
13
  - accuracy
14
  model-index:
15
+ - name: David-partial_shared-geometric_attention
16
  results:
17
  - task:
18
  type: image-classification
 
21
  type: imagenet-1k
22
  metrics:
23
  - type: accuracy
24
+ value: 76.11
25
  ---
26
 
27
+ # David: Multi-Scale Feature Classifier
28
 
29
+ **David** is a multi-scale deep learning classifier that uses feature geometry (pentachora/4-simplexes)
30
  as class prototypes with role-weighted similarity computation (Rose Loss).
31
 
32
  ## Model Details
33
 
34
  ### Architecture
35
+ - **Preset**: clip_vit_b16_geometric
36
  - **Sharing Mode**: partial_shared
37
+ - **Fusion Mode**: geometric_attention
38
+ - **Scales**: [256, 512, 768, 1024]
39
+ - **Feature Dim**: 512
40
+ - **Parameters**: 12,599,556
41
 
42
  ### Training Configuration
43
  - **Dataset**: AbstractPhil/imagenet-clip-features-orderly
44
+ - **Model Variant**: clip_vit_b16
45
+ - **Epochs**: 5
46
  - **Batch Size**: 1024
47
  - **Learning Rate**: 0.001
48
  - **Rose Loss Weight**: 0.1 β†’ 0.5
 
51
  ## Performance
52
 
53
  ### Best Results
54
+ - **Validation Accuracy**: 76.11%
55
+ - **Best Epoch**: 0
56
+ - **Final Train Accuracy**: 71.75%
57
 
58
  ### Per-Scale Performance
59
+ - **Scale 256**: 74.25%
60
+ - **Scale 512**: 75.16%
61
+ - **Scale 768**: 75.26%
62
+ - **Scale 1024**: 75.82%
 
 
 
 
63
 
64
 
65
  ## Usage
 
76
  β”œβ”€β”€ README.md # This file
77
  β”œβ”€β”€ best_model.json # Latest best model info
78
  β”œβ”€β”€ weights/
79
+ β”‚ └── david_clip_vit_b16_geometric/
80
+ β”‚ └── 20251104_122236/
81
  β”‚ β”œβ”€β”€ MODEL_SUMMARY.txt # 🎯 Human-readable performance summary
82
  β”‚ β”œβ”€β”€ training_history.json # πŸ“ˆ Epoch-by-epoch training curve
83
+ β”‚ β”œβ”€β”€ best_model_acc76.11.safetensors # ⭐ Accuracy in filename!
84
+ β”‚ β”œβ”€β”€ best_model_acc76.11_metadata.json
85
  β”‚ β”œβ”€β”€ final_model.safetensors
86
  β”‚ β”œβ”€β”€ checkpoint_epoch_X_accYY.YY.safetensors
87
  β”‚ β”œβ”€β”€ david_config.json
88
  β”‚ └── train_config.json
89
  └── runs/
90
+ └── david_clip_vit_b16_geometric/
91
+ └── 20251104_122236/
92
  └── events.out.tfevents.* # TensorBoard logs
93
  ```
94
 
95
  ### Loading the Model
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  ```python
98
  from geovocab2.train.model.core.david import David, DavidArchitectureConfig
99
  from huggingface_hub import hf_hub_download
 
101
  # Browse available models in MODELS_INDEX.json first!
102
 
103
  # Specify model variant and run
104
+ model_name = "david_clip_vit_b16_geometric"
105
+ run_id = "20251104_122236"
106
+ accuracy = "76.11" # From MODELS_INDEX.json
107
 
108
  # Download config
109
  config_path = hf_hub_download(
110
+ repo_id="AbstractPhil/gated-david",
111
  filename=f"weights/{model_name}/{run_id}/david_config.json"
112
  )
113
  config = DavidArchitectureConfig.from_json(config_path)
114
 
115
  # Download weights (accuracy in filename!)
116
  weights_path = hf_hub_download(
117
+ repo_id="AbstractPhil/gated-david",
118
  filename=f"weights/{model_name}/{run_id}/best_model_acc{accuracy}.safetensors"
119
  )
120
 
121
  # Download training history (optional - see full training curve)
122
  history_path = hf_hub_download(
123
+ repo_id="AbstractPhil/gated-david",
124
  filename=f"weights/{model_name}/{run_id}/training_history.json"
125
  )
126
 
 
131
  david.eval()
132
  ```
133
 
134
+ ### Inference
135
+
136
+ ```python
137
+ import torch
138
+ import torch.nn.functional as F
139
+
140
+ # Assuming you have CLIP features (512-dim for ViT-B/16)
141
+ features = get_clip_features(image) # [1, 512]
142
 
143
+ # Load anchors
144
+ anchors_dict = torch.load("anchors.pth")
145
 
146
+ # Forward pass
147
+ with torch.no_grad():
148
+ logits, _ = david(features, anchors_dict)
149
+ predictions = logits.argmax(dim=-1)
150
+ ```
151
 
152
  ## Architecture Overview
153
 
154
  ### Multi-Scale Processing
155
+ David processes inputs at multiple scales (256, 512, 768, 1024),
156
  allowing it to capture both coarse and fine-grained features.
157
 
158
+ ### Feature Geometry
159
  Each class is represented by a pentachoron (4-simplex) in embedding space with 5 vertices:
160
  - **Anchor**: Primary class representative
161
  - **Need**: Complementary direction
 
170
  ```
171
 
172
  ### Fusion Strategy
173
+ **geometric_attention**: Intelligently combines predictions from multiple scales.
174
 
175
  ## Training Details
176
 
 
190
 
191
  ```bibtex
192
  @software{david_classifier_2025,
193
+ title = {David: Multi-Scale Feature Classifier},
194
  author = {AbstractPhil},
195
  year = {2025},
196
  url = {https://huggingface.co/AbstractPhil/gated-david},
197
+ note = {Run ID: 20251104_122236}
198
  }
199
  ```
200
 
 
204
 
205
  ## Acknowledgments
206
 
207
+ Built with lattice geometry and multi-scale deep learning.
208
  Special thanks to Claude (Anthropic) for debugging assistance.
209
 
210
  ---
211
 
212
+ *Generated on 2025-11-04 12:24:29*