Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- transformers.js
|
5 |
+
- tokenizers
|
6 |
+
---
|
7 |
+
|
8 |
+
# Grok-1 Tokenizer
|
9 |
+
|
10 |
+
A 🤗-compatible version of the **Grok-4 tokenizer** (adapted from [xai-org/grok-1](https://github.com/xai-org/grok-1)). This means it can be used with Hugging Face libraries including [Transformers](https://github.com/huggingface/transformers), [Tokenizers](https://github.com/huggingface/tokenizers), and [Transformers.js](https://github.com/xenova/transformers.js).
|
11 |
+
|
12 |
+
## Example usage:
|
13 |
+
|
14 |
+
### Transformers/Tokenizers
|
15 |
+
```py
|
16 |
+
from transformers import LlamaTokenizerFast
|
17 |
+
|
18 |
+
tokenizer = LlamaTokenizerFast.from_pretrained('Xenova/grok-1-tokenizer')
|
19 |
+
assert tokenizer.encode('hello world') == [21560, 1135]
|
20 |
+
```
|
21 |
+
|
22 |
+
### Transformers.js
|
23 |
+
```js
|
24 |
+
import { AutoTokenizer } from '@xenova/transformers';
|
25 |
+
|
26 |
+
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/grok-1-tokenizer');
|
27 |
+
const tokens = tokenizer.encode('hello world'); // [21560, 1135]
|
28 |
+
```
|