Comments (6)
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.
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.
Thanks for your question. See the cszn's answer.
from swinir.
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.
Ref to #20 (comment)
We will try to fix this inconsistency later.
from swinir.
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)
- Colab notebook error
- About self-ensemble strategy
- not compatible with the latest cog version
- Did you train SwinIR on DIV test set?
- How to disable using two GPUs for training?
- only 1 swin layer in the RSTB module?
- It seems SwinIR doesn't use patch merging. HOT 2
- Loading pretrained weight achiving not accurate result HOT 1
- Error(s) in loading state_dict for SwinIR HOT 5
- Inquiry about patch embedding HOT 4
- 关于X8的测试集
- JPEG Artifact Removal window size
- Transfer Learning with SWINIR model
- Artifact SWINIR (training Model as Generator GAN) HOT 1
- dynamic shape inference with onnx model HOT 1
- The noise removal command eats up my entire RAM and then gets killed HOT 5
- Load model takes forever
- SWINIR as Generator in GAN : Real world
- Unable to load pretrained model
- change the video card to run on the site replicate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swinir.