Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track only Stateful objects and not classes (#827)
Summary: Pull Request resolved: #827 `torchtnt.framework.callbacks.meta.model_store_checkpointer.ModelStoreCheckpointer` fails when a checkpointed unit contains an attribute which is a class (not a an object) implementing the `Stateful` interface. This is a typical case when a user specifies a type of an optimizer in an `AutoUnit` which is instantiated later in `AutoUnit.configure_optimizers_and_lr_scheduler`. The specific reason why the checkpointer fails is that this attribute then gets tracked because `isinstance(torch.optim.Optimizer, Stateful)` returns `True`. `MultiStateful` then tries to call `state_dict` on that attribute which fails because the attribute is not an object of a class. Reviewed By: JKSenthil Differential Revision: D57159095 fbshipit-source-id: 9224193f63803fa139c26553ff6090cd6ac9886d
- Loading branch information