Crates.io | zyx-torch |
lib.rs | zyx-torch |
version | 0.1.1 |
source | src |
created_at | 2024-03-09 16:39:12.288088 |
updated_at | 2024-03-21 16:34:26.606883 |
description | Zyx libtorch backend |
homepage | https://github.com/zk4x/zyx |
repository | https://github.com/zk4x/zyx |
max_upload_size | |
id | 1167950 |
size | 17,631 |
Libtorch backend for zyx machine learning library.
Libtorch backend uses libtorch c++ library for executing graph.
This backend needs to have access to libtorch c++ library. zyx-torch uses tch-rs library as it's backend, therefore following methods can be used to install libtorch:
LibTorch can be downloaded directly from pytorch website. Select stable, your OS, LibTorch and your preferred compute platform. Download cxx11 ABI. Once downloaded, extract the archive to some folder. Then run following commands and replace /path/to/libtorch with folder where you extracted libtorch. Use absolute path. This sets necessary environment variables for libtorch. Note that environment variables get reset when you reboot your computer, so you need to reexport them again, or put them into some script that runs automatically.
export LIBTORCH=/path/to/libtorch
export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
Please read pytorch documentation for all prerequisities, you may need to install c++ compiler or gpu drivers.
If you have pytorch installed, the above environment variables will interfere with it. In that case, you may prefer to use pytorch's libtorch,
export LIBTORCH_USE_PYTORCH=1
If neither of those options works for you, zyx-torch can install libtorch automatically, by enabling download-libtorch feature.
For README and source code, please visit github.
For more details, there is a book.