gluoncv-torch icon indicating copy to clipboard operation
gluoncv-torch copied to clipboard

PyTorch Version For Saving & Loading Model

Open GengZ opened this issue 6 years ago • 2 comments

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 :)

GengZ avatar Nov 20 '18 09:11 GengZ

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

zhanghang1989 avatar Jan 04 '19 18:01 zhanghang1989

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

zhanghang1989 avatar Jan 04 '19 18:01 zhanghang1989