MartinoMensio / spacy-universal-sentence-encoder

Google USE (Universal Sentence Encoder) for spaCy
MIT License
176 stars 12 forks source link

How to not reach out to internet when loading model #27

Open demongolem-biz2 opened 1 year ago

demongolem-biz2 commented 1 year ago

I do pip install spacy-universal-sentence-encoder

then in code:

import spacy_universal_sentence_encoder
# load one of the models: ['en_use_md', 'en_use_lg', 'xx_use_md', 'xx_use_lg']
nlp = spacy_universal_sentence_encoder.load_model('en_use_md')

But at that load_model line, the code tries to go out to the internet. I see in the stack trace lin 261 in language.py which is

self.model = hub.load(self.model_url)

Is there a way to prevent this loading from a url and just load the model locally?