-
Notifications
You must be signed in to change notification settings - Fork 22.2k
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
Saving torchscript model in C++ #35464
Comments
Related - serialization of tensors between C++ and Python: #20356 (comment) |
@driazati this should be possible right ? |
Yeah we already have the ability to save to a https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/api/module.h#L208 @oplatek does this API do what you want or are you looking for something else? |
@driazati this is it! I do not know how I missed it. |
Cool, closing this issue then. Feel free to reopen if you run into more problems. |
@oplatek Hi, would you please tell me how did you solve the problem? Thanks in advance! |
I used the API as suggested by @driazati.
https://github.com/pytorch/pytorch/blob/3ab88c39038b75ff22f9985b415f7af943c6303b/torch/csrc/jit/api/module.h#L214
On Mon, 5 Oct 2020 at 10:49, fkxie ***@***.***> wrote:
@oplatek <https://github.com/oplatek> Hi, would you please tell me how
did you solve the problem?
Thanks in advance!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#35464 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABX7EWGSPVONTOYCLJFWJDSJGB7BANCNFSM4LUCPPMA>
.
--
Ondřej Plátek
|
Yeah,I see. Thanks for reply! And I’m pleasure to know how to use it!-- 发自新浪邮箱客户端
在 10月6日 00:55,Ondrej Platek <notifications@github.com> 写道:
I used the API as suggested by @driazati.
https://github.com/pytorch/pytorch/blob/3ab88c39038b75ff22f9985b415f7af943c6303b/torch/csrc/jit/api/module.h#L214
…On Mon, 5 Oct 2020 at 10:49, fkxie ***@***.***> wrote:
@oplatek <https://github.com/oplatek> Hi, would you please tell me how
did you solve the problem?
Thanks in advance!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#35464 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABX7EWGSPVONTOYCLJFWJDSJGB7BANCNFSM4LUCPPMA>
.
--
Ondřej Plátek
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I am bit confused: Is this a way to do this now? Or am I misunderstanding the use-case that you are pursuing here? |
and what is the purpose of the |
I'm trying to do the same thing, but using the save using Can you provide me with an example? Thanks, I would be very grateful! |
There is no way to take a model in c++ that inherits from But you can load a
Edit: If you really need to export your c++ model to onnx, you can actually create a
so you cant train the resulting jit module, but the inference works in c++, I didn't actually try converting to onnx though. Also I wasn't able to vary the batch size in the resulting jit module. Control flow probably wont work too |
🚀 Feature
Allow torch::jit::script::Module in C++ to serialize the model back to disc.
I submitted the issue based on the thread https://discuss.pytorch.org/t/how-to-save-torchscript-model-using-cpp/59743/10
Motivation
General motivation:
My particular use case:
Pitch
Please implement C++ version of https://pytorch.org/docs/stable/jit.html#torch.jit.save
Alternatives
cc @suo
The text was updated successfully, but these errors were encountered: