add trained BBPE Tokenizer model

This commit is contained in:
coffee
2025-04-30 17:25:53 +08:00
parent a68b346429
commit 9e604a0339
6 changed files with 126549 additions and 2 deletions
+1
View File
@@ -1,2 +1,3 @@
# USAGE # USAGE
使用sentencepiece和huggingface transformers分别进行tokenizer的训练 使用sentencepiece和huggingface transformers分别进行tokenizer的训练
support BPE and BBPE
@@ -9,7 +9,7 @@ tokenizer = Tokenizer(BPE(unk_token="[UNK]"))
# tokenizer.pre_tokenizer = Whitespace() # tokenizer.pre_tokenizer = Whitespace()
tokenizer.pre_tokenizer = ByteLevel(add_prefix_space=True) tokenizer.pre_tokenizer = ByteLevel(add_prefix_space=True)
trainer = BpeTrainer( trainer = BpeTrainer(
vocab_size=30000, vocab_size=12800,
special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"], special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"],
min_frequency=2, min_frequency=2,
show_progress=True show_progress=True
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
{
"cls_token": "[CLS]",
"mask_token": "[MASK]",
"pad_token": "[PAD]",
"sep_token": "[SEP]",
"unk_token": "[UNK]"
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,53 @@
{
"added_tokens_decoder": {
"0": {
"content": "[UNK]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"1": {
"content": "[CLS]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"2": {
"content": "[SEP]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"3": {
"content": "[PAD]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"4": {
"content": "[MASK]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
}
},
"clean_up_tokenization_spaces": false,
"cls_token": "[CLS]",
"extra_special_tokens": {},
"mask_token": "[MASK]",
"model_max_length": 1000000000000000019884624838656,
"pad_token": "[PAD]",
"sep_token": "[SEP]",
"tokenizer_class": "PreTrainedTokenizer",
"unk_token": "[UNK]"
}