-
Hi, Example: import torch
from torch_geometric.nn import GCNConv
layer = GCNConv(64, 64).jittable()
torch.save(layer, "conv.pt") Then, when I run My current setup is to save all arguments required for constructing the model together with the model's state dict and reconstructing a new model from the arguments. I feel like it would be more elegant and intuitive to just use the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I see. Thanks for letting me know. This is indeed a current limitation as we are saving a temporary file of the jittable module to disk and load it into Python afterwards. I will look into ways how to circumvent this, but for now, I suggest to use regular |
Beta Was this translation helpful? Give feedback.
-
As far as I check, if you convert the layer to TorchScript, you can save and load it without that error: import torch
from torch_geometric.nn import GCNConv
layer = GCNConv(64, 64).jittable()
torch.jit.script(layer).save('conv.pt')
new_layer = torch.jit.load('conv.pt')
`` |
Beta Was this translation helpful? Give feedback.
I see. Thanks for letting me know. This is indeed a current limitation as we are saving a temporary file of the jittable module to disk and load it into Python afterwards. I will look into ways how to circumvent this, but for now, I suggest to use regular
load_state_dict
to initialize the model.