Skip to content
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

Failure to build torch-sys, manual installation #298

Closed
Rushmore75 opened this issue Nov 16, 2022 · 5 comments · Fixed by #309
Closed

Failure to build torch-sys, manual installation #298

Rushmore75 opened this issue Nov 16, 2022 · 5 comments · Fixed by #309

Comments

@Rushmore75
Copy link

I have these environment variables set:

export TORCH_CUDA_VERSION="cu117"
export LIBTORCH="/home/oliver/sources/libtorchcxx11"
export LD_LIBRARY_PATH="${LIBTORCH}/lib:$LD_LIBRARY_PATH"

But when I go to build, it stops on torch-sys, which fails to build. Using rust-bert = "0.19.0". The error is about 1k lines of incorrect macros and function uses. I can compile tch-rs on my computer just fine, but that uses torch-sys 0.9 instead of 0.8. I could build everything from source but it's getting to be a long process at that point. Having to host a this dependency then a dependency of this.

So basically the dependencies need to be updated (from what it appears to me, but I might have made another mistake.)

@Rushmore75
Copy link
Author

It seems that just building this from source then tying it in as a dependency with

rust-bert = {version = "0.19.0", path="../rust-bert"}

works. And I see it uses torch-sys 0.9.0 in the cargo.toml so I guess the version from crates.io is outdated?

@guillaume-be
Copy link
Owner

Hello @Rushmore75 ,

The version published on crates.io depends on tch ~0.8.0. tch ~0.9.0 is not backward compatible with tch ~0.8.0. You have 2 options for installing the crate:

  1. Use the version published on crates.io. This depends on tch ~0.8.0 which expects LIBTORCH v1.12. You would need to download this version of LIBTORCH and update your environment variables accordingly.
  2. Use the latest version in this repository, which currently relies on tch ~0.9.0 and expects LIBTORCH v1.13. You would need to download and point to this version of the library instead.

When a new version of this library is released both will use LIBTORCH v1.13 (unless a new version of torch is released in the meantime). The README should be accurate for both crates.io and on this repository (but contain different information)

Please let me know if this helps.

@Rushmore75
Copy link
Author

I didn't change what libtorch version I was using between building from source or using the version from crates.io tho?

@guillaume-be
Copy link
Owner

I believe it may be part of the issue: the libtorch version used by the version in crates.io and from this repository are indeed different.

@Rushmore75
Copy link
Author

Ok. So shouldn't the readme be updated then? At least with a section about if not installing via source but just as a dependancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants