siddiVinayaka commited on
Commit
782f276
·
verified ·
1 Parent(s): f6fce60

Update README.md with verified 2-cell demo and clean config

Browse files
Files changed (1) hide show
  1. README.md +39 -24
README.md CHANGED
@@ -2,7 +2,6 @@
2
  language:
3
  - en
4
  license: cc-by-nc-nd-4.0
5
- library_name: transformers
6
  tags:
7
  - decision-intelligence
8
  - system-1
@@ -110,57 +109,73 @@ Unlike traditional models trained on 2–15 Trillion tokens of uncurated web cra
110
 
111
  ---
112
 
113
- ## Quickstart & Inference
114
 
115
- ### 1. In Google Colab or Python (1-Click, Zero Git Clone)
116
 
117
- You can run Cortex-System-One directly in Python or a Google Colab notebook using `huggingface_hub` — **no `git clone` or `git lfs` needed**:
118
 
119
  ```python
120
- # Install dependencies
121
  !pip install -q torch tiktoken huggingface_hub
122
 
123
- # Load model directly from Hugging Face repository
124
  import sys, torch
125
  from huggingface_hub import snapshot_download
126
 
 
127
  model_dir = snapshot_download("siddiVinayaka/Cortex-System-One")
128
  sys.path.append(model_dir)
129
 
130
  from inference import load_cortex_model, predict_decision
131
 
 
132
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
133
  model, calibration = load_cortex_model(model_dir, device=device)
134
 
135
- # Run Inference
136
  prompt = (
137
- "Workflow: Security Incidents\n"
138
- "Task State: {\"alert_type\":\"brute_force\",\"failed_logins\":42,\"source_ip\":\"198.51.100.2\"}\n\n"
139
- "Task: Determine incident response containment action.\n"
140
  "Options:\n"
141
- "(A) Ignore alert as false positive\n"
142
- "(B) Isolate host and revoke active credentials\n"
143
- "(C) Send non-urgent notification\n\n"
144
  "Analyze the state and select the correct option.\nAnswer:"
145
  )
 
146
  options = [
147
- "Ignore alert as false positive",
148
- "Isolate host and revoke active credentials",
149
- "Send non-urgent notification"
150
  ]
151
 
152
  result = predict_decision(model, prompt, options, calibration=calibration, device=device)
153
- print(f"Decision: {result['predicted_option']}")
154
- print(f"Confidence: {result['probabilities']}")
 
 
 
 
155
  ```
156
 
157
- ### 2. Local Machine via Git
 
 
 
 
 
 
 
 
158
 
159
- ```bash
160
- git clone https://huggingface.co/siddiVinayaka/Cortex-System-One
161
- cd Cortex-System-One
162
- pip install -r requirements.txt # or: pip install torch tiktoken
163
- python inference.py
 
164
  ```
165
 
166
  ---
 
2
  language:
3
  - en
4
  license: cc-by-nc-nd-4.0
 
5
  tags:
6
  - decision-intelligence
7
  - system-1
 
109
 
110
  ---
111
 
112
+ ## Quickstart & Usage (2-Cell Demo)
113
 
114
+ ### Cell 1: 1-Click Load & Instant Single-Decision Inference (<15ms)
115
 
116
+ You can run Cortex-System-One directly in Google Colab or Python using `huggingface_hub` — **no git clone or git lfs needed**:
117
 
118
  ```python
119
+ # 1. Install dependencies
120
  !pip install -q torch tiktoken huggingface_hub
121
 
122
+ # 2. Pull model directly from Hugging Face via repository name
123
  import sys, torch
124
  from huggingface_hub import snapshot_download
125
 
126
+ # This pulls the architecture and full 2.21 GB weights via high-speed CDN in ~15-20s
127
  model_dir = snapshot_download("siddiVinayaka/Cortex-System-One")
128
  sys.path.append(model_dir)
129
 
130
  from inference import load_cortex_model, predict_decision
131
 
132
+ # 3. Load Model onto GPU
133
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
134
  model, calibration = load_cortex_model(model_dir, device=device)
135
 
136
+ # 4. Run Instant Decision Inference (<15ms)
137
  prompt = (
138
+ "Workflow: Code Defect Security\n"
139
+ "Task State: {\"file\":\"auth_service.py\",\"ast_node\":\"BinaryOp_Add\",\"code_snippet\":\"query = 'SELECT * FROM users WHERE email = \\'' + user_input + '\\''\",\"cwe\":\"CWE-89\"}\n\n"
140
+ "Task: Determine security defect classification and required remediation.\n"
141
  "Options:\n"
142
+ "(A) Safe string formatting with no security impact\n"
143
+ "(B) Critical SQL injection vulnerability requiring parameterized query binding\n"
144
+ "(C) Minor performance overhead from string concatenation\n\n"
145
  "Analyze the state and select the correct option.\nAnswer:"
146
  )
147
+
148
  options = [
149
+ "Safe string formatting with no security impact",
150
+ "Critical SQL injection vulnerability requiring parameterized query binding",
151
+ "Minor performance overhead from string concatenation"
152
  ]
153
 
154
  result = predict_decision(model, prompt, options, calibration=calibration, device=device)
155
+ print("\n" + "="*55)
156
+ print(f"🎯 Cortex-System-One Decision : {result['predicted_option']}")
157
+ print(f"⚡ Decision Confidence Score : {result['confidence']*100:.2f}%")
158
+ print(f"⏱️ Decision Latency : {result['latency_ms']:.2f} ms")
159
+ print(f"📊 Full Distribution : {result['probabilities']}")
160
+ print("="*55)
161
  ```
162
 
163
+ ### Cell 2: Official S1MB Typed Decisions Benchmark Reproduction
164
+
165
+ Run the official S1MB benchmark reproduction across all 100 interleaved cases (500 decisions across Choice, Noul, Score):
166
+
167
+ ```python
168
+ # 1. Download official benchmark reproduction script
169
+ from huggingface_hub import hf_hub_download
170
+
171
+ script_path = hf_hub_download(repo_id="siddiVinayaka/Cortex-System-One", filename="benchmark_s1mb_official.py")
172
 
173
+ # 2. Run benchmark with PYTHONPATH pointing to model cache
174
+ !PYTHONPATH={model_dir} python {script_path} \
175
+ --checkpoint {model_dir}/ckpt_cortex_system_one_champion.pth \
176
+ --calibration {model_dir}/cortex_system_one_calibration.json \
177
+ --suite typed_decisions \
178
+ --device cuda
179
  ```
180
 
181
  ---