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

在转变参数之后 #7

Open
yeqingmei123 opened this issue Apr 21, 2022 · 6 comments
Open

在转变参数之后 #7

yeqingmei123 opened this issue Apr 21, 2022 · 6 comments

Comments

@yeqingmei123
Copy link

为什么会出现新的问题呢
swap_layer = 10
Traceback (most recent call last):
File "demo/quick_try.py", line 253, in
main()
File "demo/quick_try.py", line 242, in main
style_image = testor.run(args.img_path, args.style, args.swap_layer)
File "/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py", line 15, in decorate_context
return func(*args, **kwargs)
File "demo/quick_try.py", line 212, in run
if swap_layer > 0 else _swap_layer[style])
File "demo/quick_try.py", line 192, in layerSwap
randomize_noise=False)
File "/content/MMGEN-FaceStylor/MMGEN-FaceStylor/agilegan/architectures/ADAStyleGAN2/generator_discriminator.py", line 200, in swap_forward
return img, save_swap_layer
UnboundLocalError: local variable 'save_swap_layer' referenced before assignment

这是什么问题啊

@mm-assistant
Copy link

mm-assistant bot commented Apr 21, 2022

Please use English or English & Chinese for issues so that we could have broader discussion.

@yeqingmei123
Copy link
Author

在改变参数之后,
为什么运行结果会报上面的错呀

@yeqingmei123
Copy link
Author

when ichange the" swap_layer = 10", in the colab, there are some errors showing ,like
Traceback (most recent call last):
File "demo/quick_try.py", line 253, in
main()
File "demo/quick_try.py", line 242, in main
style_image = testor.run(args.img_path, args.style, args.swap_layer)
File "/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py", line 15, in decorate_context
return func(*args, **kwargs)
File "demo/quick_try.py", line 212, in run
if swap_layer > 0 else _swap_layer[style])
File "demo/quick_try.py", line 192, in layerSwap
randomize_noise=False)
File "/content/MMGEN-FaceStylor/MMGEN-FaceStylor/agilegan/architectures/ADAStyleGAN2/generator_discriminator.py", line 200, in swap_forward
return img, save_swap_layer
UnboundLocalError: local variable 'save_swap_layer' referenced before assignment
how to fix it!!

@plyfager
Copy link
Collaborator

plyfager commented Apr 22, 2022

Hi @yeqingmei123, Thx for your interest. swap_layer is not supposed to be larger than 7. You can try a smaller number. I will fix this bug later.

@yeqingmei123
Copy link
Author

hello ,i meet another question,when i first to run this sentence,it has a result ,but when i run it again,it has this error,
i can't find a solution ,please give me a help! thx

!python demo/quick_try.py demo/src.png --style toonify --save-path demo/src_output1.png

File "/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py", line 45, in build_from_cfg
f'{obj_type} is not in the {registry.name} registry')
KeyError: 'ADAStyleGAN2Discriminator is not in the module registry'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "demo/quick_try.py", line 253, in
main()
File "demo/quick_try.py", line 240, in main
transfer_ckpt=os.path.join(args.ckpt_path, transfer_ckpt_name))
File "demo/quick_try.py", line 121, in init
device='cpu').eval()
File "/content/mmgeneration-0.6.0/mmgen/apis/inference.py", line 36, in init_model
config.model, train_cfg=config.train_cfg, test_cfg=config.test_cfg)
File "/content/mmgeneration-0.6.0/mmgen/models/builder.py", line 32, in build_model
return build(cfg, MODELS, dict(train_cfg=train_cfg, test_cfg=test_cfg))
File "/content/mmgeneration-0.6.0/mmgen/models/builder.py", line 27, in build
return build_from_cfg(cfg, registry, default_args)
File "/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py", line 55, in build_from_cfg
raise type(e)(f'{obj_cls.name}: {e}')
KeyError: "PSPTransfer: 'ADAStyleGAN2Discriminator is not in the module registry'"

@chy0315
Copy link

chy0315 commented Apr 19, 2023

你好,我遇到另外一个问题,第一次运行这句话的时候,有一个结果,但是当我再次运行的时候,出现了这个错误, 我找不到解决办法,请帮助我!谢谢

!python demo/quick_try.py demo/src.png --style toonify --save-path demo/src_output1.png

文件“/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py”,第 45 行,在 build_from_cfg f'{obj_type} 不在 {registry.name} 注册表中') KeyError: 'ADAStyleGAN2Discriminator is not in the module registry' 在处理上述异常的过程中,发生了另一个异常: Traceback(最近调用最后一次): 文件“demo/quick_try.py”,第 253 行,在 main() 文件“demo/quick_try.py”中。 py", line 240, in main transfer_ckpt=os.path.join(args.ckpt_path, transfer_ckpt_name)) File "demo/quick_try.py", line 121, in init device='cpu').eval() File "/ content/mmgeneration-0.6.0/mmgen/apis/inference.py”,第 36 行,在 init_model 中 config.model, train_cfg=config.train_cfg, test_cfg=config.test_cfg) 文件“/content/mmgeneration-0.6.0/mmgen/models/builder.py”, line 32, in build_model return build(cfg, MODELS, dict( train_cfg=train_cfg, test_cfg=test_cfg)) 文件“/content/mmgeneration-0.6.0/mmgen/models/builder.py”,第 27 行,在构建 返回 build_from_cfg(cfg, registry, default_args) 文件“/usr/local/ lib/python3.7/dist-packages/mmcv/utils/registry.py”,第 55 行,在 build_from_cfg 中 raise type(e)(f'{obj_cls.name } : {e}') KeyError: “PSPTransfer: 'ADAStyleGAN2Discriminator不在模块注册表中'”

Have you solved it? I also encountered the same problem.

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