How do you know if a Pytorch Save contains a model and/or just the weights?
I'm fairly new to pytorch and this might be a version issue, but I see torch.load and torch.load_state_dict used, but in both cases the file extension is commonly &quot;.pth&quot;
Models that I have created, I can Save and Load them via torch.Save and torch.Load and call model.eval()
I have another model file that I'm fairly sure is just the state dictionary, as model.eval() fails after a load.
How would I inspect the file and know that one has a full model in it?
Thanks much.

As far as I know there isn't a foolproof way to figure this out. torch.save uses Python's pickle under the hood (ref: Pytorch docs), so users can save arbitrary Python objects. For example, the following code wraps the state dicts in a dictionary:
# example from https://github.com/lucidrains/lightweight-gan/blob/fce20938562a0cc289c915f7317722a8241abd37/lightweight_gan/lightweight_gan.py#L1437
save_data = {
    'GAN': self.GAN.state_dict(),
    'version': __version__,
    'G_scaler': self.G_scaler.state_dict(),
    'D_scaler': self.D_scaler.state_dict()
}
torch.save(save_data, self.model_name(num))

If it helps, state dicts themselves are OrderedDict objects. If isinstance(model, collections.OrderedDict) returns True, you can be fairly confident that model is a state dict. (Remember to import collections)
Models themselves are subclasses of torch.nn.Module, so you can check if something is a model by verifying that isinstance(model, torch.nn.Module) returns True.
