Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用给的预训练模型进行测试报错 #64

Open
ziFan99 opened this issue Nov 11, 2024 · 1 comment
Open

使用给的预训练模型进行测试报错 #64

ziFan99 opened this issue Nov 11, 2024 · 1 comment

Comments

@ziFan99
Copy link

ziFan99 commented Nov 11, 2024

作者你好,我使用链接进行下载的预训练权重进行测试,报如下错误,我想问一下这个是预训练模型本身的错误还是我哪里出错了?希望作者可以抽空解答一下我的疑惑。

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".

@INVOKERer
Copy link
Owner

INVOKERer commented Nov 11, 2024

是否有完整的报错?如果无法解决可以尝试AAAI23分支

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants