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

Resizing token embeddings to account for new special tokens #258

Closed
g-karthik opened this issue Apr 27, 2021 · 1 comment
Closed

Resizing token embeddings to account for new special tokens #258

g-karthik opened this issue Apr 27, 2021 · 1 comment
Labels
feature request New feature or request

Comments

@g-karthik
Copy link

I've been looking through your project and was wondering, how are you allowing for addition of new special tokens downstream after pre-training? I see some support for HF tokenizers, but newly added special tokens would need to be accounted for by calling the resize_token_embeddings() method in HF. Is there some equivalent to be able to accomplish that here?

@sdtblck @StellaAthena

@g-karthik g-karthik added the feature request New feature or request label Apr 27, 2021
@sdtblck
Copy link
Contributor

sdtblck commented Apr 27, 2021

Hey! We currently don't have any way of handling that.

If it's a feature you'd like, feel free to start a PR.

It may be slightly more complicated than the HF method, as the embedding weights are distributed across machines in the model-parallel case, but it would involve resizing the weights here:

self.weight = Parameter(torch.empty(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants