Hi, I’m trying to load torch model in Go code. I first tried to save torchscript in python.
... traced_model = torch.jit.trace(model, [input_ids, attention_mask], strict = False) traced_model.save(PATH + 'sentiment_model_jit.pt')
And when I try to load the saved torchscript in Go code, the console shows this error.
error in loading torch model: Libtorch API Error: version_ <= kMaxSupportedFileFormatVersionINTERNAL ASSERT FAILED at "../caffe2/serialize/inline_container.cc":147, please report a bug to PyTorch. Attempted to read a PyTorch file with version 10, but the maximum supported version for reading is 9. Your PyTorch installation may be too old.
I searched the forum do deal with this, and found that when saving the torch model to load it in python, this error may be solved by adding an argument “_use_new_zipfile_serialization=False” when doing “torch.save”.
How about when saving torchscript? I found out that there is no such argument when saving torchscript. Is there any other way?