zyx-torch

Crates.iozyx-torch
lib.rszyx-torch
version0.1.1
sourcesrc
created_at2024-03-09 16:39:12.288088
updated_at2024-03-21 16:34:26.606883
descriptionZyx libtorch backend
homepagehttps://github.com/zk4x/zyx
repositoryhttps://github.com/zk4x/zyx
max_upload_size
id1167950
size17,631
(zk4x)

documentation

https://docs.rs/zyx-torch

README

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
Commit count: 493

cargo fmt