Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compability issue for .pkl extension #13

Open
cihatkapusuz opened this issue Apr 25, 2021 · 2 comments
Open

Compability issue for .pkl extension #13

cihatkapusuz opened this issue Apr 25, 2021 · 2 comments

Comments

@cihatkapusuz
Copy link

We have a model stored as .pkl file which is trained on NVIDIA's StyleGAN. Since its extension is .pkl, and your structure asks for a .pth file, is there any way to convert our .pkl file to .pth file? Or is there any way to work on your system with a .pkl file?

@wjkang619
Copy link

I have the same problem. I also have NVlab's 'Stylegan2-ADA', 'Stylegan2-ADA-PyTorch' models. (.pkl files)
#9 suggested a method, but I didn't understand it.
I do not know how to load the parameters as NumPy.ndarray.
I apologize for such a beginner's question.

@ShenYujun
Copy link
Contributor

Any model weights (ideally) should be stored like a dictionary or a recursive dictionary. Some key-value pairs should be the parameter name-pre-trained weight pairs, where parameter name should be a string and pre-trained weight should be a tensor (pytorch or tensorflow version, both of which can be easily converted to numpy.ndarray). Please Google how to convert a pytorch (or tensorflow) tensor to a numpy.ndarray if you are really new to these two DL frameworks.

So, I would recommend first load the pkl file with ipython, and then check how the file is organized with print() function.

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

No branches or pull requests

3 participants