anokland / local-loss

PyTorch code for training neural networks without global back-propagation
162 stars 37 forks source link

Error of set_learning_rate() missing 3 positional arguments #2

Closed wenchima closed 5 years ago

wenchima commented 5 years ago

Hi, Arild,

Thanks for the wonderful work. I am quite interested in this work. I am trying to run the models, like resnet50 and resnet100 which you do not show specific guide in the paper. The terminal command I use is like this: python train.py --model resnet101 --dataset CIFAR10 --dropout 0.3 --lr 3e-4 --nonlin leakyrelu. But I got the following error: TypeError: set_learning_rate() missing 3 required positional arguments: 'lr', 'weight_decay', and 'momentum'

Really appreciate your help!

anokland commented 5 years ago

Sorry about that.

Replace this line: def set_learning_rate(self, alpha, lr, weight_decay, momentum): with this: def set_learning_rate(self, lr):

Should fix your problem.

wenchima commented 5 years ago

Thanks Arild! It solved the previous problem. But I got another one like this by just running, python train.py --model resnet50 --dataset CIFAR10 --dropout 0.3 --lr 3e-4 --nonlin leakyrelu.

Traceback (most recent call last): File "train.py", line 1644, in train_loss,train_error,train_print = train(epoch, lr) File "train.py", line 1532, in train output, loss = model(data, target, target_onehot) File "/panfs/panfs.ittc.ku.edu/work/ghwang/wenchi/VENV3.5.2_0.4.1/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, kwargs) File "train.py", line 1071, in forward x,,,loss = self.layer2((x, y, y_onehot, loss)) File "/panfs/panfs.ittc.ku.edu/work/ghwang/wenchi/VENV3.5.2_0.4.1/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, *kwargs) File "/panfs/panfs.ittc.ku.edu/work/ghwang/wenchi/VENV3.5.2_0.4.1/lib/python3.5/site-packages/torch/nn/modules/container.py", line 91, in forward input = module(input) File "/panfs/panfs.ittc.ku.edu/work/ghwang/wenchi/VENV3.5.2_0.4.1/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(input, kwargs) File "train.py", line 988, in forward out,loss = self.conv1(x, y, y_onehot) File "/panfs/panfs.ittc.ku.edu/work/ghwang/wenchi/VENV3.5.2_0.4.1/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, *kwargs) File "train.py", line 850, in forward y_hat_local = self.decoder_y(h.view(h.size(0), -1)) File "/panfs/panfs.ittc.ku.edu/work/ghwang/wenchi/VENV3.5.2_0.4.1/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(input, **kwargs) File "/panfs/panfs.ittc.ku.edu/work/ghwang/wenchi/VENV3.5.2_0.4.1/lib/python3.5/site-packages/torch/nn/modules/linear.py", line 55, in forward return F.linear(input, self.weight, self.bias) File "/panfs/panfs.ittc.ku.edu/work/ghwang/wenchi/VENV3.5.2_0.4.1/lib/python3.5/site-packages/torch/nn/functional.py", line 1024, in linear return torch.addmm(bias, input, weight.t()) RuntimeError: size mismatch, m1: [128 x 16384], m2: [4096 x 10] at /pytorch/aten/src/THC/generic/THCTensorMathBlas.cu:249

Thank you!

anokland commented 5 years ago

Both issues should be fixed now. Thank you for reporting this.