stylegan2-pytorch icon indicating copy to clipboard operation
stylegan2-pytorch copied to clipboard

AssertionError : assert state["version"] in [2, 3, 4]

Open IvonaTau opened this issue 4 years ago • 8 comments

Hi, I tried running convert_weight.py in a couple of different environments but I get the following error:

File "/stylegan2/dnnlib/tflib/network.py", line 278, in __setstate__
    assert state["version"] in [2, 3, 4]
AssertionError

Tensorflow : 1.15 Torch: 1.7 Torchvision: 0.8

IvonaTau avatar Dec 16 '20 16:12 IvonaTau

I think you may need to check your checkpoints is valid stylegan2 checkpoint.

rosinality avatar Dec 17 '20 15:12 rosinality

I am seeing the same error with stylegan2-ada TF checkpoints. Looks like those checkpoints are version "5" - unfortunately just adding "5" to the assert does not help, since further down it causes another error, since the version 5 fused_bias seems to have at least one more argument "clamp".

TypeError: fused_bias_act() got an unexpected keyword argument 'clamp'

Quasimondo avatar Dec 19 '20 21:12 Quasimondo

Okay - turns out that it works with stylegan2-ada checkpoints, my problem was that my --repo argument was pointing to the old stylegan2 repo.

Quasimondo avatar Dec 19 '20 22:12 Quasimondo

@Quasimondo Oh, thank you for the test! I will check and update the readme.

rosinality avatar Dec 20 '20 02:12 rosinality

ModuleNotFoundError: No module named 'dnnlib'

FlashlightET avatar Apr 20 '21 18:04 FlashlightET

@FlashlightET Did you set --repo arguments to the path that contains dnnlib directory?

rosinality avatar Apr 21 '21 11:04 rosinality

I met the same question,and I can't understand how to --repo arguments to the path that contains dnnlib directory.

zhouyuezhou1 avatar Nov 18 '21 13:11 zhouyuezhou1

@zhouyuezhou1 You need to clone official tensorflow repository and set --repo to the path of it.

rosinality avatar Nov 20 '21 00:11 rosinality