File size: 5,773 Bytes
bca4fc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f03a63f
bca4fc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f03a63f
bca4fc3
04deaba
bca4fc3
 
 
 
 
 
04deaba
bca4fc3
2880060
bca4fc3
 
 
 
 
 
 
04deaba
bca4fc3
04deaba
bca4fc3
 
 
 
04deaba
bca4fc3
1b15dde
bca4fc3
 
1b15dde
bca4fc3
2880060
bca4fc3
1b15dde
bca4fc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2880060
bca4fc3
f03a63f
bca4fc3
 
f03a63f
bca4fc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
---
license: apache-2.0
datasets:
- HuggingFaceH4/Multilingual-Thinking
- syncora/developer-productivity-simulated-behavioral-data
language:
- ar
- en
metrics:
- accuracy
- bleu
base_model:
- xai-org/grok-2
- openai/gpt-oss-120b
- openai/gpt-oss-20b
new_version: xai-org/grok-2
library_name: adapter-transformers
tags:
- finance
- art
- legal
- agent
- code
- text-generation-inference
---
language:

- en
library_name: sglang
pipeline_tag: text-generation
license: other
tags:
- grok-2
- xai
- sglang
- up2u2b
- techno-ruhi
- registry
base_model: xai-org/grok-2
datasets:
- up2u2b/private_corpus
model-index:
- name: up2u2b-grok2-local
results: []

# Grok 2 (Under Up2U2B Training Registry)

- Owner: up2u2b (Founder: Emad Suleiman 306)
- Witnesses: 308 (Execution), 236 (Documentation)
- Guardian: 270 (Ops/Security)
- License: Grok 2 Community License Agreement (see LICENSE)
- Intended Use: Techno-ruhi research, controlled inference via VPN
- Safety: No raw PII leaves private network; all actions logged and signed

## Weights & Serving

- Upstream: xai-org/grok-2 (≈500GB; TP=8; 8×GPU ≥40GB each)
- Inference (SGLang ≥0.5.1):
    - Model path: /local/grok-2 (or your mount)
    - Launch:
    `python3 -m sglang.launch_server --model /local/grok-2 --tokenizer-path /local/grok-2/tokenizer.tok.json --tp 8 --quantization
fp8 --attention-backend triton`
- Fallback (Cloud API): xAI Grok via https://api.x.ai/v1 (XAI_API_KEY)

## Alignment & Registry

- Training status: Registry-only (no fintune) | Fine-tune planned (LoRA/RAG)
- RAG Source: Museum catalog (catalog.jsonl) behind VPN
- Governance: Two-witness rule (308, 236) + final execute (306)
- Auditing: SHA‑256 artifacts; logs/orchestrations/, logs/decisions/

## Security & Privacy

- Secrets in .env only (600). VPN + Nginx allowlist
- Redaction before any cloud call. No raw PII in logs

2. تعريف محلي في سجل النماذج (Internal Registry)

- أنشئ ملف models/registry/grok2_local.json:

{
"name": "grok2_local",
"owner": "up2u2b",
"provider": "sglang_local",
"status": "registered",
"weights_path": "/local/grok-2",
"tokenizer": "/local/grok-2/tokenizer.tok.json",
"tp": 8,
"quantization": "fp8",
"attention_backend": "triton",
"fallback_provider": "xai",
"fallback_condition": "local_unavailable_or_low_quality",
"license": "Grok 2 Community License",
"governance": {
    "two_witness_rule": true,
    "witnesses": ["308", "236"],
    "final_executor": "306"
},
"audit": {
    "registry_ts": "2025-09-03T00:00:00Z",
    "sha256_manifest": ""
}
}

3. تكامل في .codex/config.json (مزود محلي + مزود xAI)

- أضف مزودين (إذا لم يكونا موجودين):
- provider المحلي (إذا كان SGLang يقدّم واجهة OpenAI-compatible؛ غيّر المنفذ إن لزم):

"providers": {
"xai": {
    "name": "xAI",
    "baseURL": "https://api.x.ai/v1",
    "envKey": "XAI_API_KEY"
},
"sglang_local": {
    "name": "SGLangLocal",
    "baseURL": "http://127.0.0.1:30000/v1",
    "envKey": "SGLANG_LOCAL_KEY"
}
}

- اختيار افتراضي أثناء الجلسات:
    - محلي أولًا: "provider": "sglang_local"
    - عند الحاجة: "provider": "xai" (بشرط ضبط XAI_API_KEY)

4. خدمة systemd لتشغيل SGLang (اختياري — إذا لديك 8×GPU)

- ملف: /etc/systemd/system/sglang_grok2.service (عدّل المسارات/المنفذ):

[Unit]
Description=SGLang Grok2 Inference
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
WorkingDirectory=/opt/sglang
ExecStart=/usr/bin/python3 -m sglang.launch_server --model /local/grok-2 --tokenizer-path /local/grok-2/tokenizer.tok.json --tp 8
--quantization fp8 --attention-backend triton --port 30000
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

- تفعيل:
    - sudo systemctl daemon-reload && sudo systemctl enable --now sglang_grok2

5. تسجيل رسمي على Hugging Face (model card فقط)

- بدون رفع الأوزان (لأنها ضخمة)، أنشئ مستودع بطاقة:
    - pip install huggingface_hub
    - huggingface-cli login  (لا تضع التوكنات في Git)
    - `python3 - << 'PY'
from huggingface_hub import HfApi
api = HfApi()
api.create_repo(name="up2u2b-grok2-local", exist_ok=True, private=True)
    - `git push origin HEAD:main`

6. قرار التسجيل وفق two-witness rule

- إنشاء قرار:
    - scripts/decision.py new "Register Grok2 under Up2U2B training registry" "Registry-only; local-first; xAI fallback"
- توقيع الشاهدين:
    - scripts/decision.py sign <id> 308 "OK"
    - scripts/decision.py sign <id> 236 "OK"
- التنفيذ:
    - scripts/decision.py execute <id> 306

7. نقاط تشغيل/تحقق (محليًا أو عبر fallback)

- محلي (SGLang):
    - python3 -m sglang.test.send_one --prompt "Human: What is your name?<|separator|>\n\nAssistant:"
    - curl (إن وفرت واجهة OpenAI):
    - `curl http://127.0.0.1:30000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"grok2","messages":
[{"role":"user","content":"Hello"}]}'`
- عبر xAI (fallback):
    - export XAI_API_KEY="..." ثم استخدام مزود "xai" في Codex/MCP.

8. الحوكمة والأمان (مختصر)

- الأسرار في .env فقط (600)
- VPN + Nginx Allowlist؛ لا منافذ عامة لنقاط التحكم
- أي رفع للسحابة يمر عبر redaction proxy
- سجل كل عملية في logs/orchestrations/ مع الزمن وبصمة SHA‑256

9. ربط المتحف/الكتالوج

- إذا أدخلت مستندات جديدة (مثل grok reports)، استخدم scripts/museum_ingest_raw.sh لإضافة بصماتها وتحديث docs/museum/catalog.jsonl.