Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

forward function takes too many arguments? #22

Open
datduong opened this issue Feb 13, 2018 · 2 comments
Open

forward function takes too many arguments? #22

datduong opened this issue Feb 13, 2018 · 2 comments

Comments

@datduong
Copy link

datduong commented Feb 13, 2018

I copy/paste the command to train the model, but get the error below

$python34 C:/Users/dat/Desktop/awd-lstm-lm/main.py --batch_size 20 --data C:/Users/dat/Desktop/awd-lstm-lm/data/penn --dropouti 0.4 --dropouth 0.25 --se ed 141 --epoch 500 --save C:/Users/dat/Desktop/awd-lstm-lm/PTB.pickle
Applying weight drop of 0.5 to weight_hh_l0
Applying weight drop of 0.5 to weight_hh_l0
Applying weight drop of 0.5 to weight_hh_l0
[WeightDrop (
(module): LSTM(400, 1150)
), WeightDrop (
(module): LSTM(1150, 1150)
), WeightDrop (
(module): LSTM(1150, 400)
)]
Args: Namespace(alpha=2, batch_size=20, beta=1, bptt=70, clip=0.25, cuda=True, data='C:/Users/dat/Desktop/awd-lstm-lm/data/penn', dropout=0.4, dropoute=0.1, dropouth=0.25, dropouti=0.4, emsize=400, epochs=500, log_interval=200, lr=30, model='LSTM', nhid=1150, nlayers=3, nonmono=5, save='C:/Users/dat/Desktop/awd-lstm-lm/PTB.pickle', seed=141, tied=True, wdecay=1.2e-06, wdrop=0.5)
Model total parameters: 24221600
Traceback (most recent call last):
File "C:/Users/dat/Desktop/awd-lstm-lm/main.py", line 185, in
train()
File "C:/Users/dat/Desktop/awd-lstm-lm/main.py", line 146, in train
output, hidden, rnn_hs, dropped_rnn_hs = model(data, hidden, return_h=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 206, in call
result = self.forward(*input, **kwargs)
File "C:\Users\dat\Desktop\awd-lstm-lm\model.py", line 70, in forward
emb = embedded_dropout(self.encoder, input, dropout=self.dropoute if self.training else 0)
File "C:\Users\dat\Desktop\awd-lstm-lm\embed_regularize.py", line 21, in embedded_dropout
embed.scale_grad_by_freq, embed.sparse
TypeError: forward() takes 3 positional arguments but 8 were given

@adjidieng
Copy link

adjidieng commented Feb 23, 2018

I am facing the same issue as well. Any solution to this @Smerity @keskarnitish

@adjidieng
Copy link

adjidieng commented Mar 1, 2018

@Smerity @keskarnitish this was a version issue. there is no problem when using the specified requirements e.g python 3.6. Feel free to close this. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants