Find answers from the community

Updated 2 months ago

Hello guys, When I execute this piece

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