Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with saving a trained model with Torchscript #15

Open
jesunsahariar opened this issue Aug 29, 2023 · 0 comments
Open

Issue with saving a trained model with Torchscript #15

jesunsahariar opened this issue Aug 29, 2023 · 0 comments

Comments

@jesunsahariar
Copy link

jesunsahariar commented Aug 29, 2023

Hello,

Thank you for sharing the code to train models for link predictions on KGs!

I am currently trying to save a trained model (vecFeatured) on the wikikgv2 dataset for link prediction by adding saved_model = torch.jit.script(model) line to the last line of the save_model function. However, when Torchscript tries to execute this line, it throws the following error:

Tried to set an attribute: job_handle on a non-class: Tensor: 
smore/common/embedding/sparse_embed.py", line 66 
else:
                mat = self.embedding[indices]
            mat.job_handle = self.dummy_job
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
            return mat

I was wondering whether you have any suggestion to get around this error or any suggestion in general to save a trained model from your repo to be used for inference (in a C++ library). Thanks in advance!

Best regards,
Jesun Firoz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant