eladhoffer / convNet.pytorch

ConvNet training using pytorch
MIT License
345 stars 88 forks source link

TypeError: __init__() got an unexpected keyword argument 'reduction' #7

Closed Coderx7 closed 5 years ago

Coderx7 commented 6 years ago

Hi, When I try to run the script, I face this error , whats wrong ? TypeError: __init__() got an unexpected keyword argument 'reduction' I'm calling the script like this :

IMAGENET_DIR=ImageNet_DataSet
MODEL_NAME=mobilenet
python main.py --dataset $IMAGENET_DIR --model $MODEL_NAME 

I'm using Python3.6 and Pytorch 0.4 Thanks alot in advance

eladhoffer commented 5 years ago

make sure you have updated utils.pytorch (git pull) and latest pytorch (>0.4.1)

Coderx7 commented 5 years ago

As a side question, did you usea single gpu with batch of 256? or multiple gpus? if so how many?

asgq123 commented 5 years ago

@Coderx7 Hello,did you solve your problem with upgrade pytorch version

Coderx7 commented 5 years ago

@qiyayun : I never upgraded to 0.4.1 so I have no idea if that solves the issue. I simply never used the script when I got that error. updating to 0.4.1 is a safe bet however since 0.4.1 doesnt have any breaking changes if you are already on 0.4!)

blueardour commented 5 years ago

My torch version is 0.4.1.

import torch torch.version '0.4.1'

In my experiment, I didn't meet the reduction problem. However, I got 'named_parameters() got an unexpected keyword argument 'recurse' for line 26th in utils.pytorch/param_filter.py.

I checked the tutorial in pytorch website https://pytorch.org/docs/stable/nn.html , it showed 'recurse' was indeed available. It's strange why give such error.

blueardour commented 5 years ago

After a check, the 'recurse' doesn't exist in the pytorch 0.4.1 version. def named_parameters(self, memo=None, prefix=''): cited from https://github.com/pytorch/pytorch/blob/v0.4.1/torch/nn/modules/module.py

and it does in the v1.0 version.