Merged
Conversation
JosephMarinier
commented
Oct 14, 2022
| with FileLock(pjoin(self.cache_dir, "st.lock")): | ||
| self.encoder = SentenceTransformer(self.config.similarity.faiss_encoder) | ||
| model = self.config.similarity.faiss_encoder | ||
| if os.environ.get("TRANSFORMERS_OFFLINE"): |
Contributor
Author
There was a problem hiding this comment.
An alternative to checking TRANSFORMERS_OFFLINE would be to check if the local cache exists and load it if so, or even try to load the SentenceTransformer with the local cache and catch if there is an error to then load it online. I guess it depends on if it is likely to be updated online (and we want the latest) or not. Any thoughts?
e4c3627 to
e653d17
Compare
Contributor
Author
|
This could be reverted if the issue huggingface/sentence-transformers#1725 is resolved. Let's see if the PR huggingface/sentence-transformers#1845 gets accepted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Loading the sentence transformer currently fails without Internet access. Here is a simple workaround that uses sentence-transformers' own environment variables. I don't understand why it doesn't already work like that, so I opened a ticket on their end: huggingface/sentence-transformers#1725.
Checklist:
You should check all boxes before the PR is ready. If a box does not apply, check it to acknowledge it.
ran
pre-commit run --all-filesat the end.our users.
READMEfiles and our wiki for any big design decisions, if relevant.