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

About Shared Embedding #93

Open
dawei-yu opened this issue May 22, 2022 · 2 comments
Open

About Shared Embedding #93

dawei-yu opened this issue May 22, 2022 · 2 comments

Comments

@dawei-yu
Copy link

if False:
    model.src_embed[0].lut.weight = model.tgt_embeddings[0].lut.weight
    model.generator.lut.weight = model.tgt_embed[0].lut.weight

Hi, I can't find tgt_embeddings in your code. Maybe it is model.src_embed[0].lut.weight = model.tgt_embed[0].lut.weight.

And if shared Embedding, Should the code be add to make_model()?
Like

def make_model(src_vocab, tgt_vocab, N=6, d_model=512, d_ff=2048, h=8, dropout=0.1):
    ...
    model = EncoderDecoder(...)
    model.src_embed[0].lut.weight = model.tgt_embed[0].lut.weight
    model.generator.lut.weight = model.tgt_embed[0].lut.weight
    ...
    return model
@wangjunhe8127
Copy link

i have the same question

@gitfourteen
Copy link

It is a typo and it is a False condition. Or else you can try BPE.

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

3 participants