-
Notifications
You must be signed in to change notification settings - Fork 631
Description
Hi everyone,
I'm trying to convert the official NVIDIA StyleGAN2 FFHQ model (stylegan2-ffhq-config-f.pkl) into PyTorch format using convert_weight.py.
The conversion runs without errors, but the resulting .pt file only contains 171 keys , which is significantly less than expected (300 400). I suspect that not all layers are being converted properly.
The output .pt file was saved correctly.
Original .pkl: 364MB
Converted .pt: 254MB
root@5922842ca2ce:/workspace/stylegan2-pytorch# ls ../pretrained_models/stylegan2-ffhq-config-f.pkl -lh
-rw-r--r-- 1 root root 364M May 10 00:30 ../pretrained_models/stylegan2-ffhq-config-f.pkl
root@5922842ca2ce:/workspace/stylegan2-pytorch# ls *.pt -lh
-rw-r--r-- 1 root root 254M May 10 02:10 stylegan2-ffhq-config-f.pt
What I did:
bash
python convert_weight.py --repo /path/to/SAM --gen ../pretrained_models/stylegan2-ffhq-config-f.pkl
Model: stylegan2-ffhq-config-f.pkl
Key findings from the .pt file:
ckpt = torch.load("stylegan2-ffhq-config-f.pt")
g_ema_state = ckpt['g_ema']
print(len(g_ema_state)) # Output: 171
g_ema_state = ckpt['g_ema']
print(len(g_ema_state)) # Output: 171
Here's what I found:
✅ Loaded:
root@59398429a2ce:/workspace/stylegan2-pytorch# python testpt.py
Total keys in g_ema: 171
convs.0 to convs.15 (16 styled conv layers)
to_rgb1 (initial ToRGB)
to_rgbs.0 to to_rgbs.7 (8 additional ToRGB layers)
❌ Missing:
to_rgbs.8 (expected for 1024x1024 output)
Possibly other weights related to synthesis network at higher resolutions
✅ Noises:
All noise buffers loaded correctly (noises.noise_0 to noises.noise_16)
🤔 Questions:
Is this a known issue when converting the config-f model?
Why is to_rgbs.8 missing even though the original .pkl supports 1024x1024 resolution?
Could there be an off-by-one error in the resolution loop inside fill_statedict()?
Any help or insights would be greatly appreciated!