Closed hanoonaR closed 2 years ago
hi @hanoonaR , thanks for the comment. In the save_checkpoint function, the models are saved as a dictionary.
save_dict = {"epoch": epoch, "best_acc": best_acc, "state_dict": state_dict}
The "state_dict" should be the model weights. Not sure whether is the key-value problem for Torchscript conversion. Will continue verify this. Thanks.
Hi,
I am facing an issue in evaluating the UNETR models trained with the repository. I saw there was a previous issue that raised the same problem: https://github.com/Project-MONAI/research-contributions/issues/46.
The models trained with the code base could not be evaluated with
test.py
becausetorch.jit.load(pretrained_pth)
throws the error "RuntimeError: PytorchStreamReader failed locating file constants.pkl: file not found".The validation was performed as expected in the trainer.py. However the model saved using the function https://github.com/Project-MONAI/research-contributions/blob/2f881c602863c9556dcce9847ffecc4cac919eaf/UNETR/BTCV/trainer.py#L137 cannot be loaded using
torch.jit.load(pretrained_pth)
. How should the model be correctly saved?The torch and monai versions are exactly same as specified in the installation requirements.
Kindly suggest a solution. Thank you.