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

updated tch-rs to 0.13.0 #380

Merged
merged 8 commits into from
May 21, 2023
Merged

Conversation

josephhajduk
Copy link
Contributor

find replaced of_slice to from_slice as per
https://github.com/LaurentMazare/tch-rs/blob/008fff6cc0a91ecff274d1549c2dff25b8ca57a4/CHANGELOG.md

was having trouble running on m1 with 0.12.0, works with 0.13.0

@LaurentMazare
Copy link

A nice addition on 0.13.0 is that the torch-sys build script now emits the location of the libtorch shared library via some environment variable, this can be used by top level crates to use some link flags for binaries that remove the need for setting up LD_LIBRARY_PATH appropriately. A sample build script that does this would be diffusers-rs/build.rs.
(it's a bit sad to need this to be done in the top level crates but afaik there isn't an easy way to set some arbitrary linking flags for the final binaries from the library crates.

Also note that the automated libtorch download is now opt-out, you can get the old behavior with the specific cargo feature though probably better to avoid it if possible.

Copy link
Owner

@guillaume-be guillaume-be left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @LaurentMazare for the note - these look like good changes indeed and will hopefully make the installation on mac / M1 targets easier. I have copied over the build script from diffusers-rs/build.rs, I hope that is fine.

@guillaume-be guillaume-be merged commit 2bff63b into guillaume-be:master May 21, 2023
@diptanu
Copy link

diptanu commented May 21, 2023

@josephhajduk @guillaume-be This is breaking the build of Indexify - https://github.com/diptanu/indexify

Any suggestions for how to fix it?

@josephhajduk
Copy link
Contributor Author

I had to explicitly add a direct torch-sys dependency to my project with the download-libtorch feature. It didn't seem to work by adding the feature to the bert-rs dependency.

@guillaume-be
Copy link
Owner

@diptanu @josephhajduk could you please try to check the branch candidate at #382 without passing torch-sys as an additional dependency and let me know if this helps?

@diptanu
Copy link

diptanu commented May 22, 2023

@guillaume-be @josephhajduk I responded on the issue - PyO3 broke the build for me, I updated to the new master of rust-bert and added PyO3 which caused the confusion.

I see that new PR has been merged related to the libtorch download feature, will test it soon but I got around to solving the issue by adding a dependency to tch directly.

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 this pull request may close these issues.

4 participants