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

RuntimeError: Error(s) in loading state_dict for ConvNeXtV2: #33

Open
weihongwei-zg opened this issue Feb 18, 2023 · 5 comments
Open

RuntimeError: Error(s) in loading state_dict for ConvNeXtV2: #33

weihongwei-zg opened this issue Feb 18, 2023 · 5 comments

Comments

@weihongwei-zg
Copy link

criterion = LabelSmoothingCrossEntropy()
Traceback (most recent call last):
File "main_finetune.py", line 437, in
main(args)
File "main_finetune.py", line 351, in main
optimizer=optimizer, loss_scaler=loss_scaler, model_ema=model_ema)
File "/media/wangshuang/sdb/object_class/ConvNeXt-V2/utils.py", line 495, in auto_load_model
model_without_ddp.load_state_dict(checkpoint['model'])
File "/home/wangshuang/anaconda3/envs/yolov8/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1224, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for ConvNeXtV2:
Missing key(s) in state_dict: "downsample_layers.0.0.weight",

@weihongwei-zg
Copy link
Author

Why can we only use fine-tuning to evaluate the trained model after pre-training. And there will be errors when fine-tuning the evaluation and loading the model.

@weihongwei-zg
Copy link
Author

python main_pretrain.py --model convnextv2_base --batch_size 8 --update_freq 8 --blr 1.5e-4 --epochs 1600 --warmup_epochs 40 --data_path /media/wangshuang/sdb/object_class/dataset --output_dir /media/wangshuang/sdb/object_class/result

python main_finetune.py --model convnextv2_base --eval true --resume /media/wangshuang/sdb/object_class/result/checkpoint-157.pth --input_size 224 --data_path /media/wangshuang/sdb/object_class/dataset

@zermatt-luo
Copy link

criterion = LabelSmoothingCrossEntropy() Traceback (most recent call last): File "main_finetune.py", line 437, in main(args) File "main_finetune.py", line 351, in main optimizer=optimizer, loss_scaler=loss_scaler, model_ema=model_ema) File "/media/wangshuang/sdb/object_class/ConvNeXt-V2/utils.py", line 495, in auto_load_model model_without_ddp.load_state_dict(checkpoint['model']) File "/home/wangshuang/anaconda3/envs/yolov8/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1224, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for ConvNeXtV2: Missing key(s) in state_dict: "downsample_layers.0.0.weight",

Hello, may I ask if you have installed MinkowskiEngine? I tried to install from online tutorials, but the two py files MinkowskiDepthwiseConvolution and MinkowskiLinear are missing, and the rest are normal. Thanks

@zermatt-luo
Copy link

Hello, may I ask if you have installed MinkowskiEngine? I tried to install from online tutorials, but the two py files MinkowskiDepthwiseConvolution and MinkowskiLinear are missing, and the rest are normal. Thanks!

@MinJunKang
Copy link

@XuLuo121 I think you have to install MinkowskiEngine with the author's provided version here : https://github.com/shwoo93/MinkowskiEngine/tree/5f459408e054933327873b29f1287275f3af6375

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

3 participants