docs: add install and terminal chat quickstart

#1
Files changed (1) hide show
  1. README.md +64 -13
README.md CHANGED
@@ -53,27 +53,78 @@ v2 differences from v1: the brevity gap on short prompts drops from 0.27 to
53
  - Holdout (4,968 rows): pearson_macro **0.9656**, mae 0.058.
54
  - Mapping battery (30 P1, 6 P2, 40 garbage): P1 gap 0.13, P2 direction 6/6.
55
 
56
- ## Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  ```python
59
  import torch
60
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
61
 
62
- repo = "regolo/brick-sysone-V1"
63
- tok = AutoTokenizer.from_pretrained(repo)
 
 
 
 
64
  model = AutoModelForSequenceClassification.from_pretrained(
65
- repo, dtype=torch.bfloat16
66
- ).eval()
67
-
68
- batch = tok("debug this stacktrace...", return_tensors="pt", truncation=True, max_length=8192)
69
- with torch.inference_mode():
70
- logits = model(**batch).logits
71
- print(torch.sigmoid(logits))
72
- # [instruction_following, coding, math_reasoning, world_knowledge, planning_agentic, creative_synthesis]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ```
74
 
75
- Use FP32 on CPU and BF16 on CUDA. Truncate at 8192 tokens; longer inputs are
76
- outside the training distribution.
 
 
77
 
78
  ## License
79
 
 
53
  - Holdout (4,968 rows): pearson_macro **0.9656**, mae 0.058.
54
  - Mapping battery (30 P1, 6 P2, 40 garbage): P1 gap 0.13, P2 direction 6/6.
55
 
56
+ ## Quickstart
57
+
58
+ The output is a capability profile, not a distribution over models: each value
59
+ is an independent sigmoid in `[0, 1]`.
60
+
61
+ ### Install
62
+
63
+ ```bash
64
+ python3 -m venv .venv-systemone
65
+ .venv-systemone/bin/python -m pip install --upgrade pip
66
+ .venv-systemone/bin/python -m pip install --index-url https://download.pytorch.org/whl/cu128 \
67
+ torch==2.11.0
68
+ .venv-systemone/bin/python -m pip install transformers==5.20.2 safetensors==0.8.0 \
69
+ tokenizers==0.23.3 numpy==1.26.4 huggingface-hub==2.2.0
70
+ ```
71
+
72
+ Use `https://download.pytorch.org/whl/cu126` for driver 560-569, or
73
+ `https://download.pytorch.org/whl/cpu` for CPU-only. The script below picks
74
+ BF16 on CUDA and FP32 on CPU, as recommended.
75
+
76
+ ### Terminal chat
77
+
78
+ Type a query, read the vector. Save as `chat.py` and run
79
+ `.venv-systemone/bin/python chat.py`.
80
 
81
  ```python
82
  import torch
83
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
84
 
85
+ LABELS = ["instruction_following", "coding", "math_reasoning",
86
+ "world_knowledge", "planning_agentic", "creative_synthesis"]
87
+ REVISION = "9263a397a366ee22921214ddeebab1f5e4e8facd"
88
+
89
+ device = "cuda" if torch.cuda.is_available() else "cpu"
90
+ dtype = torch.bfloat16 if device == "cuda" else torch.float32
91
  model = AutoModelForSequenceClassification.from_pretrained(
92
+ "regolo/brick-sysone-V1", revision=REVISION, dtype=dtype,
93
+ attn_implementation="sdpa",
94
+ ).to(device).eval()
95
+ tokenizer = AutoTokenizer.from_pretrained("regolo/brick-sysone-V1", revision=REVISION)
96
+ limit = min(model.config.max_position_embeddings, 8192)
97
+
98
+ while True:
99
+ try:
100
+ query = input("query> ").strip()
101
+ except (EOFError, KeyboardInterrupt):
102
+ break
103
+ if not query:
104
+ continue
105
+ encoded = tokenizer(query, return_tensors="pt", truncation=True, max_length=limit).to(device)
106
+ with torch.inference_mode():
107
+ vector = model(**encoded).logits[0].sigmoid().float().tolist()
108
+ for label, value in zip(LABELS, vector):
109
+ print(f" {label:<20} {value:.4f}")
110
+ print(f" vector: [{', '.join(f'{v:.4f}' for v in vector)}]")
111
+ ```
112
+
113
+ ```
114
+ query> write a python parser that streams csv rows
115
+ instruction_following 0.5117
116
+ coding 0.9258
117
+ math_reasoning 0.0903
118
+ world_knowledge 0.1157
119
+ planning_agentic 0.0630
120
+ creative_synthesis 0.0198
121
+ vector: [0.5117, 0.9258, 0.0903, 0.1157, 0.0630, 0.0198]
122
  ```
123
 
124
+ Input is truncated at 8192 tokens; longer inputs are outside the training
125
+ distribution. The Brick router classifies only the last user message, never
126
+ system or assistant turns. Full scripts with `--json`, `--device` and one-shot
127
+ mode: `examples/systemone/` in the Brick repository.
128
 
129
  ## License
130