2 releases

0.1.1 Mar 21, 2024
0.1.0 Mar 9, 2024

#1105 in Machine learning

Download history 1/week @ 2024-07-17 16/week @ 2024-07-24 4/week @ 2024-09-18 20/week @ 2024-09-25 2/week @ 2024-10-02

70 downloads per month

MIT/Apache

180KB
4K SLoC

zyx-torch

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.

Cargo features

  • std - enables zyx-core/std
  • download-libtorch - installs libtorch

Dependencies

~12MB
~257K SLoC