-
Notifications
You must be signed in to change notification settings - Fork 935
Description
Hi!
I'm not sure if this is a problem that can be solved, or needs to be solved. Basically, we want to make a kind of hybrid tokenizer, in which we add a whole bunch of whole words to a tokenizer, and select these words instead of the subwords if they appear.
For example: if we pass the pretokenized string ["dog", "walks", "around", "Paris"]
, and "Paris" is a whole token, we want to select it instead of decomposing it into subtokens. I think that adding Paris
as an AddedToken
is the right approach for this (but please correct me if I'm wrong.)
So, we added many of these tokens (about 400k), but this makes loading a tokenizer extremely slow, like, it takes 15-30 minutes to load. We now add them as regular tokens, which works fine, but which has the downside of also finding these whole word tokens as part of other words. For example Parisians
will now be turned into ["Paris", "##ians"]
, which might have a different meaning.
So my main question is: is there a reason why adding many AddedToken
s is slow? Or is this just a path that hasn't been fully optimized yet?
Is using AddedToken
s in this way simply wrong? Should we be trying something else?
Thanks!
Stéphan