UnboundLocalError: local variable 'SentenceTransformer' referenced before assignment
riyajatar37003 opened this issue · 2 comments
riyajatar37003 commented
UnboundLocalError: local variable 'SentenceTransformer' referenced before assignment
tried pip install with upgrade but same error
tomaarsen commented
I suspect one of a few things is happening:
- You've forgotten to import
SentenceTransformer
- You've made a folder called
sentence_transformers
which messes up thefrom sentence_transformers import SentenceTransformer
- You've turned
SentenceTransformer
into a variable with something likeSentenceTransformer = 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
riyajatar37003 commented
Thanks.
My bad it was import error.
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Tom Aarsen ***@***.***>
Sent: Tuesday, November 26, 2024 3:51:38 PM
To: UKPLab/sentence-transformers ***@***.***>
Cc: Riyaj Atar ***@***.***>; Author ***@***.***>
Subject: Re: [UKPLab/sentence-transformers] UnboundLocalError: local variable 'SentenceTransformer' referenced before assignment (Issue #3086)
[External Email]
________________________________
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/<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
—
Reply to this email directly, view it on GitHub<#3086 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BIJR5XWMCJ6YM4X3OMWZAHT2CRDTFAVCNFSM6AAAAABSP2WNUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBQGIZDGMBXHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>