UKPLab/sentence-transformers

UnboundLocalError: local variable 'SentenceTransformer' referenced before assignment

riyajatar37003 opened this issue · 2 comments

UnboundLocalError: local variable 'SentenceTransformer' referenced before assignment

tried pip install with upgrade but same error

I suspect one of a few things is happening:

  1. You've forgotten to import SentenceTransformer
  2. You've made a folder called sentence_transformers which messes up the from sentence_transformers import SentenceTransformer
  3. You've turned SentenceTransformer into a variable with something like SentenceTransformer = 12

I suspect the issue is on your end. An interesting solution is to go to https://huggingface.co/chat/ and ask it "I'm getting the UnboundLocalError: local variable 'SentenceTransformer' referenced before assignment error with the following code, could you tell me 1) why and 2) how I should fix it?

"

And then I suspect it will be able to tell you.

  • Tom Aarsen