File size: 717 Bytes
751936e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d10ecd7
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



def SimpleTokenizer():
    import os
    from tokenizers import Tokenizer

    CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
    TOKENIZER_DIR = os.path.join(CURRENT_DIR, "20B_tokenizer.json")
    tokenizer = Tokenizer.from_file(TOKENIZER_DIR)
    tokenizer.vocab_size = tokenizer.get_vocab_size(with_added_tokens=True)
    # vocab_size = len(tokenizer.get_vocab())
    # vocab_size = tokenizer.vocab_size

from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")

# "tokenizer_type": "HFTokenizer",  # https://github.com/EleutherAI/gpt-neox/blob/v2.0/configs/20B.yml#L107

# tokenizer.vocab_size = tokenizer.get_vocab_size(with_added_tokens=True)