rosinality / stylegan2-pytorch

Implementation of Analyzing and Improving the Image Quality of StyleGAN (StyleGAN 2) in PyTorch
MIT License
2.74k stars 623 forks source link

no module named 'dnnlib' #268

Open gzhhhere opened 2 years ago

gzhhhere commented 2 years ago

image image i try to 'pip install dnnlib' but failed. what should i do QAQ.

gzhhhere commented 2 years ago

oh, maybe i should install tensorflow

gzhhhere commented 2 years ago

installed tensorflow 2.6.0, still no module named dnnlib.

gzhhhere commented 2 years ago

i saw 'You need to clone official repositories, (https://github.com/NVlabs/stylegan2) as it is requires for load official checkpoints.'

gzhhhere commented 2 years ago

i used docker by 'docker pull nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04' and ' pip3 install tensorflow-gpu==1.14.0 scipy==1.3.3 requests==2.22.0 Pillow==6.2.1 h5py==2.9.0 imageio==2.9.0 imageio-ffmpeg==0.4.2 tqdm==4.49.0 torch==1.4.0 torchvision==0.5.0 pandas numpy pillow==6.2.1 opencv-python scikit-learn matplotlib seaborn jupyterlab ninja' but when i try to run convert_weight.py' i got ' Traceback (most recent call last): File "convert_weight.py", line 236, in generator, discriminator, g_ema = pickle.load(f) ModuleNotFoundError: No module named 'torch_utils''

rosinality commented 2 years ago

I think you have used checkpoints from stylegan2-ada-pytorch. Currently convert_weight.py does not support pytorch version of checkpoints.

gzhhhere commented 2 years ago

Thanks for your attention, what i try to convert is the 'stylegan2-celebahq-256x256.pkl' which is downloaded from https://catalog.ngc.nvidia.com/orgs/nvidia/teams/research/models/stylegan2/files.

By the way image is the file structure right? i put your repositories in stylegan2 repositories, and i cd into your repositories and put the .pkl in your repositories then run 'python convert_weight.py --repo /home/....../stylegan2 stylegan2-celebahq-256x256.pkl'

rosinality commented 2 years ago

Yes, it is right.

gzhhhere commented 2 years ago

Yes, it is right.

when i try to convert 'stylegan2-celebahq-256x256.pkl' i have ' File "convert_weight.py", line 236, in generator, discriminator, g_ema = pickle.load(f) ModuleNotFoundError: No module named 'torch_utils' when i try to conver 'stylegan2-ffhq-1024x1024.pkl' i have Traceback (most recent call last): File "convert_weight.py", line 230, in import dnnlib ModuleNotFoundError: No module named 'dnnlib'

they are all download from https://catalog.ngc.nvidia.com/orgs/nvidia/teams/research/models/stylegan2/files.

i think they are not ada weight, there should be some 'directories error'....

rosinality commented 2 years ago

It seems like that it is for stylegan3. Currently it is not supported.

gzhhhere commented 2 years ago

It seems like that it is for stylegan3. Currently it is not supported.

you are right, the weight from https://nvlabs-fi-cdn.nvidia.com/stylegan2/networks/ is converable using your code, however, i still can't get the ''stylegan2-celebahq.pt''. Thanks for your attention again!

alinacccc commented 2 years ago

Have u solved this problem? I also encounterred this problem,and i download the code of stylegan2 from github named stylegan2-pytorch-master,have u use this one?

49xxy commented 2 years ago

我认为您使用了 stylegan2-ada-pytorch 中的检查点。目前convert_weight.py不支持 pytorch 版本的检查点。

Can you support it now,please?

cavalier501 commented 1 year ago

https://github.com/podgorskiy/dnnlib this may help

gmindflow commented 1 year ago

This solved the issue, not getting it anymore. Thanks!

zimenglan-sysu-512 commented 1 year ago

hi @gmindflow how dit u solve it?

gmindflow commented 1 year ago

It's been a while since a I met this issue 2months ago so can't remember exactly but I ran: pip install https://github.com/podgorskiy/dnnlib/releases/download/0.0.1/dnnlib-0.0.1-py3-none-any.whl and it solved the error that I was having at that time!

maeri18 commented 10 months ago

It's been a while since a I met this issue 2months ago so can't remember exactly but I ran: pip install https://github.com/podgorskiy/dnnlib/releases/download/0.0.1/dnnlib-0.0.1-py3-none-any.whl and it solved the error that I was having at that time!

It worked for me. Thankssss

BCXNSD commented 10 months ago

It's been a while since a I met this issue 2months ago so can't remember exactly but I ran: pip install https://github.com/podgorskiy/dnnlib/releases/download/0.0.1/dnnlib-0.0.1-py3-none-any.whl and it solved the error that I was having at that time!

god bless you! you are so gorgeous!