Upload HSDN model
Browse files- README.md +40 -0
- best_model.pt +3 -0
- config.json +30 -0
- final_model.pt +3 -0
README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HSDN - Hierarchical Semantic Decomposition Network
|
| 2 |
+
|
| 3 |
+
A hierarchical retriever that decomposes embeddings into multi-resolution subspaces:
|
| 4 |
+
- **Level 1 (64D)**: Domain-level semantics
|
| 5 |
+
- **Level 2 (128D)**: Subdomain-level semantics
|
| 6 |
+
- **Level 3 (576D)**: Instance-level semantics
|
| 7 |
+
|
| 8 |
+
## Usage
|
| 9 |
+
|
| 10 |
+
```python
|
| 11 |
+
import torch
|
| 12 |
+
from sentence_transformers import SentenceTransformer
|
| 13 |
+
|
| 14 |
+
# Load base encoder
|
| 15 |
+
encoder = SentenceTransformer('BAAI/bge-base-en-v1.5')
|
| 16 |
+
|
| 17 |
+
# Load HSDN weights
|
| 18 |
+
from huggingface_hub import hf_hub_download
|
| 19 |
+
weights_path = hf_hub_download(repo_id="Ishaank18/hsdn-retriever", filename="best_model.pt")
|
| 20 |
+
state_dict = torch.load(weights_path, map_location='cpu')
|
| 21 |
+
|
| 22 |
+
# See cmrl_complete.py for full HSDNRetriever class
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## Architecture
|
| 26 |
+
|
| 27 |
+
- Base encoder: BAAI/bge-base-en-v1.5
|
| 28 |
+
- Level 1 (Domain): 64D
|
| 29 |
+
- Level 2 (Subdomain): 128D
|
| 30 |
+
- Level 3 (Instance): 576D
|
| 31 |
+
- Total: 768D
|
| 32 |
+
|
| 33 |
+
## Training
|
| 34 |
+
|
| 35 |
+
Trained with hierarchical contrastive loss + orthogonality constraints.
|
| 36 |
+
|
| 37 |
+
## Part of CMRL Project
|
| 38 |
+
|
| 39 |
+
This retriever is part of the Contextual Multi-Resolution Learning (CMRL) system
|
| 40 |
+
for adaptive STEM tutoring.
|
best_model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f119c7834c002955cddd1bac5da116dd60805842f7c1eb6856467f6c9b752b5
|
| 3 |
+
size 450521185
|
config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base_model": "BAAI/bge-base-en-v1.5",
|
| 3 |
+
"level1_dim": 64,
|
| 4 |
+
"level2_dim": 128,
|
| 5 |
+
"level3_dim": 576,
|
| 6 |
+
"num_domains": 6,
|
| 7 |
+
"num_subdomains": 20,
|
| 8 |
+
"subdomain_map": {
|
| 9 |
+
"Unknown": 0,
|
| 10 |
+
"World History Volume 2, from 1400": 1,
|
| 11 |
+
"Microbiology": 2,
|
| 12 |
+
"Chemistry 2e": 3,
|
| 13 |
+
"Elementary Algebra 2e": 4,
|
| 14 |
+
"Intermediate Algebra 2e": 5,
|
| 15 |
+
"Anatomy and Physiology 2e": 6,
|
| 16 |
+
"Psychology 2e": 7,
|
| 17 |
+
"Chemistry: Atoms First 2e": 8,
|
| 18 |
+
"Contemporary Mathematics": 9,
|
| 19 |
+
"University Physics Volume 2": 10,
|
| 20 |
+
"World History Volume 1, to 1500": 11,
|
| 21 |
+
"Makroekonomia - Podstawy": 12,
|
| 22 |
+
"Biology 2e": 13,
|
| 23 |
+
"University Physics Volume 1": 14,
|
| 24 |
+
"Workplace Software and Skills": 15,
|
| 25 |
+
"Astronomy 2e": 16,
|
| 26 |
+
"University Physics Volume 3": 17,
|
| 27 |
+
"Organic Chemistry": 18,
|
| 28 |
+
"Introduction to Sociology 3e": 19
|
| 29 |
+
}
|
| 30 |
+
}
|
final_model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a4bc78b2dfa0c22920421324656be534d369ea0b2d0ce7d2de4439c77a871b8
|
| 3 |
+
size 450521463
|