Update README.md
Browse files
README.md
CHANGED
|
@@ -1,39 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Grok 2
|
| 2 |
|
| 3 |
This repository contains the weights of Grok 2, a model trained and used at xAI in 2024.
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
-
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
hf download xai-org/grok-2 --local-dir /local/grok-2
|
| 11 |
-
```
|
| 12 |
|
| 13 |
-
|
| 14 |
-
If the download succeeds, the folder should contain **42 files** and be approximately 500 GB.
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 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 |
-
|
| 26 |
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
python3 -m sglang.test.send_one --prompt "Human: What is your name?<|separator|>\n\nAssistant:"
|
| 31 |
-
```
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
## License
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
language:
|
| 2 |
+
|
| 3 |
+
- en
|
| 4 |
+
license: other
|
| 5 |
+
library_name: sglang
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- grok-2
|
| 9 |
+
- xai
|
| 10 |
+
- sglang
|
| 11 |
+
- inference
|
| 12 |
+
- triton
|
| 13 |
+
base_model: xai-org/grok-2
|
| 14 |
+
model-index:
|
| 15 |
+
- name: grok-2
|
| 16 |
+
results: []
|
| 17 |
+
|
| 18 |
# Grok 2
|
| 19 |
|
| 20 |
This repository contains the weights of Grok 2, a model trained and used at xAI in 2024.
|
| 21 |
|
| 22 |
+
- License: Grok 2 Community License Agreement (./LICENSE)
|
| 23 |
+
- Ownership: xAI (this document does not change license or weights)
|
| 24 |
+
|
| 25 |
+
## Weights
|
| 26 |
+
|
| 27 |
+
Download from the Hub (≈500 GB total; 42 files):
|
| 28 |
+
hf download xai-org/grok-2 --local-dir /local/grok-2
|
| 29 |
+
If you see transient errors, retry until it completes. On success, you should see 42 files (~500 GB).
|
| 30 |
+
|
| 31 |
+
## Hardware and Parallelism
|
| 32 |
|
| 33 |
+
- This checkpoint is configured for TP=8.
|
| 34 |
+
- Recommended: 8× GPUs (each > 40 GB memory).
|
| 35 |
|
| 36 |
+
## Serving with SGLang (>= v0.5.1)
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
Install SGLang from https://github.com/sgl-project/sglang/
|
|
|
|
| 39 |
|
| 40 |
+
Launch an inference server:
|
| 41 |
+
python3 -m sglang.launch_server \
|
| 42 |
+
--model /local/grok-2 \
|
| 43 |
+
--tokenizer-path /local/grok-2/tokenizer.tok.json \
|
| 44 |
+
--tp 8 \
|
| 45 |
+
--quantization fp8 \
|
| 46 |
+
--attention-backend triton
|
| 47 |
+
Send a test request (chat template aware):
|
| 48 |
+
python3 -m sglang.test.send_one --prompt \
|
| 49 |
+
"Human: What is your name?<|separator|>\n\nAssistant:"
|
| 50 |
+
You should see the model respond with its name: “Grok”.
|
| 51 |
|
| 52 |
+
More ways to send requests:
|
| 53 |
|
| 54 |
+
- https://docs.sglang.ai/basic_usage/send_request.html
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
Note: this is a post-trained model; use the correct chat template:
|
| 57 |
|
| 58 |
+
- https://github.com/sgl-project/sglang/blob/97a38ee85ba62e268bde6388f1bf8edfe2ca9d76/python/sglang/srt/tokenizer/
|
| 59 |
+
tiktoken_tokenizer.py#L106
|
| 60 |
|
| 61 |
+
## Community Usage (Examples)
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
- Local-only serving behind VPN/Nginx allowlist
|
| 64 |
+
- Log and audit inference (timestamps and SHA‑256 manifests)
|
| 65 |
+
- Optional fallback to xAI’s API when local capacity is unavailable
|
| 66 |
|
| 67 |
+
These examples describe usage patterns only; they do not alter license or weights.
|
| 68 |
+
|
| 69 |
+
## Limitations and Safety
|
| 70 |
+
|
| 71 |
+
- Large memory footprint (multi-GPU recommended)
|
| 72 |
+
- Follow the Grok 2 Community License
|
| 73 |
+
- Redact any sensitive data before inference if routing via cloud services
|
| 74 |
|
| 75 |
## License
|
| 76 |
|
| 77 |
+
Weights are licensed under the Grok 2 Community License Agreement (./LICENSE).
|
| 78 |
+
|
| 79 |
+
تعليق PR مقترح (قصير ومحايد)
|
| 80 |
+
|
| 81 |
+
- Summary: Fix model card metadata (YAML at top), remove duplicated sections, fence code blocks, and keep license/ownership
|
| 82 |
+
unchanged.
|
| 83 |
+
- Scope: README.md only. No weights or license changes.
|
| 84 |
+
- Rationale: Resolves Hub YAML warning and makes SGLang instructions copy‑paste runnable.
|
| 85 |
+
- Notes: URLs unbroken; model-index.results properly nested.
|
| 86 |
+
|