Skip to content

Saving and loading escnn models #1

Description

@ishaanb92

Hi,

Firstly, thanks for making such an accessible library to implement equivariant models alongside such informative documentation!

I wanted to train a toy model with MNIST before moving on to a bigger architecture and chose the model provided in the model.ipynb notebook in the 'examples' folder. After plugging it into my training script, I saved it using the regular PyTorch save procedure:
torch.save(model.state_dict(), 'mnist_model_e2cnn_{}.pt'.format(n_orientations))

In my test script, when I try to load this model using:
model.load_state_dict(torch.load('mnist_model_e2cnn_{}.pt'.format(n_orientations), map_location='cpu'))

However, trying to load the model throws up the following error:

RuntimeError: Error(s) in loading state_dict for MNISTE2CNN:
Missing key(s) in state_dict: "block1.1.filter", "block2.0.filter", "block3.0.filter", "block4.0.filter", "block5.0.filter", "block6.0.filter".

I'm not sure what I'm doing incorrectly, is there a special procedure involved in saving models that use escnn.nn.SequentialModule to stack ops?

EDIT: The torch version I am using is 1.7.0

Cheers,
Ishaan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions