nlpspacylanguage-modelspacy-3

Spacy download en_core_web_lg manually


I am trying to find a way to download the model en_core_web_lg ==2.3.1 for Spacy == 2.3.2.

Currently using

python -m spacy download en_core_web_lg
import spacy
nlp = spacy.load ("en_core_web_lg")

Is it possible to download the model file or directory directly and load the model from that downloaded folder.


Solution

  • Yes you can.

    First, download the model from here. I downloaded the .tar.gz format.

    Then you extract it and you load it in the code by specifying the path of the wanted subfolders. To be sure that the path is correct, you should get to the folder that contains the config.cfg file.

    For example:

    import spacy
    nlp = spacy.load("your/base/path/en_core_web_sm-3.1.0/en_core_web_sm/en_core_web_sm-3.1.0/")
    doc = nlp("This is a sentence.")
    

    Here you can find some more info.