question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checkpoint key error when finetuning

See original GitHub issue

I have converted stylegan2-ffhq-config-f.pkl from official repo to stylegan2-ffhq-config-f.pt using convert_weight.py, then converted my dataset with prepare_data.py.

After that I am running this command: python train.py --finetune_loc 2 --ckpt stylegan2-ffhq-config-f.pt ./data_processed/ to finetune on my dataset but getting error:

load model: stylegan2-ffhq-config-f.pt Traceback (most recent call last): File "train.py", line 439, in <module> generator.load_state_dict(ckpt["g"], strict=False) KeyError: 'g'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bryandleecommented, Oct 8, 2020

Hi, the flags --gen and --disc are needed for the conversion.

https://github.com/bryandlee/FreezeG/blob/3b84a47eb190fc21ba13d5e26460e73a4a2af00b/stylegan2/convert_weight.py#L205-L206

Also, if you want to finetune from the converted checkpoint then you might need to convert the optimizer parameters as well. Check out the issue from the original repo: https://github.com/rosinality/stylegan2-pytorch/issues/105

0reactions
bryandleecommented, Nov 7, 2020

Hi, I haven’t managed to train the 1024 model either. I guess the pytorch implementation of StyleGAN2 takes more gpu memories than the original one?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error finetuning from pretrained checkpoint · Issue #30 - GitHub
Hi all, I'm running into an error when trying to fine-tune from one of the pretrained checkpoints. Code !mkdir "$output" !wget -q -O ......
Read more >
Unable to read from a tensorflow checkpoint for finetuning
But when I give the checkpoint of the pre-trained model, it is showing that "Key output_bias not found in checkpoint". I thought it...
Read more >
KeyError: 'loss' when fine-tuning a Transformer model
I am trying to fine tune a transformer model on my own unlabeled corpus of text. My code for doing this is: from...
Read more >
How to Checkpoint Deep Learning Models in Keras
In this post, you will discover how to checkpoint your deep learning models during training in Python using the Keras library.
Read more >
Transfer learning and fine-tuning | TensorFlow Core
A key advantage of that second workflow is that you only run the base model once on your data, rather than once per...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found