Comments (9)
Hello,
Here's the content of my LIBTORCH
env var :
echo $LIBTORCH
/home/mathis/Téléchargements/libtorch
And here's what I exactly did :
wget -P ~/Téléchargements https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.7.1%2Bcpu.zip
unzip ~/Téléchargements/libtorch-shared-with-deps-1.7.1+cpu.zip
echo 'export LIBTORCH=/home/mathis/Téléchargements/libtorch' >> ~/.zshrc
source ~/.zshrc
cargo clean
cargo run --example generation
I also tried with other patch versions of libtorch 1.7.* without success.
For testing purposes, I also tried to run example from the tch-rs crate with my current installation. It failed even after downloading libtorch 1.8. When I'm using a local version of libtorch the compilation gives me cc error.
So I tried the solution of this comment LaurentMazare/tch-rs#329 (comment): I unset the LIBTORCH
env variable and I installed the python-pytorch-cuda package. I was able to run cargo run --example basics
. Unfortunately, this solution doesn't work with rust-bert.
from rust-bert.
Hello @eonm-abes ,
These indeed look like errors happening at linking phase, possibly because the tch-sys
dependency was built with a different version of libtorch
. What I would recommend is a "clean install" of the library:
- Delete the target folder in
rust-bert
- Ensure you have downloaded the version of libtorch compatible with your system (I assume CPU-Linux-1.7.1 in your case)
- Ensure the environment variable
LIBTORCH
is set to the correct folder. If you downloaded a CUDA-enabled version of Libtorch, set theTORCH_CUDA_VERSION
environment variable tocu111
orcu101
depending on the version you installed.
Can you please try these steps and let me know if the error persists?
from rust-bert.
@guillaume-be sorry for the late reply,
No it didn't work. I have the same error again. I'm suspecting that the problem is related to my Linux distribution (manjaro), and the python packages I installed with my package manager. Installing packages both with pip and my package manager seems to create version conflict. I don't have time to test this hypothesis with a fresh install of manjaro so I used a workaround that involves Docker :
docker run --rm --user "$(id -u)":"$(id -g)" -e RUSTBERT_CACHE=/usr/src/myapp/cache -v "$PWD":/usr/src/myapp -w /usr/src/myapp rust:latest cargo run --example generation
and Hooray 🎉 :
Downloading https://huggingface.co/gpt2-medium/resolve/main/config.json [718B]... ✓ Done! Finished in 0 seconds
Downloading https://huggingface.co/gpt2-medium/resolve/main/vocab.json [1017.87KB]... ✓ Done! Finished in 0 seconds
Downloading https://huggingface.co/gpt2-medium/resolve/main/merges.txt [445.62KB]... ✓ Done! Finished in 0 seconds
Downloading https://huggingface.co/gpt2-medium/resolve/main/rust_model.ot [1.61GB].................... ✓ Done! Finished in 3 minutes
"The dog\'s name is androgyny, and it\'s also the name of the species in which it lives.\n\nIt doesn\'t"
"The dog has also been diagnosed with a rare type of cancer known as multiple myeloma, which is spread from the bone marrow to the lymph"
"The dog\'s owner, whose name has not been released, told police that the dog had been barking for at least an hour.\n\nThe"
"The cat was caught by one of the dogs and was taken to a vet where it was found to be in good health.\n\nIt was taken"
"The cat was lying on its back on the floor of the kitchen with its eyes closed.\n\n\"What\'s going on?\" I asked.\n"
"The cat was taken to a vet, who determined it was suffering from a rare form of cancer.\n\nThe cat\'s owner, the Daily Mail"
Don't forget to create the cache
folder inside the repo !
from rust-bert.
Hello @eonm-abes ,
This is surprising, the python package should not influence the behaviour of this crate since it does not rely on Python. Could you please check the value of your environment variable LIBTORCH
?
My guess is that it points to a libtorch location that is incompatible with the compiled tch
crate.
from rust-bert.
@guillaume-be, I had some similar experiences on Ubuntu using a dummy example:
- if
$LIBTORCH
is set to nothing then:cargo run
workscargo build
works- BUT in order to be able to run the resulting binary, I have to set
$LIBTORCH
to a path from the resulting target folder which houses a libtorch copy.
- if
$LIBTORCH
is set to a local libtorch copy- nothing works
When $LIBTORCH
is set to nothing, cargo is probably downloading a fresh copy there and then? But then it's still not packaging that as part of the binary, you have to set an env variable to point to the one which showed up in the target folder. Is there a way this could be avoided? As in, a fresh copy of libtorch could be fetched and also integrated in the (chunky) binary so that you don't need to set env variables before running it?
from rust-bert.
Hello @eonm-abes , @paulbricman ,
I was able to reproduce the issue on my Ubuntu installation, and found a fix for my local setup.
I see you are downloading the Pre-cxx11 ABI version of Libtorch (https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.7.1%2Bcpu.zip
).
Could you please try to download the cxx11 ABI version of Libtorch? (https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcpu.zip) and let me know if this works for you? This is the default version downloaded when the LIBTORCH
environment variable is not set, and would explain why the libraries build when the download proceed automatically but does not work with your manual installation.
from rust-bert.
@guillaume-be 👏 👏,
I cleaned my project with cargo clean to be sure, and it works !
This is awesome.
Thank you so much.
from rust-bert.
Works like a charm. Thank you so much for the effort you're putting into this package, @guillaume-be!
from rust-bert.
Great - glad this is working!
from rust-bert.
Related Issues (20)
- Does the marian model have a method like huggingface generate? HOT 4
- Fine-tuning Marian model can't use pipeline doing translate task HOT 2
- When label mapping aren't provided - we get a crash HOT 1
- Zeroshot with DeBerta v2 vs BART - is it worth it? HOT 2
- Can I use this lib with onnx but without libtorch? HOT 1
- how to use Cross-Encoder for MS Marco by rust-bert?
- Seek Assistance and Support for DeBERTa Model HOT 2
- Is multilabel prediction correct? HOT 1
- Evaluation fails when trying to extract keywords from a specific sentence HOT 2
- Please expose tonekizer params on models where `forward_t` is exposed
- Downloading a model to a local Directory HOT 4
- Question: Configuring ZeroShotClassificationModel with DeBERTaV2 - Documentation HOT 1
- Upgrade Cargo dependencies HOT 2
- GPT-2 text generation throws an unexpected error HOT 4
- Any plan to release a new version? HOT 2
- Question: is it ok to continue after OOM error from `encode`
- update to be working with torch 2.2.0
- support for huggingface access token
- Error on running example in Linux
- RemoteResource doesn't allow loading safetensors models
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-bert.