ckkelvinchan / RealBasicVSR

Official repository of "Investigating Tradeoffs in Real-World Video Super-Resolution"
Apache License 2.0
906 stars 136 forks source link

KeyError: 'UNetDiscriminatorWithSpectralNorm is already registered in component' #6

Closed sunyuxiu closed 2 years ago

sunyuxiu commented 2 years ago

Hi,when I run the program of "Video as input and output" and meet the problem in title.What is the solution to this problem?

sunyuxiu commented 2 years ago

Hi,when I run the program of "Video as input and output" and meet the problem in title.What is the solution to this problem?

After I downloaded the pre-train-weight and test the video.

ckkelvinchan commented 2 years ago

Did you follow the installation instructions, and did you modify the code? I just tried and there is no problem on my side.

sunyuxiu commented 2 years ago

from realbasicvsr.models.builder import build_model Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/RealBasicVSR-master/realbasicvsr/models/init.py", line 2, in from .components import UNetDiscriminatorWithSpectralNorm File "/home/ubuntu/RealBasicVSR-master/realbasicvsr/models/components/init.py", line 1, in from .unet_disc import UNetDiscriminatorWithSpectralNorm File "/home/ubuntu/RealBasicVSR-master/realbasicvsr/models/components/unet_disc.py", line 9, in class UNetDiscriminatorWithSpectralNorm(nn.Module): File "/home/ubuntu/anaconda3/envs/test/lib/python3.6/site-packages/mmcv/utils/registry.py", line 312, in _register module_class=cls, module_name=name, force=force) File "/home/ubuntu/anaconda3/envs/test/lib/python3.6/site-packages/mmcv/utils/registry.py", line 246, in _register_module raise KeyError(f'{name} is already registered ' KeyError: 'UNetDiscriminatorWithSpectralNorm is already registered in component' I install the package and the envrionment as in the installations,including the pytorch,openmim,mmcv-full and mmedit.It is Ok to run in python.I didn't modify the code,either. Sorry,I still can not find where is error.Here is the keyerror message.Is there the mmcv has some problem?

ckkelvinchan commented 2 years ago

What do you mean by "It is ok to run in Python"?

You can also take a look at the Colab demo. It can be run normally.

sunyuxiu commented 2 years ago

I install successful the mim,mmcv-full and mmedit.

ckkelvinchan commented 2 years ago

I am sorry that I still could not reproduce your error. Could you try directly on Python in terminal and type from realbasicvsr.models.builder import build_model?

sunyuxiu commented 2 years ago

When I run on python terminal and type from realbasicvsr.models.builder import build_model,I got the following information: >>> from realbasicvsr.models.builder import build_model Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/ubuntu/RealBasicVSR-master/realbasicvsr/models/__init__.py", line 2, in <module> from .components import UNetDiscriminatorWithSpectralNorm File "/home/ubuntu/RealBasicVSR-master/realbasicvsr/models/components/__init__.py", line 1, in <module> from .unet_disc import UNetDiscriminatorWithSpectralNorm File "/home/ubuntu/RealBasicVSR-master/realbasicvsr/models/components/unet_disc.py", line 9, in <module> class UNetDiscriminatorWithSpectralNorm(nn.Module): File "/home/ubuntu/anaconda3/envs/test/lib/python3.6/site-packages/mmcv/utils/registry.py", line 312, in _register module_class=cls, module_name=name, force=force) File "/home/ubuntu/anaconda3/envs/test/lib/python3.6/site-packages/mmcv/utils/registry.py", line 246, in _register_module raise KeyError(f'{name} is already registered ' KeyError: 'UNetDiscriminatorWithSpectralNorm is already registered in component'

batectin commented 2 years ago

This probably because of your pip environment. The mmedit package will clash with the mmediting to be specific (if you run both of them under the same env). Simply just remove and reinstall mmedit will solve. Note that do it outside of the mmediting folder

sunyuxiu commented 2 years ago

This probably because of your pip environment. The mmedit package will clash with the mmediting to be specific (if you run both of them under the same env). Simply just remove and reinstall mmedit will solve. Note that do it outside of the mmediting folder

As you said, I uninstalled mmedit first, and then reinstalled mmedit. When I ran it again, it worked.Thanks!