Text Classification
Transformers
English
cortex
decision-intelligence
system-1
typed-decisions
dynamic-memory
Eval Results (legacy)
Instructions to use siddiVinayaka/Cortex-System-One with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use siddiVinayaka/Cortex-System-One with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="siddiVinayaka/Cortex-System-One")# pip install -U transformers accelerate # Load model directly from transformers import Cortex model = Cortex.from_pretrained("siddiVinayaka/Cortex-System-One", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md with verified 2-cell demo and clean config
Browse files
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 &
|
| 114 |
|
| 115 |
-
### 1
|
| 116 |
|
| 117 |
-
You can run Cortex-System-One directly in
|
| 118 |
|
| 119 |
```python
|
| 120 |
-
# Install dependencies
|
| 121 |
!pip install -q torch tiktoken huggingface_hub
|
| 122 |
|
| 123 |
-
#
|
| 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:
|
| 138 |
-
"Task State: {\"
|
| 139 |
-
"Task: Determine
|
| 140 |
"Options:\n"
|
| 141 |
-
"(A)
|
| 142 |
-
"(B)
|
| 143 |
-
"(C)
|
| 144 |
"Analyze the state and select the correct option.\nAnswer:"
|
| 145 |
)
|
|
|
|
| 146 |
options = [
|
| 147 |
-
"
|
| 148 |
-
"
|
| 149 |
-
"
|
| 150 |
]
|
| 151 |
|
| 152 |
result = predict_decision(model, prompt, options, calibration=calibration, device=device)
|
| 153 |
-
print(
|
| 154 |
-
print(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
```
|
| 156 |
|
| 157 |
-
### 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
|
|
|
| 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 |
---
|