zoogzog / chexnet

Implementation of the CheXNet network (PyTorch)
211 stars 94 forks source link

loading the parameters #11

Open OfirKedem opened 6 years ago

OfirKedem commented 6 years ago

Hi zoogzog I've been trying to run your code but it seems the DenseNet121 module has been changed. meaning your parameters are saved under the name: module.densenet121.features.denseblock1.denselayer1.norm.1.bias ------------------------------------------------------------------------------------^---------- while the module is telling me it's missing: module.densenet121.features.denseblock1.denselayer1.norm1.bias

i believe that little dot there is messing everything up... do you have an idea how to solve it? loading an old DenseNet121 module or perhaps updating the parameters names?

i think retraining the model can fix it but I'm trying to save time and avoid training for now.

thanks in advance, a very desperate student :)

zoogzog commented 6 years ago

If you want to use the trained model, I think the quickest solution would be to use the older version of the DenseNet implementation.

zoukai214 commented 6 years ago

I met the same problem. Have you solved it? @OfirKedem

OfirKedem commented 6 years ago

Yes i have. You need to roll back torch and torchvision. Use this versions: image

dgrechka commented 5 years ago

Spent some time trying to find torch v0.3.1 for windows. bad luck. It is not available anymore. So pretrained weights are not usable.

mshmoon commented 4 years ago

This happend is because the high version pytorch define model keys as convX. or normX., but in the low version pytorch define model keys as conv.X. or norm.X., they are defference, so you should define keys as the same name.