Update README - Run 20251104_122236
Browse files
README.md
CHANGED
|
@@ -5,14 +5,14 @@ tags:
|
|
| 5 |
- image-classification
|
| 6 |
- imagenet
|
| 7 |
- multi-scale
|
| 8 |
-
-
|
| 9 |
- david
|
| 10 |
datasets:
|
| 11 |
- imagenet-1k
|
| 12 |
metrics:
|
| 13 |
- accuracy
|
| 14 |
model-index:
|
| 15 |
-
- name: David-partial_shared-
|
| 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:
|
| 25 |
---
|
| 26 |
|
| 27 |
-
# David: Multi-Scale
|
| 28 |
|
| 29 |
-
**David** is a multi-scale deep learning classifier that uses
|
| 30 |
as class prototypes with role-weighted similarity computation (Rose Loss).
|
| 31 |
|
| 32 |
## Model Details
|
| 33 |
|
| 34 |
### Architecture
|
| 35 |
-
- **Preset**:
|
| 36 |
- **Sharing Mode**: partial_shared
|
| 37 |
-
- **Fusion Mode**:
|
| 38 |
-
- **Scales**: [
|
| 39 |
-
- **Feature Dim**:
|
| 40 |
-
- **Parameters**:
|
| 41 |
|
| 42 |
### Training Configuration
|
| 43 |
- **Dataset**: AbstractPhil/imagenet-clip-features-orderly
|
| 44 |
-
- **Model Variant**:
|
| 45 |
-
- **Epochs**:
|
| 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**:
|
| 55 |
-
- **Best Epoch**:
|
| 56 |
-
- **Final Train Accuracy**:
|
| 57 |
|
| 58 |
### Per-Scale Performance
|
| 59 |
-
- **Scale
|
| 60 |
-
- **Scale 512**:
|
| 61 |
-
- **Scale 768**:
|
| 62 |
-
- **Scale 1024**:
|
| 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 |
-
β βββ
|
| 84 |
-
β βββ
|
| 85 |
β βββ MODEL_SUMMARY.txt # π― Human-readable performance summary
|
| 86 |
β βββ training_history.json # π Epoch-by-epoch training curve
|
| 87 |
-
β βββ
|
| 88 |
-
β βββ
|
| 89 |
β βββ final_model.safetensors
|
| 90 |
β βββ checkpoint_epoch_X_accYY.YY.safetensors
|
| 91 |
β βββ david_config.json
|
| 92 |
β βββ train_config.json
|
| 93 |
βββ runs/
|
| 94 |
-
βββ
|
| 95 |
-
βββ
|
| 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 = "
|
| 128 |
-
run_id = "
|
| 129 |
-
accuracy = "
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
-
|
|
|
|
| 160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
|
| 162 |
## Architecture Overview
|
| 163 |
|
| 164 |
### Multi-Scale Processing
|
| 165 |
-
David processes inputs at multiple scales (
|
| 166 |
allowing it to capture both coarse and fine-grained features.
|
| 167 |
|
| 168 |
-
###
|
| 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 |
-
**
|
| 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
|
| 204 |
author = {AbstractPhil},
|
| 205 |
year = {2025},
|
| 206 |
url = {https://huggingface.co/AbstractPhil/gated-david},
|
| 207 |
-
note = {Run ID:
|
| 208 |
}
|
| 209 |
```
|
| 210 |
|
|
@@ -214,9 +204,9 @@ MIT License
|
|
| 214 |
|
| 215 |
## Acknowledgments
|
| 216 |
|
| 217 |
-
Built with
|
| 218 |
Special thanks to Claude (Anthropic) for debugging assistance.
|
| 219 |
|
| 220 |
---
|
| 221 |
|
| 222 |
-
*Generated on 2025-
|
|
|
|
| 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*
|