Skip to content

Checkpoint loading doesn't work if object doesn't contain a torch.nn.Module #2479

@KevinMusgrave

Description

@KevinMusgrave

🐛 Bug description

Running the following code:

from ignite.handlers import Checkpoint
Checkpoint.load_objects(to_load=to_load, checkpoint=checkpoint)

results in the following error:

load_state_dict() got an unexpected keyword argument 'strict'

if to_load doesn't contain a torch.nn.Module.

For example, {"optimizer": optimizer} fails, but {"model": torch.nn.Linear(10, 10)} succeeds.

Notebook to reproduce

https://colab.research.google.com/drive/1G-iVC-ixMQrw90AEp5mDuSjxUAPyO8YF?usp=sharing

Environment

Run on google colab with:
torch version 1.10.0+cu111
ignite version 0.4.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions