File size: 948 Bytes
d5ffc65
 
 
300ac7e
 
 
d5ffc65
 
 
 
fe224b1
d5ffc65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300ac7e
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
---
library_name: transformers
tags:
- transformers.js
- tokenizers
license: apache-2.0
---

# Grok-1 Tokenizer

A 🤗-compatible version of the **Grok-1 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).

## Example usage:

### Transformers/Tokenizers
```py
from transformers import LlamaTokenizerFast

tokenizer = LlamaTokenizerFast.from_pretrained('Xenova/grok-1-tokenizer')
assert tokenizer.encode('hello world') == [21560, 1135]
```

### Transformers.js
```js
import { AutoTokenizer } from '@xenova/transformers';

const tokenizer = await AutoTokenizer.from_pretrained('Xenova/grok-1-tokenizer');
const tokens = tokenizer.encode('hello world'); // [21560, 1135]
```