File size: 667 Bytes
d60a8c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d61dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Cohere `rerank-multilingual-v2.0` tokenizer 

This is the tokenizer for the [Cohere Rerank Model](https://txt.cohere.com/rerank/).

You can load it with the transformers library like this:
```python
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("CohereLabs/rerank-multilingual-v2.0")
text = "Hello World, this is my input string!"
enc = tokenizer(text)
print("Encoded input:")
print(enc)

inv_vocab = {v: k for k, v in tokenizer.vocab.items()}
tokens = [inv_vocab[token_id] for token_id in enc['input_ids']]
print("Tokens:")
print(tokens)

number_of_tokens = len(enc['input_ids'])
print("Number of tokens:", number_of_tokens)
```