Find answers from the community

Updated 4 months ago

Hello guys, When I execute this piece

At a glance

The community member is encountering an ImportError when trying to import the SentenceTransformerRerank class from the llama_index.core.postprocessor module. The error message suggests that the torch and sentence-transformers packages are not installed properly, even though the community member claims to have installed them.

The community members in the comments suggest that the issue could be due to the packages being installed in a different environment than the one where the code is being executed. They also suggest checking if the community member is running the code in a notebook and if they need to restart it, as well as verifying the code that raises the error.

Additionally, the community member encounters another ImportError related to the libcufft.so.11 library, which the community members suggest is likely due to an issue with the CUDA installation.

There is no explicitly marked answer in the comments, but the community members provide suggestions on how the community member can try to resolve the issues they are facing.

Hello guys, When I execute this piece of code
Plain Text
from llama_index.core.postprocessor import SentenceTransformerRerank
rerank = SentenceTransformerRerank(
            model="cross-encoder/ms-marco-MiniLM-L-2-v2", top_n=3
        )


Then this error will occur.
ImportError: ('Cannot import sentence-transformers or torch package,', 'please pip install torch sentence-transformers')

Even though I have already installed these packages properly, the error still occurs.
W
V
L
10 comments
Can you verify where you have installed the package and where your application is running this piece of code are the same
It could be that they are in diff env
Yes, I checked,
Work the functionality in a script PY file, and it runs without errors. However, when I configure this functionality in my actual project, it shows an error. I verified the dependencies for both, and they are the same.
Are you running in a notebook? You might have to restart
The code that raises this error is just doing from sentence_transformers import CrossEncoder
No, I am using vs code!
Yes, I think you are right. How can I resolve this?
And when i execute this code
Plain Text
from sentence_transformers import CrossEncoder

then it will show another error
Plain Text
ImportError: libcufft.so.11: failed to map segment from shared object
I am not sure what I am doing wrong. Can you please help me resolve this error?
oh that just means you have some issue with cuda installation I think
google should help there
Add a reply
Sign up and join the conversation on Discord