Skip to content

Commit

Permalink
Add fuse_unk option to SentencePieceBPETokenizer (#574)
Browse files Browse the repository at this point in the history
* Add fuse_unk option to SentencePieceBPETokenizer

* Fix style

Co-authored-by: Anthony MOI <[email protected]>
  • Loading branch information
Huffon and n1t0 authored Jan 12, 2021
1 parent 91dae1d commit b9c6bea
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ def __init__(
replacement: str = "▁",
add_prefix_space: bool = True,
dropout: Optional[float] = None,
fuse_unk: Optional[bool] = False,
):
if vocab is not None and merges is not None:
tokenizer = Tokenizer(BPE(vocab, merges, dropout=dropout, unk_token=unk_token))
tokenizer = Tokenizer(
BPE(vocab, merges, dropout=dropout, unk_token=unk_token, fuse_unk=fuse_unk)
)
else:
tokenizer = Tokenizer(BPE())

Expand Down

0 comments on commit b9c6bea

Please sign in to comment.