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

d2l.Seq2SeqEncoder(vocab_size=10, embed_size=8, num_hiddens=16, 2 num_layers=2) #2605

Open
achaosss opened this issue Jun 17, 2024 · 2 comments

Comments

@achaosss
Copy link


TypeError Traceback (most recent call last)
Cell In[21], line 4
1 encoder = d2l.Seq2SeqEncoder(vocab_size=10, embed_size=8, num_hiddens=16,
2 num_layers=2)
3 encoder.eval()
----> 4 decoder = Seq2SeqAttentionDecoder(vocab_size=10, embed_size=8, num_hiddens=16,
5 num_layers=2)
6 decoder.eval()
7 X = torch.zeros((4, 7), dtype=torch.long) # (batch_size,num_steps)

Cell In[20], line 5
2 def init(self, vocab_size, embed_size, num_hiddens, num_layers,
3 dropout=0, **kwargs):
4 super(Seq2SeqAttentionDecoder, self).init(**kwargs)
----> 5 self.attention = d2l.AdditiveAttention(
6 num_hiddens, num_hiddens, num_hiddens, dropout)
7 self.embedding = nn.Embedding(vocab_size, embed_size)
8 self.rnn = nn.GRU(
9 embed_size + num_hiddens, num_hiddens, num_layers,
10 dropout=dropout)

TypeError: init() takes 3 positional arguments but 5 were given

@achaosss
Copy link
Author

d2l-zh\pytorch\chapter_attention-mechanisms\bahdanau-attention.ipynb

@achaosss
Copy link
Author

d2l==0.17.2
or
d2l==1.0+
not work

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

1 participant