colorjam / PAMS

PArameterized Max Scale
57 stars 12 forks source link

Something wrong about the pretrained models #1

Closed YDDDDG closed 3 years ago

YDDDDG commented 3 years ago

Hi,

I tried to test the pre-trained model downloaded from google drive and something wrong happened.

I ran the following code in the terminal:

python main.py --scale 4 --model EDSR --k_bits 8 --save_results --test_only --data_test Set5+Set14+B100+Urban100 --refine ./pretrained/8bit_edsr_x4.pt.tar --save "output/edsr_x4/8bit" --dir_data G:\\Computer\\Datasets which was copied from run.sh

and a RuntimeError happened as follow

Traceback (most recent call last): File "main.py", line 274, in <module> main() File "main.py", line 259, in main s_model.load_state_dict(s_checkpoint) File "E:\Anaconda3\Anaconda\envs\Exp_tor_1_1_0\lib\site-packages\torch\nn\modules\module.py", line 777, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for PAMS_EDSR: Missing key(s) in state_dict: "body.0.quant_act1.alpha", "body.0.quant_act1.max_val", "body.0.quant_act2.alpha", "body.0.quant_act2.max_val", "body.0.quant_act3.alpha", "body.0.quant_act3.max_val", "body.0.body.2.max_val", "body.1.quant_act1 .alpha", "body.1.quant_act1.max_val", "body.1.quant_act2.alpha", "body.1.quant_act2.max_val", "body.1.quant_act3.alpha", "body.1.quant_act3.max_val", "body.1.body.2.max_val", "body.2.quant_act1.alpha", "body.2.quant_act1.max_val", "body.2.quant_act2 .alpha", "body.2.quant_act2.max_val", "body.2.quant_act3.alpha", "body.2.quant_act3.max_val", "body.2.body.2.max_val", "body.3.quant_act1.alpha", "body.3.quant_act1.max_val", "body.3.quant_act2.alpha", "body.3.quant_act2.max_val", "body.3.quant_act3 .alpha", "body.3.quant_act3.max_val", "body.3.body.2.max_val", "body.4.quant_act1.alpha", "body.4.quant_act1.max_val", "body.4.quant_act2.alpha", "body.4.quant_act2.max_val", "body.4.quant_act3.alpha", "body.4.quant_act3.max_val", "body.4.body.2.max _val", "body.5.quant_act1.alpha", "body.5.quant_act1.max_val", "body.5.quant_act2.alpha", "body.5.quant_act2.max_val", "body.5.quant_act3.alpha", "body.5.quant_act3.max_val", "body.5.body.2.max_val", "body.6.quant_act1.alpha", "body.6.quant_act1.max _val", "body.6.quant_act2.alpha", "body.6.quant_act2.max_val", "body.6.quant_act3.alpha", "body.6.quant_act3.max_val", "body.6.body.2.max_val", "body.7.quant_act1.alpha", "body.7.quant_act1.max_val", "body.7.quant_act2.alpha", "body.7.quant_act2.max _val", "body.7.quant_act3.alpha", "body.7.quant_act3.max_val", "body.7.body.2.max_val", "body.8.quant_act1.alpha", "body.8.quant_act1.max_val", "body.8.quant_act2.alpha", "body.8.quant_act2.max_val", "body.8.quant_act3.alpha", "body.8.quant_act3.max _val", "body.8.body.2.max_val", "body.9.quant_act1.alpha", "body.9.quant_act1.max_val", "body.9.quant_act2.alpha", "body.9.quant_act2.max_val", "body.9.quant_act3.alpha", "body.9.quant_act3.max_val", "body.9.body.2.max_val", "body.10.quant_act1.alph a", "body.10.quant_act1.max_val", "body.10.quant_act2.alpha", "body.10.quant_act2.max_val", "body.10.quant_act3.alpha", "body.10.quant_act3.max_val", "body.10.body.2.max_val", "body.11.quant_act1.alpha", "body.11.quant_act1.max_val", "body.11.quant_ act2.alpha", "body.11.quant_act2.max_val", "body.11.quant_act3.alpha", "body.11.quant_act3.max_val", "body.11.body.2.max_val", "body.12.quant_act1.alpha", "body.12.quant_act1.max_val", "body.12.quant_act2.alpha", "body.12.quant_act2.max_val", "body. 12.quant_act3.alpha", "body.12.quant_act3.max_val", "body.12.body.2.max_val", "body.13.quant_act1.alpha", "body.13.quant_act1.max_val", "body.13.quant_act2.alpha", "body.13.quant_act2.max_val", "body.13.quant_act3.alpha", "body.13.quant_act3.max_val ", "body.13.body.2.max_val", "body.14.quant_act1.alpha", "body.14.quant_act1.max_val", "body.14.quant_act2.alpha", "body.14.quant_act2.max_val", "body.14.quant_act3.alpha", "body.14.quant_act3.max_val", "body.14.body.2.max_val", "body.15.quant_act1. alpha", "body.15.quant_act1.max_val", "body.15.quant_act2.alpha", "body.15.quant_act2.max_val", "body.15.quant_act3.alpha", "body.15.quant_act3.max_val", "body.15.body.2.max_val". Unexpected key(s) in state_dict: "body.0.activation1.alpha", "body.0.activation2.alpha", "body.0.activation3.alpha", "body.1.activation1.alpha", "body.1.activation2.alpha", "body.1.activation3.alpha", "body.2.activation1.alpha", "body.2.acti vation2.alpha", "body.2.activation3.alpha", "body.3.activation1.alpha", "body.3.activation2.alpha", "body.3.activation3.alpha", "body.4.activation1.alpha", "body.4.activation2.alpha", "body.4.activation3.alpha", "body.5.activation1.alpha", "body.5.a ctivation2.alpha", "body.5.activation3.alpha", "body.6.activation1.alpha", "body.6.activation2.alpha", "body.6.activation3.alpha", "body.7.activation1.alpha", "body.7.activation2.alpha", "body.7.activation3.alpha", "body.8.activation1.alpha", "body. 8.activation2.alpha", "body.8.activation3.alpha", "body.9.activation1.alpha", "body.9.activation2.alpha", "body.9.activation3.alpha", "body.10.activation1.alpha", "body.10.activation2.alpha", "body.10.activation3.alpha", "body.11.activation1.alpha", "body.11.activation2.alpha", "body.11.activation3.alpha", "body.12.activation1.alpha", "body.12.activation2.alpha", "body.12.activation3.alpha", "body.13.activation1.alpha", "body.13.activation2.alpha", "body.13.activation3.alpha", "body.14.activat ion1.alpha", "body.14.activation2.alpha", "body.14.activation3.alpha", "body.15.activation1.alpha", "body.15.activation2.alpha", "body.15.activation3.alpha". size mismatch for body.0.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.1.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.2.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.3.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.4.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.5.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.6.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.7.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.8.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.9.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.10.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.11.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.12.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.13.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.14.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.15.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). It seems that the pre-trained model's parameters are different from the parameters defined in edsr.py . Did I ignore some important details? Or did you provide a model that doesn't match the current code?

Hoping you can reply as soon as possible, Thanks~

colorjam commented 3 years ago

Hi, @YDDDDG , We have updated the code and checkpoint, can you try the latest version again?

YDDDDG commented 3 years ago

I 'll try it later ,thank you!

------------------ 原始邮件 ------------------ 发件人: "colorjam/PAMS" <notifications@github.com>; 发送时间: 2020年12月2日(星期三) 晚上11:37 收件人: "colorjam/PAMS"<PAMS@noreply.github.com>; 抄送: "曾宇航"<1007687427@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [colorjam/PAMS] Something wrong about the pretrained models (#1)

Hi, @YDDDDG , We have updated the code checkpoint, can you try the latest version again?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

YDDDDG commented 3 years ago

Hi, @YDDDDG ,

We have updated the code and checkpoint, can you try the latest version again?

The new checkpoint works well,thanks!