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

How can I change my .pt file to .ckpt file #12

Closed
zbw0329 opened this issue Jul 2, 2021 · 6 comments
Closed

How can I change my .pt file to .ckpt file #12

zbw0329 opened this issue Jul 2, 2021 · 6 comments

Comments

@zbw0329
Copy link

zbw0329 commented Jul 2, 2021

Hi~Thanks for your MobileStyleGAN!
I notice that you offer convert_rosinality_ckpt.py,but the parameters entered by this code do not have the path to the. Pt file.
It just has the parameter '--ckpt',but the output of styleGAN2 is .pt file.
So I still don't know how to change my .pt file...Please give me some help,thanks.

@bes-dev
Copy link
Owner

bes-dev commented Jul 2, 2021

just use --ckpt to set path to your .pt file

@zbw0329
Copy link
Author

zbw0329 commented Jul 2, 2021

Thanks for your reply!
And I set the grad_batches = 2,it comes a error.
It can work well when I set the grad_batch = 1.
My device is a 2080Ti.
Here is my Error.
TypeError: cannot unpack non-iterable NoneType object

@zbw0329
Copy link
Author

zbw0329 commented Jul 2, 2021

I set the --cpkt to the 'stylegan2-ffhq-config-f_v0.pt'
And I get errors,here is my traceback.
Traceback (most recent call last):
File "/home/derek/bowen/MobileStyleGAN/convert_rosinality_ckpt.py", line 85, in
main(args)
File "/home/derek/bowen/MobileStyleGAN/convert_rosinality_ckpt.py", line 73, in main
style_dim = extract_mnet(ckpt, args.ckpt_mnet)
File "/home/derek/bowen/MobileStyleGAN/convert_rosinality_ckpt.py", line 10, in extract_mnet
ckpt_mnet = select_weights(ckpt["g"], "style.")
KeyError: 'g'

@bes-dev
Copy link
Owner

bes-dev commented Jul 2, 2021

Here is my Error.
TypeError: cannot unpack non-iterable NoneType object

we do not handle memory allocation errors on our side, please follow to pytorch documentation to find your error code.

I set the --cpkt to the 'stylegan2-ffhq-config-f_v0.pt'
And I get errors,here is my traceback.

Following the rosinality training tool, the checkpoint file should contain the 'g' key with the generator's weights.

@zbw0329
Copy link
Author

zbw0329 commented Jul 2, 2021

Thanks for your reply,I will recheck my codes.

@zbw0329 zbw0329 closed this as completed Jul 2, 2021
@IvonaTau
Copy link

IvonaTau commented Oct 4, 2022

I set the --cpkt to the 'stylegan2-ffhq-config-f_v0.pt'
And I get errors,here is my traceback.
Traceback (most recent call last):
File "/home/derek/bowen/MobileStyleGAN/convert_rosinality_ckpt.py", line 85, in
main(args)
File "/home/derek/bowen/MobileStyleGAN/convert_rosinality_ckpt.py", line 73, in main
style_dim = extract_mnet(ckpt, args.ckpt_mnet)
File "/home/derek/bowen/MobileStyleGAN/convert_rosinality_ckpt.py", line 10, in extract_mnet
ckpt_mnet = select_weights(ckpt["g"], "style.")
KeyError: 'g'

I had the same error and by printing out the ckpt.keys() noticed there is a different naming. In my case it was g_ema instead of g. After changing all instances of ckpt['g'] to ckpt['g_ema'] in convert_rosinality_ckpt.py file I was able to run the code.

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