theirstory / gliner-spacy

A spaCy wrapper for GliNER
MIT License
91 stars 8 forks source link

Load Gliner Model locally #11

Closed rishabh208gupta closed 6 months ago

rishabh208gupta commented 6 months ago

Hi, I have been trying to use the gliner-spacy library to do basic ner on some documents. I really appreciate how easy it is to integrate with spacy. I am facing one issue that the first document takes a long time to process, I am guessing because the model gets downloaded first. The subsequent documents process fairly quicker. Is there is a way to load and save the model locally beforehand?

wjbmattingly commented 6 months ago

Thanks so much for the kind words about the package! Hmm. After you have processed the first document and then rerun all the documents (in a separate instance of the same environment) is the delay the same? You have the ability to load the model first with GliNER which will download it if it is not available in the environment. Once in the environment, it should load that model instantly from the environment local model after that, since GliNER saves it for you.

rishabh208gupta commented 6 months ago

@wjbmattingly the delay in the first document was indeed due to model being downloaded. By initiating it with GliNER, there is no longer any delay. Thanks!