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

Error(s) in loading state_dict for SwinIR #138

Open
zjttfs opened this issue Apr 12, 2023 · 5 comments
Open

Error(s) in loading state_dict for SwinIR #138

zjttfs opened this issue Apr 12, 2023 · 5 comments

Comments

@zjttfs
Copy link

zjttfs commented Apr 12, 2023

CLI

python main_test_swinir.py --task real_sr --scale 2 --large_model --model_path experiments/pretrained_models/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth --folder_lq /www/handle/205/run/ --folder_gt /www/result/205

Result

loading model from experiments/pretrained_models/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth
Traceback (most recent call last):
  File "main_test_swinir.py", line 309, in <module>
    main()
  File "main_test_swinir.py", line 44, in main
    model = define_model(args)
  File "main_test_swinir.py", line 190, in define_model
    model.load_state_dict(pretrained_model[param_key_g] if param_key_g in pretrained_model.keys() else pretrained_model, strict=True)
  File "/usr/local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1223, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for SwinIR:
        Unexpected key(s) in state_dict: "conv_up2.weight", "conv_up2.bias". 

PIP

Package            Version
------------------ ---------
backcall           0.2.0
certifi            2022.12.7
charset-normalizer 3.1.0
decorator          5.1.1
idna               3.4
ipython            7.19.0
jedi               0.18.2
numpy              1.19.4
opencv-python      4.4.0.46
parso              0.8.3
pexpect            4.8.0
pickleshare        0.7.5
Pillow             8.3.2
pip                22.0.4
prompt-toolkit     3.0.38
ptyprocess         0.7.0
Pygments           2.15.0
requests           2.28.2
setuptools         57.5.0
timm               0.4.12
torch              1.8.0
torchvision        0.9.0
tqdm               4.62.2
traitlets          5.9.0
typing_extensions  4.5.0
urllib3            1.26.15
wcwidth            0.2.6
wheel              0.40.0

OS

docker python 3.8.16-slim
VGA compatible controller: NVIDIA Corporation GA106 [GeForce RTX 3060 Lite Hash Rate] (rev a1)
I don't know how to program, please help me.
@dejl
Copy link

dejl commented Apr 15, 2023

Same issue here..

@lapentab
Copy link

lapentab commented Aug 6, 2023

Same issue here

@NightNightNight
Copy link

NightNightNight commented Sep 6, 2023

解决了吗?

@NightNightNight
Copy link

解决了吗?

应该是scale不能设置成2

@ShangweiGuo
Copy link

Same issue here

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

5 participants