Hello all!

I am fairly new to PyTorch and I am struggling with the following problem:

I have a pretrained model saved as .npz and I want to load it as a torch model.

(The trained model was created with objax).

With np.load(path) I get a numpy.lib.npyio.NpzFile.

Some additional info:

npzfile = np.load(pretrained_weights_path)

print(list(npzfile.keys()))

results in:

[‘names’, ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘10’, ‘11’, ‘12’, ‘13’, ‘14’, ‘15’, ‘16’, ‘17’, ‘18’, ‘19’, ‘20’, ‘21’, ‘22’, ‘23’, ‘24’, ‘25’, ‘26’, ‘27’, ‘28’, ‘29’, ‘30’, ‘31’, ‘32’, ‘33’, ‘34’, ‘35’, ‘36’, ‘37’, ‘38’, ‘39’, ‘40’, ‘41’]

- In ‘names’ I have my model “structure”, i.e. a ResNet.
- In ‘0’, ‘1’,… ‘41’ I have the weights as numpy.ndarray.

How can I load this as a torch model? Or is that even possible?

Please let me know if you need additional information. I refrained from sharing my code because the weights are confidential.