Giter VIP home page Giter VIP logo

Comments (5)

JingyunLiang avatar JingyunLiang commented on May 7, 2024 1

The main difference between my pretrained model and yours (trained on KAIR) is that:
1, my pretrained model is a dict: {'params': model}.
2, KAIR's model is just the model.

Therefore, you have to use the following line to load my pretrained model:

model.load_state_dict(torch.load(args.model_path)['params'], strict=True) # specify the dict key

and the following line to load your trained model (on KAIR)

model.load_state_dict(torch.load(args.model_path), strict=True) # directly load it

Sorry for the inconsistence between KAIR and SwinIR testing code. We will fix this problem.

from swinir.

JingyunLiang avatar JingyunLiang commented on May 7, 2024

Hi, sorry for this bug. Please remove ['params'] in Line 126

model.load_state_dict(torch.load(args.model_path)['params'], strict=True)

as

model.load_state_dict(torch.load(args.model_path), strict=True). 

from swinir.

hcleung3325 avatar hcleung3325 commented on May 7, 2024

Hi, sorry for this bug. Please remove ['params'] in Line 126

model.load_state_dict(torch.load(args.model_path)['params'], strict=True)

as

model.load_state_dict(torch.load(args.model_path), strict=True). 

Thanks for reply.
I notice that when I ran your pretrained model, the main_test_swinir.py works fine.
However, when I ran main_test_swinir.py with either 500000_optimizerG.pth 500000_G.pth 500000_E.pth, it occurs the above error.
Is it the 500000_G.pth has some problem?

from swinir.

JingyunLiang avatar JingyunLiang commented on May 7, 2024

Update: I have fixed the bug.

from swinir.

hcleung3325 avatar hcleung3325 commented on May 7, 2024

Thanks a lot.

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.