MCPcopy Index your code
hub / github.com/CommonstackAI/UncommonRoute / load_split

Function load_split

scripts/experiment_finetune.py:20–35  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

18
19
20def load_split(path):
21 rows = []
22 with open(path) as f:
23 for line in f:
24 if line.strip():
25 rows.append(json.loads(line))
26 texts, labels = [], []
27 for row in rows:
28 for m in reversed(row.get("messages", [])):
29 if m.get("role") == "user":
30 text = _normalize_content(m.get("content", ""))
31 if text.strip():
32 texts.append(text)
33 labels.append(row["target_tier_id"])
34 break
35 return texts, labels
36
37
38def make_contrastive_pairs(texts, labels, n_pairs=5000, seed=42):

Callers 1

mainFunction · 0.70

Calls 4

_normalize_contentFunction · 0.90
openFunction · 0.85
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected