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

No module named 'torch_utils' in run_convert_from_tf.py #24

Open
a656418zz opened this issue Nov 17, 2021 · 5 comments
Open

No module named 'torch_utils' in run_convert_from_tf.py #24

a656418zz opened this issue Nov 17, 2021 · 5 comments

Comments

@a656418zz
Copy link

Hi, thank you very much for sharing. Due to the limitation of the GPU, I'm going to use "run_convert_from_tf.py" to transpose a 512x512 pre-trained model of stylegan2, which I got from https://catalog.ngc.nvidia.com/orgs/nvidia/teams/research/models/stylegan2 to download "stylegan2-ffhq-512x512.pkl", then I would like to try to conversion, but it failed, reporting the following error code.

Traceback (most recent call last):
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 373, in
main()
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 350, in main
unpickled = load_tf_models_file(args.input)
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 50, in load_tf_models_file
return Unpickler(fp).load()
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 45, in find_class
return super(Unpickler, self).find_class(module, name)
ModuleNotFoundError: No module named 'torch_utils'

My environment is cu101+torch1.7.1+tensorboard2.3.0
Please remind me if there is any information that is not enough, thanks a lot!

@adriansahlman
Copy link
Owner

Hey!

It seems like the model you are trying to use is from https://github.com/NVlabs/stylegan2-ada-pytorch and not the original tensorflow repo that the conversion tool was designed for.
I am sorry but these models are not supported by the current script as the repo I linked did not exist when I created this code!

@gzhhhere
Copy link

Hi, thank you very much for sharing. Due to the limitation of the GPU, I'm going to use "run_convert_from_tf.py" to transpose a 512x512 pre-trained model of stylegan2, which I got from https://catalog.ngc.nvidia.com/orgs/nvidia/teams/research/models/stylegan2 to download "stylegan2-ffhq-512x512.pkl", then I would like to try to conversion, but it failed, reporting the following error code.

Traceback (most recent call last):
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 373, in
main()
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 350, in main
unpickled = load_tf_models_file(args.input)
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 50, in load_tf_models_file
return Unpickler(fp).load()
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 45, in find_class
return super(Unpickler, self).find_class(module, name)
ModuleNotFoundError: No module named 'torch_utils'

My environment is cu101+torch1.7.1+tensorboard2.3.0 Please remind me if there is any information that is not enough, thanks a lot!

have you solve the problem? i got the same question.

@adriansahlman
Copy link
Owner

have you solve the problem? i got the same question.

The model you are trying to convert is not from the original tensorflow repo and thus will not work with this code

@a656418zz
Copy link
Author

Hi, thank you very much for sharing. Due to the limitation of the GPU, I'm going to use "run_convert_from_tf.py" to transpose a 512x512 pre-trained model of stylegan2, which I got from https://catalog.ngc.nvidia.com/orgs/nvidia/teams/research/models/stylegan2 to download "stylegan2-ffhq-512x512.pkl", then I would like to try to conversion, but it failed, reporting the following error code.

Traceback (most recent call last):
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 373, in
main()
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 350, in main
unpickled = load_tf_models_file(args.input)
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 50, in load_tf_models_file
return Unpickler(fp).load()
File "D:/PythonProject/StyleGAN/stylegan2_pytorch-adriansahlman/run_convert_from_tf.py", line 45, in find_class
return super(Unpickler, self).find_class(module, name)
ModuleNotFoundError: No module named 'torch_utils'

My environment is cu101+torch1.7.1+tensorboard2.3.0 Please remind me if there is any information that is not enough, thanks a lot!

have you solve the problem? i got the same question.

Unfortunately, because of adriansahlman‘s architecture, only the model he provides can be converted, the model of StyleGAN2-ada is newly generated and cannot be converted. But only the G model will not actually take up that much cuda memory, so I just generate 1080x1080 images and resize them

@a656418zz
Copy link
Author

Hey!

It seems like the model you are trying to use is from https://github.com/NVlabs/stylegan2-ada-pytorch and not the original tensorflow repo that the conversion tool was designed for. I am sorry but these models are not supported by the current script as the repo I linked did not exist when I created this code!

Thanks for your help!

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