StacyYang / gluoncv-torch

PyTorch API for GluonCV Models
MIT License
536 stars 62 forks source link

PyTorch Version For Saving & Loading Model #13

Open GengZ opened 5 years ago

GengZ commented 5 years ago

Thanks for the sharing the model. I ran into loading model error using PyTorch 0.3.1. I found the problem is because PyTorch model is backward compatible but not forward compatible.

  1. Just wonder which version you used for saving the model.
  2. And whether model compatible with slightly older version (0.3.1 in my case) will be available.

Thanks :)

zhanghang1989 commented 5 years ago

removes the parameters with name consisting num_batches_tracked should work for older pytorch version

zhanghang1989 commented 5 years ago
tparams = net.state_dict()
for i, (k,v) in enumerate(tparams.items()):
    if 'num_batches_tracked' in k:
        tparams.pop(k)