PE not getting updated at runtime when resolution is changed in v1.6.5
bug
### Search before asking
- [x] I have searched the RF-DETR issues and found no similar bug report.
### Bug
__init__
2026-04-30T09:28:15.205008636Z self.rfdetr = self._load_model(weights=self.model_weights, resolution=self.imgsz, device=self.device_by_name,
2026-04-30T09:28:15.205010320Z File "/app/cvblackjack/packages/common/backbone_architecture/rfdetr.py", line 402, in _load_model
2026-04-30T09:28:15.205011912Z model = Model(pretrain_weights=weights,
2026-04-30T09:28:15.205013301Z File "/usr/local/lib/python3.10/dist-packages/rfdetr/detr.py", line 382, in __init__
2026-04-30T09:28:15.205016450Z self.model = self.get_model(self.model_config)
2026-04-30T09:28:15.205018033Z File "/usr/local/lib/python3.10/dist-packages/rfdetr/detr.py", line 1027, in get_model
2026-04-30T09:28:15.205019621Z return _build_model_context(config)
2026-04-30T09:28:15.205021380Z File "/usr/local/lib/python3.10/dist-packages/rfdetr/detr.py", line 236, in _build_model_context
2026-04-30T09:28:15.205022988Z class_names = _load_pretrain_weights_into(nn_model, args)
2026-04-30T09:28:15.205024572Z File "/usr/local/lib/python3.10/dist-packages/rfdetr/detr.py", line 169, in _load_pretrain_weights_into
2026-04-30T09:28:15.205026147Z nn_model.load_state_dict(checkpoint["model"], strict=False)
2026-04-30T09:28:15.205027655Z File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 2629, in load_state_dict
2026-04-30T09:28:15.205029273Z raise RuntimeError(
2026-04-30T09:28:15.205030706Z RuntimeError: Error(s) in loading state_dict for LWDETR:
2026-04-30T09:28:15.205032695Z size mismatch for backbone.0.encoder.encoder.embeddings.position_embeddings: copying a param with shape torch.Size([1, 1297, 384]) from checkpoint, the shape in current model is torch.Size([1, 1765, 384]).
### Environment
RF-DETR v1.6.5
### Minimal Reproducible Example
Tried running the finetuned rfdetr- seg medium trained on my data with updated resolution of 552 , trained using package v1.6.4
then updated the package passed the custom resolution and got this runtime error of pe mismatch
which should have been taken care of internally according to rfdetr v1.6.5 change log
### Additional
_No response_
### Are you willing to submit a PR?
- [ ] Yes, I'd like to help by submitting a PR!
0 条评论