Skip to content

[Feature request] Allow exceptions in load_state_dict #1990

@karandwivedi42

Description

@karandwivedi42

Currently, load_state_dict works only when the loaded state_dict and the Module's state_dict match exactly.

Problem: For the purpose of fine-tuning or for any slight change in the network, it is not straightforward to load the base layers, leaving one or two unchanged. Either we have to define the old network, load the state and then modify the network, or essentially rewrite the load_state_dict function.

Proposed Solution:

    def load_state_dict(self, state_dict, ignored_keys=None):

Can I create a PR for the same?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions