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

Tokenizer has partial token suffix instead of prefix #65

Open
guustfranssensEY opened this issue Jan 19, 2022 · 1 comment
Open

Tokenizer has partial token suffix instead of prefix #65

guustfranssensEY opened this issue Jan 19, 2022 · 1 comment

Comments

@guustfranssensEY
Copy link

guustfranssensEY commented Jan 19, 2022

Following your guide for identifying model configuration

MODEL_ID = "vinai/bertweet-base"

from transformers import AutoModelForSequenceClassification, AutoTokenizer
model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, normalization=True, use_fast=False)
ids= tokenizer('tokenization')
ids

returns:

{'input_ids': [0, 969, 6186, 6680, 2], 'token_type_ids': [0, 0, 0, 0, 0], 'attention_mask': [1, 1, 1, 1, 1]}

Then

tokenizer.convert_ids_to_tokens(ids['input_ids'])

returns:

['<s>', 'to@@', 'ken@@', 'ization', '</s>']

Here I noticed that the tokenizer adds a partial token suffix instead of partial token prefix. Having a suffix instead of prefix is not configurable in the config.

@guustfranssensEY guustfranssensEY changed the title Tokenizer has token suffix instead of prefix Tokenizer has partial token suffix instead of prefix Jan 19, 2022
@jalammar
Copy link
Owner

Oh wow I've never come across such a tokenizer. That's interesting..

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