Skip to content

Control symbols (here it is [CLS] and [SEP] ) are tokenized which should not be #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
weiczhu opened this issue Mar 15, 2019 · 3 comments

Comments

@weiczhu
Copy link

weiczhu commented Mar 15, 2019

Loaded a trained SentencePiece model.
['▁', '[', 'C', 'L', 'S', ']', 'あ', 'と', '、', '梱包', 'に', '関', 'して', 'は', '、', '塩', 'が', '袋', 'から', '少し', '漏', 'れ', '出', 'て', 'いた', 'ので', '少し', '雑', 'な', '印', '象', 'を', '受', 'け', 'ました', '。', '[', 'S', 'E', 'P', ']']

We should expect the tokenizer should NEVER to break the control symbols

@taku910
Copy link
Collaborator

taku910 commented Mar 15, 2019

You might want to use user defined symbols instead of user defined symbols.

% spm_train --input=... --model_prefix=... --user_defined_symbols=[CLS],[SEP]

You can see #215 for more details.

@taku910 taku910 closed this as completed Mar 15, 2019
@DomHudson
Copy link

DomHudson commented Oct 26, 2019

Note: If you want to mimic BERT use

            --unk_piece=[UNK]
            --pad_piece=[PAD]
            --user_defined_symbols=[CLS],[SEP],[MASK]

@wppply
Copy link

wppply commented Jul 30, 2020

Note: If you want to mimic BERT use

            --unk_piece=[UNK]
            --pad_piece=[PAD]
            --user_defined_symbols=[CLS],[SEP],[MASK]

In this case, the inital [CLS] will be tokenize to two word, will that affect the training of bert?

['▁', '[CLS]', '▁good', '▁good', '▁stud', 'y', ',', '▁day', 'day', '▁up', '[SEP]']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants