Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Issue loading checkpoint.pth file #36

Closed
davidrzs opened this issue Nov 20, 2021 · 1 comment
Closed

Issue loading checkpoint.pth file #36

davidrzs opened this issue Nov 20, 2021 · 1 comment

Comments

@davidrzs
Copy link

davidrzs commented Nov 20, 2021

Thank you very much for providing your code on GitHub. There is a problem when trying to load the checkpoint.pth file. If I load it using your latest code, it gives the error AttributeError: Can't get attribute 'exclude_bias_and_norm' on <module '__main__'>.

One can easily fix it by adding the following function to the file (not nested anywhere)

def exclude_bias_and_norm(p):
    return p.ndim == 1

Commit 21149b45bda50e579f166a4e261f281924b7c208 from August 5th actually introduced this "bug" as you very likely included the original saved model but just changed the code.

It is a very minor thing, but I thought about pointing it out. The problem stems from how PyTorch serializes models - hence I hope by opening this issue other researchers having the same issue might see this easy solution.

Here you can find a Jupyter notebook detailing the problem and the fix:
BugReport.zip

@jingli9111
Copy link
Contributor

Hi @davidrzs, thank you so much for pointing this out! We will update the checkpoint.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants