Skip to content
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

'[UNK]' during tokenization when word starts with 'q' #34

Open
shubhanshu786 opened this issue May 20, 2021 · 0 comments
Open

'[UNK]' during tokenization when word starts with 'q' #34

shubhanshu786 opened this issue May 20, 2021 · 0 comments

Comments

@shubhanshu786
Copy link

shubhanshu786 commented May 20, 2021

Hi,
I faced an issue with the tokenizer while tokenizing text that start from q. I found that q is missing from vocab.txt file. (Q is present.)

tokenizer.tokenize('q qnm')
['[UNK]', '[UNK]']

Simple fix i tried: Add q into tokenizer using add_tokens method (huggingface), but it failed to produce exact/correct tokenization.

tokenizer.add_tokens(['q'])
tokenizer.tokenize('q qnm')
['q', 'q' 'n', '##m']

Here n should be ##n, while due to added q separately, it will treat q as new token and will try to split it separately. Which is not a correct solution down the line.

Solution suggested:
Add q into the vocab.txt file, that way it will result in correct tokenization. (I added at the last of vocab.txt file and updated model embedding size, not sure how it will work with model down the line. Yet to test)

tokenizer.tokenize('q qnm')
['q', 'q', '##n', '##m']

I hope you will release updated tokenizer vocab.txt file with added token q.

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

1 participant