-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
Hello!
Is it possible to incorporate new tokens into the tokenizer before I distill the corresponding model with Model2Vec? Also, in the context of Zipf's Law, at which position in the vocabulary?
What I could do is the following:
tokens = ["my_special_token", "my_special_token2"]
tokenizer = AutoTokenizer.from_pretrained("intfloat/multilingual-e5-large")
tokenizer.add_tokens(tokens)
static_embedding = StaticEmbedding(
tokenizer,
embedding_dim=1024,
)
model = SentenceTransformer(
modules=[static_embedding],
device="cpu",
)
model.tokenizer.encode("my_special_token my_special_token2").tokens
# --> ['<s>', 'my_special_token', 'my_special_token2', '</s>']
However, this would be without distillation and corresponding weighting. The context is that we use the distilled model for product search, and we don't want to break down specific brand names further, but rather take them as they are, especially while fine-tuning.
Metadata
Metadata
Assignees
Labels
No labels