File size: 594 Bytes
f4973d4
 
751936e
 
 
f4973d4
 
 
 
 
 
 
751936e
 
 
 
428b731
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
import config
from transformers import AutoTokenizer
from vocab import TokenizerType


if config.USE_REMOTE:
    tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-7B", trust_remote_code=True)
else:
    CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
    TOKENIZER_DIR = os.path.join(CURRENT_DIR, "Baichuan-7B")
    tokenizer = AutoTokenizer.from_pretrained(TOKENIZER_DIR, trust_remote_code=True)


# byte-bpe  sentencepiece
tokenizer.type = TokenizerType.ByteBPE

tokenizer.comments = "使用 SentencePiece 中的 Byte-Pair Encoding (BPE) 作为分词算法"