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

no module named 'dnnlib'

Open gzhhhere opened this issue 3 years ago • 18 comments

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

gzhhhere avatar Nov 19 '21 08:11 gzhhhere

oh, maybe i should install tensorflow

gzhhhere avatar Nov 19 '21 08:11 gzhhhere

installed tensorflow 2.6.0, still no module named dnnlib.

gzhhhere avatar Nov 19 '21 08:11 gzhhhere

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

gzhhhere avatar Nov 19 '21 09:11 gzhhhere

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''

gzhhhere avatar Nov 19 '21 13:11 gzhhhere

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

rosinality avatar Nov 20 '21 00:11 rosinality

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'

gzhhhere avatar Nov 20 '21 06:11 gzhhhere

Yes, it is right.

rosinality avatar Nov 20 '21 12:11 rosinality

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'....

gzhhhere avatar Nov 20 '21 12:11 gzhhhere

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

rosinality avatar Nov 20 '21 14:11 rosinality

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!

gzhhhere avatar Nov 21 '21 12:11 gzhhhere

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?

alinacccc avatar Jun 16 '22 07:06 alinacccc

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

Can you support it now,please?

49xxy avatar Jun 21 '22 07:06 49xxy

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

gmindflow avatar Jul 09 '23 12:07 gmindflow

hi @gmindflow how dit u solve it?

zimenglan-sysu-512 avatar Aug 31 '23 09:08 zimenglan-sysu-512

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!

gmindflow avatar Aug 31 '23 13:08 gmindflow

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

maeri18 avatar Jan 04 '24 10:01 maeri18

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!

BCXNSD avatar Jan 08 '24 07:01 BCXNSD