-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offline mode #1725
Comments
This is even more annoying when using sentence-transformers through a third party library such as KeyBERT. It's because now we need to find where the SentenceTransformer is created and override it. In this case it was in the README, but other libraries might not provide an override option. |
Hello! As of #2345, running this script twice, first with internet and then without, will now result in the same output of from sentence_transformers import SentenceTransformer
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
embeddings = model.encode("This is a test sentence")
print(embeddings.shape) So I'll be closing this. I intend to include these changes in the upcoming 2.3.0 release, which should hopefully release within the next week or 2.
|
Hello! 馃憢
Would it be possible to have an offline mode similar to Hugginface's
TRANSFORMERS_OFFLINE=1
environment variable documented here?Example
For example, if I call
SentenceTransformer(model_name)
, it downloads to cache. If I then turn off my Internet connection and re-run, I get something likerequests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/sentence-transformers/all-MiniLM-L12-v2 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x176176130>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
.I would like to tell
sentence-transformers
to go straight to the cache.Workaround
I can do the following workaround:
But with
SENTENCE_TRANSFORMERS_HOME
,TORCH_HOME
andXDG_CACHE_HOME
in mind, it would be a lot more robust to support that insideSentenceTransformer()
.The text was updated successfully, but these errors were encountered: