Total: 9551088
Trainable: 9551088
/root/autodl-tmp/DeepRFT-main/utils/model_utils.py:39: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
checkpoint = torch.load(weights)
Traceback (most recent call last):
File "test.py", line 38, in
utils.load_checkpoint_compress_doconv(model_restoration, args.weights)
File "/root/autodl-tmp/DeepRFT-main/utils/model_utils.py", line 79, in load_checkpoint_compress_doconv
model.load_state_dict(do_state_dict)
File "/root/miniconda3/envs/DeepRFT/lib/python3.8/site-packages/torch/nn/modules/module.py", line 2215, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DeepRFT:
Missing key(s) in state_dict: "Encoder.0.layers.4.main.0.main.0.W", "Encoder.0.layers.4.main.1.main.0.W", "Encoder.0.layers.4.main_fft.0.main.0.W", "Encoder.0.layers.4.main_fft.1.main.0.W", "Encoder.0.layers.5.main.0.main.0.W", "Encoder.0.layers.5.main.1.main.0.W", "Encoder.0.layers.5.main_fft.0.main.0.W", "Encoder.0.layers.5.main_fft.1.main.0.W", "Encoder.0.layers.6.main.0.main.0.W", "Encoder.0.layers.6.main.1.main.0.W", "Encoder.0.layers.6.main_fft.0.main.0.W", "Encoder.0.layers.6.main_fft.1.main.0.W", "Encoder.0.layers.7.main.0.main.0.W", "Encoder.0.layers.7.main.1.main.0.W", "Encoder.0.layers.7.main_fft.0.main.0.W", "Encoder.0.layers.7.main_fft.1.main.0.W", "Encoder.1.layers.4.main.0.main.0.W", "Encoder.1.layers.4.main.1.main.0.W", "Encoder.1.layers.4.main_fft.0.main.0.W", "Encoder.1.layers.4.main_fft.1.main.0.W", "Encoder.1.layers.5.main.0.main.0.W", "Encoder.1.layers.5.main.1.main.0.W", "Encoder.1.layers.5.main_fft.0.main.0.W", "Encoder.1.layers.5.main_fft.1.main.0.W", "Encoder.1.layers.6.main.0.main.0.W", "Encoder.1.layers.6.main.1.main.0.W", "Encoder.1.layers.6.main_fft.0.main.0.W", "Encoder.1.layers.6.main_fft.1.main.0.W", "Encoder.1.layers.7.main.0.main.0.W", "Encoder.1.layers.7.main.1.main.0.W", "Encoder.1.layers.7.main_fft.0.main.0.W", "Encoder.1.layers.7.main_fft.1.main.0.W", "Encoder.2.layers.4.main.0.main.0.W", "Encoder.2.layers.4.main.1.main.0.W", "Encoder.2.layers.4.main_fft.0.main.0.W", "Encoder.2.layers.4.main_fft.1.main.0.W", "Encoder.2.layers.5.main.0.main.0.W", "Encoder.2.layers.5.main.1.main.0.W", "Encoder.2.layers.5.main_fft.0.main.0.W", "Encoder.2.layers.5.main_fft.1.main.0.W", "Encoder.2.layers.6.main.0.main.0.W", "Encoder.2.layers.6.main.1.main.0.W", "Encoder.2.layers.6.main_fft.0.main.0.W", "Encoder.2.layers.6.main_fft.1.main.0.W", "Encoder.2.layers.7.main.0.main.0.W", "Encoder.2.layers.7.main.1.main.0.W", "Encoder.2.layers.7.main_fft.0.main.0.W", "Encoder.2.layers.7.main_fft.1.main.0.W", "Decoder.0.layers.4.main.0.main.0.W", "Decoder.0.layers.4.main.1.main.0.W", "Decoder.0.layers.4.main_fft.0.main.0.W", "Decoder.0.layers.4.main_fft.1.main.0.W", "Decoder.0.layers.5.main.0.main.0.W", "Decoder.0.layers.5.main.1.main.0.W", "Decoder.0.layers.5.main_fft.0.main.0.W", "Decoder.0.layers.5.main_fft.1.main.0.W", "Decoder.0.layers.6.main.0.main.0.W", "Decoder.0.layers.6.main.1.main.0.W", "Decoder.0.layers.6.main_fft.0.main.0.W", "Decoder.0.layers.6.main_fft.1.main.0.W", "Decoder.0.layers.7.main.0.main.0.W", "Decoder.0.layers.7.main.1.main.0.W", "Decoder.0.layers.7.main_fft.0.main.0.W", "Decoder.0.layers.7.main_fft.1.main.0.W", "Decoder.1.layers.4.main.0.main.0.W", "Decoder.1.layers.4.main.1.main.0.W", "Decoder.1.layers.4.main_fft.0.main.0.W", "Decoder.1.layers.4.main_fft.1.main.0.W", "Decoder.1.layers.5.main.0.main.0.W", "Decoder.1.layers.5.main.1.main.0.W", "Decoder.1.layers.5.main_fft.0.main.0.W", "Decoder.1.layers.5.main_fft.1.main.0.W", "Decoder.1.layers.6.main.0.main.0.W", "Decoder.1.layers.6.main.1.main.0.W", "Decoder.1.layers.6.main_fft.0.main.0.W", "Decoder.1.layers.6.main_fft.1.main.0.W", "Decoder.1.layers.7.main.0.main.0.W", "Decoder.1.layers.7.main.1.main.0.W", "Decoder.1.layers.7.main_fft.0.main.0.W", "Decoder.1.layers.7.main_fft.1.main.0.W", "Decoder.2.layers.4.main.0.main.0.W", "Decoder.2.layers.4.main.1.main.0.W", "Decoder.2.layers.4.main_fft.0.main.0.W", "Decoder.2.layers.4.main_fft.1.main.0.W", "Decoder.2.layers.5.main.0.main.0.W", "Decoder.2.layers.5.main.1.main.0.W", "Decoder.2.layers.5.main_fft.0.main.0.W", "Decoder.2.layers.5.main_fft.1.main.0.W", "Decoder.2.layers.6.main.0.main.0.W", "Decoder.2.layers.6.main.1.main.0.W", "Decoder.2.layers.6.main_fft.0.main.0.W", "Decoder.2.layers.6.main_fft.1.main.0.W", "Decoder.2.layers.7.main.0.main.0.W", "Decoder.2.layers.7.main.1.main.0.W", "Decoder.2.layers.7.main_fft.0.main.0.W", "Decoder.2.layers.7.main_fft.1.main.0.W".
作者你好,我使用链接进行下载的预训练权重进行测试,报如下错误,我想问一下这个是预训练模型本身的错误还是我哪里出错了?希望作者可以抽空解答一下我的疑惑。
Total: 9551088 Trainable: 9551088 /root/autodl-tmp/DeepRFT-main/utils/model_utils.py:39: FutureWarning: You are using
utils.load_checkpoint_compress_doconv(model_restoration, args.weights)
File "/root/autodl-tmp/DeepRFT-main/utils/model_utils.py", line 79, in load_checkpoint_compress_doconv
model.load_state_dict(do_state_dict)
File "/root/miniconda3/envs/DeepRFT/lib/python3.8/site-packages/torch/nn/modules/module.py", line 2215, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DeepRFT:
Missing key(s) in state_dict: "Encoder.0.layers.4.main.0.main.0.W", "Encoder.0.layers.4.main.1.main.0.W", "Encoder.0.layers.4.main_fft.0.main.0.W", "Encoder.0.layers.4.main_fft.1.main.0.W", "Encoder.0.layers.5.main.0.main.0.W", "Encoder.0.layers.5.main.1.main.0.W", "Encoder.0.layers.5.main_fft.0.main.0.W", "Encoder.0.layers.5.main_fft.1.main.0.W", "Encoder.0.layers.6.main.0.main.0.W", "Encoder.0.layers.6.main.1.main.0.W", "Encoder.0.layers.6.main_fft.0.main.0.W", "Encoder.0.layers.6.main_fft.1.main.0.W", "Encoder.0.layers.7.main.0.main.0.W", "Encoder.0.layers.7.main.1.main.0.W", "Encoder.0.layers.7.main_fft.0.main.0.W", "Encoder.0.layers.7.main_fft.1.main.0.W", "Encoder.1.layers.4.main.0.main.0.W", "Encoder.1.layers.4.main.1.main.0.W", "Encoder.1.layers.4.main_fft.0.main.0.W", "Encoder.1.layers.4.main_fft.1.main.0.W", "Encoder.1.layers.5.main.0.main.0.W", "Encoder.1.layers.5.main.1.main.0.W", "Encoder.1.layers.5.main_fft.0.main.0.W", "Encoder.1.layers.5.main_fft.1.main.0.W", "Encoder.1.layers.6.main.0.main.0.W", "Encoder.1.layers.6.main.1.main.0.W", "Encoder.1.layers.6.main_fft.0.main.0.W", "Encoder.1.layers.6.main_fft.1.main.0.W", "Encoder.1.layers.7.main.0.main.0.W", "Encoder.1.layers.7.main.1.main.0.W", "Encoder.1.layers.7.main_fft.0.main.0.W", "Encoder.1.layers.7.main_fft.1.main.0.W", "Encoder.2.layers.4.main.0.main.0.W", "Encoder.2.layers.4.main.1.main.0.W", "Encoder.2.layers.4.main_fft.0.main.0.W", "Encoder.2.layers.4.main_fft.1.main.0.W", "Encoder.2.layers.5.main.0.main.0.W", "Encoder.2.layers.5.main.1.main.0.W", "Encoder.2.layers.5.main_fft.0.main.0.W", "Encoder.2.layers.5.main_fft.1.main.0.W", "Encoder.2.layers.6.main.0.main.0.W", "Encoder.2.layers.6.main.1.main.0.W", "Encoder.2.layers.6.main_fft.0.main.0.W", "Encoder.2.layers.6.main_fft.1.main.0.W", "Encoder.2.layers.7.main.0.main.0.W", "Encoder.2.layers.7.main.1.main.0.W", "Encoder.2.layers.7.main_fft.0.main.0.W", "Encoder.2.layers.7.main_fft.1.main.0.W", "Decoder.0.layers.4.main.0.main.0.W", "Decoder.0.layers.4.main.1.main.0.W", "Decoder.0.layers.4.main_fft.0.main.0.W", "Decoder.0.layers.4.main_fft.1.main.0.W", "Decoder.0.layers.5.main.0.main.0.W", "Decoder.0.layers.5.main.1.main.0.W", "Decoder.0.layers.5.main_fft.0.main.0.W", "Decoder.0.layers.5.main_fft.1.main.0.W", "Decoder.0.layers.6.main.0.main.0.W", "Decoder.0.layers.6.main.1.main.0.W", "Decoder.0.layers.6.main_fft.0.main.0.W", "Decoder.0.layers.6.main_fft.1.main.0.W", "Decoder.0.layers.7.main.0.main.0.W", "Decoder.0.layers.7.main.1.main.0.W", "Decoder.0.layers.7.main_fft.0.main.0.W", "Decoder.0.layers.7.main_fft.1.main.0.W", "Decoder.1.layers.4.main.0.main.0.W", "Decoder.1.layers.4.main.1.main.0.W", "Decoder.1.layers.4.main_fft.0.main.0.W", "Decoder.1.layers.4.main_fft.1.main.0.W", "Decoder.1.layers.5.main.0.main.0.W", "Decoder.1.layers.5.main.1.main.0.W", "Decoder.1.layers.5.main_fft.0.main.0.W", "Decoder.1.layers.5.main_fft.1.main.0.W", "Decoder.1.layers.6.main.0.main.0.W", "Decoder.1.layers.6.main.1.main.0.W", "Decoder.1.layers.6.main_fft.0.main.0.W", "Decoder.1.layers.6.main_fft.1.main.0.W", "Decoder.1.layers.7.main.0.main.0.W", "Decoder.1.layers.7.main.1.main.0.W", "Decoder.1.layers.7.main_fft.0.main.0.W", "Decoder.1.layers.7.main_fft.1.main.0.W", "Decoder.2.layers.4.main.0.main.0.W", "Decoder.2.layers.4.main.1.main.0.W", "Decoder.2.layers.4.main_fft.0.main.0.W", "Decoder.2.layers.4.main_fft.1.main.0.W", "Decoder.2.layers.5.main.0.main.0.W", "Decoder.2.layers.5.main.1.main.0.W", "Decoder.2.layers.5.main_fft.0.main.0.W", "Decoder.2.layers.5.main_fft.1.main.0.W", "Decoder.2.layers.6.main.0.main.0.W", "Decoder.2.layers.6.main.1.main.0.W", "Decoder.2.layers.6.main_fft.0.main.0.W", "Decoder.2.layers.6.main_fft.1.main.0.W", "Decoder.2.layers.7.main.0.main.0.W", "Decoder.2.layers.7.main.1.main.0.W", "Decoder.2.layers.7.main_fft.0.main.0.W", "Decoder.2.layers.7.main_fft.1.main.0.W".
torch.load
withweights_only=False
(the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value forweights_only
will be flipped toTrue
. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user viatorch.serialization.add_safe_globals
. We recommend you start settingweights_only=True
for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(weights) Traceback (most recent call last): File "test.py", line 38, in