Giter Club home page Giter Club logo

Comments (6)

JingyunLiang avatar JingyunLiang commented on May 4, 2024 2

Change

network.load_state_dict(torch.load(load_path), strict=strict)

to

network.load_state_dict(torch.load(load_path)['params_ema'], strict=strict)

at https://github.com/cszn/KAIR/blob/7d70f91bb7c03d8795a6bed29ee17b1c6b834e4e/models/model_base.py#L160.

Note: this is just a temporary solution (may result in problems for other experiments). We will solve this problem with a better solution later.

from swinir.

cszn avatar cszn commented on May 4, 2024 1

You should change the file name 003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth into 5000_G.pth, and then put it into /superresolution/swinir_sr_realworld_x4_gan/models

from swinir.

JingyunLiang avatar JingyunLiang commented on May 4, 2024

Thanks for your question. See the cszn's answer.

from swinir.

betterftr avatar betterftr commented on May 4, 2024

Yes, i tried it gives a long error ending with : Unexpected key(s) in state_dict: "params_ema".

Loading model for G [D:/AI/KAIR/superresolution\swinir_sr_realworld_x4_gan\models\5000_G.pth] ...
Traceback (most recent call last):
File "main_train_psnr.py", line 248, in
main()
File "main_train_psnr.py", line 156, in main
model.init_train()
File "D:\AI\KAIR\models\model_gan.py", line 40, in init_train
self.load() # load model
File "D:\AI\KAIR\models\model_gan.py", line 56, in load
self.load_network(load_path_G, self.netG, strict=self.opt_train['G_param_strict'])
File "D:\AI\KAIR\models\model_base.py", line 160, in load_network
network.load_state_dict(torch.load(load_path), strict=strict)
File "D:\CONDA\envs\real\lib\site-packages\torch\nn\modules\module.py", line 1052, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for SwinIR:

from swinir.

JingyunLiang avatar JingyunLiang commented on May 4, 2024

Ref to #20 (comment)

We will try to fix this inconsistency later.

from swinir.

betterftr avatar betterftr commented on May 4, 2024

Okay, can you tell me what line to change? The referred solution is for main_test_swinir.py not for training code from KAIR

from swinir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.