Closed hkfi closed 4 months ago
Turns out setting the LIBTORCH
and LD__LIBRARY_PATH
variables as mentioned in the docs is no longer necessary as of two weeks ago due to an update adding the features=["download-libtorch]
flag to the tch
dependency.
I managed to get a fresh Rust project to compile with rust-bert
as a dependency by adding the same flag, so the dep looks like this:
rust-bert = {version = "0.22.0", features = ["download-libtorch"]}
It will not work with rust-bert = "0.22.0"
, and trying to point LIBTORCH
to the pytorch that was installed via Homebrew like mentioned in the docs like:
export LIBTORCH=$(brew --cellar pytorch)/$(brew info --json pytorch | jq -r '.[0].installed[0].version')
export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
@hkfi Are you able to build release version?
I followed the steps mentioned in the docs
I ran the commands mentioned:
I am able to run
cargo run --example sentence_embeddings
.However, when creating a new Rust project and adding
rust-bert = "0.22.0"
as a dependency and runningcargo build
, I run into the following error:I checked that the variables
LIBTORCH
andLD_LIBRARY_PATH
were set correctly with echo:LD_LIBRARY_PATH when run with the commands in the docs will actually result in
/opt/homebrew/Cellar/pytorch/2.2.0_6/lib:
instead of/opt/homebrew/Cellar/pytorch/2.2.0_6/lib
as mentioned here. I tried both and they both fail to build.