baonn commited on
Commit
fbf0bbe
·
verified ·
1 Parent(s): 882ffd8

Upload EPIC router checkpoints

Browse files
0.25/router_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2f3dc4e1573546449f2ba2181a3364735d33f47474290d63e8fdc7c38a4034a
3
+ size 91514922
0.5/router_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cae3a9ce9bf889763b5c096f87f97eca80eea53bc9f160a4568d0ff78d60a23
3
+ size 91514922
0.75/router_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0d609bb7a40b9ff7fe262c79fa6f6fd2123a8b30ee50f80dfd3465655ce3ea0
3
+ size 91514922
1.0/router_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ce1209e508d31c52d9f1a7a2d86a8bb49cbf52e502e8011d657044a74eb243b
3
+ size 91514922
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EPIC Router Family
2
+
3
+ This repository hosts the public checkpoints for the EPIC router models. Each
4
+ checkpoint learns to pick the best reasoning configuration (method, aggregator,
5
+ sample count, etc.) given a natural-language math question. The underlying
6
+ training and evaluation code lives in the EPIC GitHub project; these weights are
7
+ ready-to-use drop-in artifacts for that codebase.
8
+
9
+
10
+ ## Available Versions
11
+
12
+ | Subdirectory | File | Notes |
13
+ |--------------|-------------------|-------------------------------------|
14
+ | `0.25/` | `router_model.pt` | Router trained for the cost-accuracy trade-off = 0.25. |
15
+ | `0.5/` | `router_model.pt` | Router trained for the cost-accuracy trade-off = 0.5. |
16
+ | `0.75/` | `router_model.pt` | Router trained for the cost-accuracy trade-off = 0.75 |
17
+ | `1.0/` | `router_model.pt` | Router trained for the cost-accuracy trade-off = 1.0 |
18
+
19
+ Each checkpoint contains:
20
+
21
+ - `state_dict`: PyTorch weights for `RouterScoringModel`
22
+ - `model_name`: base encoder identifier (defaults to `sentence-transformers/all-MiniLM-L6-v2`)
23
+ - `projection_dim`: dimension of the projection head
24
+ - `methods`: serialized reasoning configurations; each row corresponds to one column in the router head
25
+
26
+
27
+ ## Quickstart (Python)
28
+
29
+ Install dependencies:
30
+
31
+ ```bash
32
+ pip install huggingface_hub torch sentence-transformers
33
+ ```
34
+
35
+ Load a checkpoint and route a question:
36
+
37
+ ```python
38
+ from huggingface_hub import hf_hub_download
39
+ import torch
40
+ from router.models import RouterScoringModel, MiniLMQuestionEncoder, QuestionProjector
41
+ from data_schemas.reasoning import ReasoningConfig
42
+
43
+ REPO_ID = "baonn/epic"
44
+ VERSION = "1.0" # or 0.5 / 0.75 / 0.25
45
+
46
+ checkpoint_path = hf_hub_download(
47
+ repo_id=REPO_ID,
48
+ filename="router_model.pt",
49
+ subfolder=VERSION,
50
+ )
51
+ checkpoint = torch.load(checkpoint_path, map_location="cpu")
52
+
53
+ encoder = MiniLMQuestionEncoder(
54
+ model_name=checkpoint.get("model_name", "sentence-transformers/all-MiniLM-L6-v2"),
55
+ trainable=False,
56
+ )
57
+ projector = QuestionProjector(
58
+ input_dim=encoder.transformer.config.hidden_size,
59
+ projection_dim=int(checkpoint["projection_dim"]),
60
+ )
61
+ model = RouterScoringModel(
62
+ question_encoder=encoder,
63
+ projector=projector,
64
+ num_methods=len(checkpoint["methods"]),
65
+ )
66
+ model.load_state_dict(checkpoint["state_dict"])
67
+ model.eval()
68
+
69
+ reasoning_configs = [
70
+ ReasoningConfig.deserialize(payload) for payload in checkpoint["methods"]
71
+ ]
72
+
73
+ question = "How many positive divisors does 3600 have?"
74
+ with torch.no_grad():
75
+ logits = model([question])
76
+ method_index = torch.argmax(logits, dim=1).item()
77
+
78
+ selected_config = reasoning_configs[method_index]
79
+ print("Recommended config:", selected_config.serialize(include_samples=True))
80
+ ```