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: The expanded size of the tensor (44) must match the existing size (64) at non-singleton dimension 0. Target sizes: [44]. Tensor sizes: [64] #10

Open
lzylzylzy123456 opened this issue Mar 12, 2024 · 1 comment

Comments

@lzylzylzy123456
Copy link

Firstly, I adjusted the configuration file according to the requirements and did 15+5 incremental learning. Then, I used Python tools/train_first_step. py -- config file="./configurations/e2e'faster_rcnnR_50-C4_1x. yaml" to complete the training of the basic model. However, when I used Python tools/train_increatual.py for incremental learning training, an error occurred:
Traceback (most recent call last):
File "tools/train_incremental.py", line 306, in
main()
File "tools/train_incremental.py", line 300, in main
model_target = train(cfg_source, logger_source, cfg_target, logger_target, distributed)
File "tools/train_incremental.py", line 182, in train
extra_checkpoint_data_source = checkpointer_source.load(cfg_source.MODEL.WEIGHT)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/checkpoint.py", line 62, in load
self._load_model(checkpoint)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/checkpoint.py", line 99, in _load_model
load_state_dict(self.model, checkpoint.pop("model"))
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/model_serialization.py", line 88, in load_state_dict
align_and_update_state_dicts(model_state_dict, loaded_state_dict)
File "/home/dgp/code/maskrcnn-benchmark/maskrcnn_benchmark/utils/model_serialization.py", line 55, in align_and_update_state_dicts
model_state_dict[key][:loaded_size[0]] = loaded_state_dict[key_old]
RuntimeError: The expanded size of the tensor (44) must match the existing size (64) at non-singleton dimension 0. Target sizes: [44]. Tensor sizes: [64]
How can I solve this problem? @CanPeng123

@lzylzylzy123456
Copy link
Author

Sorry, I found the problem

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

1 participant