I have the following code to print the model summary of a previously saved model:
import torch
model = torch.load('results/model_best.pth.tar')
print(model) # works
from torchsummary import summary
summary(model, (3, 224, 224)) # error
The print method works okay, but the summary method has the following error:
Traceback (most recent call last):
File "ModelSummary.py", line XX, in <module>
summary(model, (3, 224, 224))
File "anaconda3/lib/python3.8/site-packages/torchsummary/torchsummary.py", line 68, in summary
model.apply(register_hook)
AttributeError: 'dict' object has no attribute 'apply'
How to rectify this? (I tried the summary method on a model from torchvision database. It worked okay).
Thank you.