🚀[FEA]: allow renaming state-dict keys in from_checkpoint when loading backward-compatible checkpoints
@CharlelieLrt is already working on this.
Since Oct 23, 2025.
- Dominant language
- Python
- Stars
- 3.3k
- Forks
- 787
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
Is this a new feature, an improvement, or a change to existing functionality?
New Feature
How would you describe the priority of this feature request
Critical (currently preventing usage)
Please provide a clear description of problem you would like to solve.
Problem
As reported by @nbren12 the backward compatibility feature allows to rename arguments passed to the constructor when loading an older checkpoint version with from_checkpoint. However, it does not allow to rename saved state_dict keys, which is a common pattern when refactoring model implementations.
Solution
A nice addition to the backward compatibility feature of from_checkpoint would be to be able to map an old_key in the saved state_dict, to a new key in the state_dict of the current model version. Ideally, we would like the mapping to be version-aware, that is, it can adapt the key mapping between the sourfce and target keys based on the Module version.
Describe any alternatives you have considered
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.