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

Help on using the model for finetuning #13

Closed
wailoktam opened this issue Jul 16, 2020 · 3 comments
Closed

Help on using the model for finetuning #13

wailoktam opened this issue Jul 16, 2020 · 3 comments

Comments

@wailoktam
Copy link

The part about tokenizing with Mecab is clear but what about the sub-word tokenization? And what if there are words found in the data used for finetuning but not found in the data used for pretraining? Some guide on using your pretrained model would be great.

@singletongue
Copy link
Collaborator

The subword tokenization is done with WordPiece algorithm, samely as in the original BERT models by Google.
Unseen tokens will be represented as [UNK] tokens.

We have an example usage of a pretrained model with a tokenizer here (it doesn't contain much information, though):
https://github.com/cl-tohoku/bert-japanese/blob/master/masked_lm_example.ipynb

@wailoktam
Copy link
Author

Hi, I am looking at your example

Can I assume the tokenizer created with:

BertJapaneseTokenizer.from_pretrained('bert-base-japanese-whole-word-masking')

already include tokenization (word segementation) by Mecab so that I dont need to process the input by Mecab first?

How about sentence splitting? If my input is just a passage not broken down into sentences split by newline, I need to apply a sentence splitter before sending the input to tokenizer created with BertJapaneseTokenizer.from_pretrained('bert-base-japanese-whole-word-masking'), right?

@singletongue
Copy link
Collaborator

Yes, BertJapaneseTokenizer includes word segmentation so you don't need to split a text into words by yourself.

On the other hand, You will have to split a text into sentences by yourself.
(This design decision also follows the original BERT models.)

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

2 participants