-
Notifications
You must be signed in to change notification settings - Fork 348
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
libtorch location #439
Comments
Right, libtorch is loaded as a shared library so the library binaries should be deployed on the boxes where you want to run this and in a path so that they could be discovered (i.e. either a system path or you could adjust the |
If you want to distribute |
@danieldk so patchelf would add all of the libtorch libraries into the binary? However, in that example, they seem to be .so files but when I downloaded libtorch, it seemed to be in .dylib files? |
No, the libraries are dynamically loaded. If you want to link everything into a single binary, you need a static build of libtorch (I am not sure if libtorch static builds are currently functional, the stuff included in the libtorch archive is incomplete). You probably need to patch
Right, this is for Linux, which uses Another option on macOS is to add the libtorch library path to the |
@danieldk thank you. This is proving to be a harder task. When programs use the c++ API of libtorch, is it packaged into the binary or is it loaded in a similar fashion? Would it be possible to take libtorch's code and interact with it using swig or something so that it's in the same binary? |
As long as you build libtorch as a dynamic library, it doesn't matter if you use libtorch directly through the C++ API or If distributing Though this is probably getting a bit off-topic... |
Ok. I'll try a static build. Haha yes. I thought about onnx but couldn't find any way to train models with it in rust. Hence why I'm thinking about tch-rs. |
I have a rust binary that uses tch and I'd also like to be able to statically link libtorch, and I am trying to follow this thread so I can get started. From what I understand I would start by getting the static libtorch: e.g.:
And then the Thanks in advance! |
@mrvollger Static linking should be supported in the latest version, some details in the readme. |
Hi there,
In the documentation, it says that libtorch must be on the system for the crate to work.
I am creating a program. Does this mean that libtorch must be on every system that I run the program on or will it be packaged with the binary?
Thanks.
The text was updated successfully, but these errors were encountered: