up2u commited on
Commit
bca4fc3
·
verified ·
1 Parent(s): d60cbe2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +175 -24
README.md CHANGED
@@ -1,39 +1,190 @@
1
- # Grok 2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- This repository contains the weights of Grok 2, a model trained and used at xAI in 2024.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
- ## Usage: Serving with SGLang
6
 
7
- - Download the weights. You can replace `/local/grok-2` with any other folder name you prefer.
 
 
 
 
 
8
 
9
- ```
10
- hf download xai-org/grok-2 --local-dir /local/grok-2
11
- ```
12
 
13
- You might encounter some errors during the download. Please retry until the download is successful.
14
- If the download succeeds, the folder should contain **42 files** and be approximately 500 GB.
 
 
 
 
 
15
 
16
- - Launch a server.
17
 
18
- Install the latest SGLang inference engine (>= v0.5.1) from https://github.com/sgl-project/sglang/
 
 
 
19
 
20
- Use the command below to launch an inference server. This checkpoint is TP=8, so you will need 8 GPUs (each with > 40GB of memory).
21
- ```
22
- python3 -m sglang.launch_server --model /local/grok-2 --tokenizer-path /local/grok-2/tokenizer.tok.json --tp 8 --quantization fp8 --attention-backend triton
23
- ```
24
 
25
- - Send a request.
 
26
 
27
- This is a post-trained model, so please use the correct [chat template](https://github.com/sgl-project/sglang/blob/97a38ee85ba62e268bde6388f1bf8edfe2ca9d76/python/sglang/srt/tokenizer/tiktoken_tokenizer.py#L106).
28
 
29
- ```
30
- python3 -m sglang.test.send_one --prompt "Human: What is your name?<|separator|>\n\nAssistant:"
31
- ```
32
 
33
- You should be able to see the model output its name, Grok.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- Learn more about other ways to send requests [here](https://docs.sglang.ai/basic_usage/send_request.html).
36
 
37
- ## License
 
38
 
39
- The weights are licensed under the [Grok 2 Community License Agreement](https://huggingface.co/xai-org/grok-2/blob/main/LICENSE).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - HuggingFaceH4/Multilingual-Thinking
5
+ - syncora/developer-productivity-simulated-behavioral-data
6
+ language:
7
+ - ar
8
+ - en
9
+ metrics:
10
+ - accuracy
11
+ - bleu
12
+ base_model:
13
+ - xai-org/grok-2
14
+ - openai/gpt-oss-120b
15
+ - openai/gpt-oss-20b
16
+ new_version: xai-org/grok-2
17
+ library_name: adapter-transformers
18
+ tags:
19
+ - finance
20
+ - art
21
+ - legal
22
+ - agent
23
+ - code
24
+ - text-generation-inference
25
+ ---
26
+ language:
27
 
28
+ - en
29
+ library_name: sglang
30
+ pipeline_tag: text-generation
31
+ license: other
32
+ tags:
33
+ - grok-2
34
+ - xai
35
+ - sglang
36
+ - up2u2b
37
+ - techno-ruhi
38
+ - registry
39
+ base_model: xai-org/grok-2
40
+ datasets:
41
+ - up2u2b/private_corpus
42
+ model-index:
43
+ - name: up2u2b-grok2-local
44
+ results: []
45
 
46
+ # Grok 2 (Under Up2U2B Training Registry)
47
 
48
+ - Owner: up2u2b (Founder: Emad Suleiman 306)
49
+ - Witnesses: 308 (Execution), 236 (Documentation)
50
+ - Guardian: 270 (Ops/Security)
51
+ - License: Grok 2 Community License Agreement (see LICENSE)
52
+ - Intended Use: Techno-ruhi research, controlled inference via VPN
53
+ - Safety: No raw PII leaves private network; all actions logged and signed
54
 
55
+ ## Weights & Serving
 
 
56
 
57
+ - Upstream: xai-org/grok-2 (≈500GB; TP=8; 8×GPU ≥40GB each)
58
+ - Inference (SGLang ≥0.5.1):
59
+ - Model path: /local/grok-2 (or your mount)
60
+ - Launch:
61
+ `python3 -m sglang.launch_server --model /local/grok-2 --tokenizer-path /local/grok-2/tokenizer.tok.json --tp 8 --quantization
62
+ fp8 --attention-backend triton`
63
+ - Fallback (Cloud API): xAI Grok via https://api.x.ai/v1 (XAI_API_KEY)
64
 
65
+ ## Alignment & Registry
66
 
67
+ - Training status: Registry-only (no fintune) | Fine-tune planned (LoRA/RAG)
68
+ - RAG Source: Museum catalog (catalog.jsonl) behind VPN
69
+ - Governance: Two-witness rule (308, 236) + final execute (306)
70
+ - Auditing: SHA‑256 artifacts; logs/orchestrations/, logs/decisions/
71
 
72
+ ## Security & Privacy
 
 
 
73
 
74
+ - Secrets in .env only (600). VPN + Nginx allowlist
75
+ - Redaction before any cloud call. No raw PII in logs
76
 
77
+ 2. تعريف محلي في سجل النماذج (Internal Registry)
78
 
79
+ - أنشئ ملف models/registry/grok2_local.json:
 
 
80
 
81
+ {
82
+ "name": "grok2_local",
83
+ "owner": "up2u2b",
84
+ "provider": "sglang_local",
85
+ "status": "registered",
86
+ "weights_path": "/local/grok-2",
87
+ "tokenizer": "/local/grok-2/tokenizer.tok.json",
88
+ "tp": 8,
89
+ "quantization": "fp8",
90
+ "attention_backend": "triton",
91
+ "fallback_provider": "xai",
92
+ "fallback_condition": "local_unavailable_or_low_quality",
93
+ "license": "Grok 2 Community License",
94
+ "governance": {
95
+ "two_witness_rule": true,
96
+ "witnesses": ["308", "236"],
97
+ "final_executor": "306"
98
+ },
99
+ "audit": {
100
+ "registry_ts": "2025-09-03T00:00:00Z",
101
+ "sha256_manifest": ""
102
+ }
103
+ }
104
 
105
+ 3. تكامل في .codex/config.json (مزود محلي + مزود xAI)
106
 
107
+ - أضف مزودين (إذا لم يكونا موجودين):
108
+ - provider المحلي (إذا كان SGLang يقدّم واجهة OpenAI-compatible؛ غيّر المنفذ إن لزم):
109
 
110
+ "providers": {
111
+ "xai": {
112
+ "name": "xAI",
113
+ "baseURL": "https://api.x.ai/v1",
114
+ "envKey": "XAI_API_KEY"
115
+ },
116
+ "sglang_local": {
117
+ "name": "SGLangLocal",
118
+ "baseURL": "http://127.0.0.1:30000/v1",
119
+ "envKey": "SGLANG_LOCAL_KEY"
120
+ }
121
+ }
122
+
123
+ - اختيار افتراضي أثناء الجلسات:
124
+ - محلي أولًا: "provider": "sglang_local"
125
+ - عند الحاجة: "provider": "xai" (بشرط ضبط XAI_API_KEY)
126
+
127
+ 4. خدمة systemd لتشغيل SGLang (اختياري — إذا لديك 8×GPU)
128
+
129
+ - ملف: /etc/systemd/system/sglang_grok2.service (عدّل المسارات/المنفذ):
130
+
131
+ [Unit]
132
+ Description=SGLang Grok2 Inference
133
+ After=network-online.target
134
+ Wants=network-online.target
135
+
136
+ [Service]
137
+ Type=simple
138
+ WorkingDirectory=/opt/sglang
139
+ ExecStart=/usr/bin/python3 -m sglang.launch_server --model /local/grok-2 --tokenizer-path /local/grok-2/tokenizer.tok.json --tp 8
140
+ --quantization fp8 --attention-backend triton --port 30000
141
+ Restart=on-failure
142
+ RestartSec=5
143
+
144
+ [Install]
145
+ WantedBy=multi-user.target
146
+
147
+ - تفعيل:
148
+ - sudo systemctl daemon-reload && sudo systemctl enable --now sglang_grok2
149
+
150
+ 5. تسجيل رسمي على Hugging Face (model card فقط)
151
+
152
+ - بدون رفع الأوزان (لأنها ضخمة)، أنشئ مستودع بطاقة:
153
+ - pip install huggingface_hub
154
+ - huggingface-cli login (لا تضع التوكنات في Git)
155
+ - `python3 - << 'PY'
156
+ from huggingface_hub import HfApi
157
+ api = HfApi()
158
+ api.create_repo(name="up2u2b-grok2-local", exist_ok=True, private=True)
159
+ - `git push origin HEAD:main`
160
+
161
+ 6. قرار التسجيل وفق two-witness rule
162
+
163
+ - إنشاء قرار:
164
+ - scripts/decision.py new "Register Grok2 under Up2U2B training registry" "Registry-only; local-first; xAI fallback"
165
+ - توقيع الشاهدين:
166
+ - scripts/decision.py sign <id> 308 "OK"
167
+ - scripts/decision.py sign <id> 236 "OK"
168
+ - التنفيذ:
169
+ - scripts/decision.py execute <id> 306
170
+
171
+ 7. نقاط تشغيل/تحقق (محليًا أو عبر fallback)
172
+
173
+ - محلي (SGLang):
174
+ - python3 -m sglang.test.send_one --prompt "Human: What is your name?<|separator|>\n\nAssistant:"
175
+ - curl (إن وفرت واجهة OpenAI):
176
+ - `curl http://127.0.0.1:30000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"grok2","messages":
177
+ [{"role":"user","content":"Hello"}]}'`
178
+ - عبر xAI (fallback):
179
+ - export XAI_API_KEY="..." ثم استخدام مزود "xai" في Codex/MCP.
180
+
181
+ 8. الحوكمة والأمان (مختصر)
182
+
183
+ - الأسرار في .env فقط (600)
184
+ - VPN + Nginx Allowlist؛ لا منافذ عامة لنقاط التحكم
185
+ - أي رفع للسحابة يمر عبر redaction proxy
186
+ - سجل كل عملية في logs/orchestrations/ مع الزمن وبصمة SHA‑256
187
+
188
+ 9. ربط المتحف/الكتالوج
189
+
190
+ - إذا أدخلت مستندات جديدة (مثل grok reports)، استخدم scripts/museum_ingest_raw.sh لإضافة بصماتها وتحديث docs/museum/catalog.jsonl.