I tried to load the trained spacy model but this error appear:
OSError: [E053] Could not read meta.json from model-best.zip
this is my code:
nlp_ner = spacy.load("model-best.zip")
For spaCy 3, you can load models from 3 sources:
python -m spacy download YOUR_MODEL
spacy train
.nlp.from_disk
Usually, any of these models is stored as a folder or directory , with an structure similar to this one (for a NER model, which it seems it is what you are attempting to load):
/path/to/your/model/
├── model-best <== THIS DIRECTORY IS WHAT YOU MIGHT HAVE
│ ├── config.cfg
│ ├── meta.json
│ ├── ner
│ │ ├── cfg
│ │ ├── model
│ │ └── moves
│ ├── tok2vec
│ │ ├── cfg
│ │ └── model
│ ├── tokenizer
│ └── vocab
│ ├── key2row
│ ├── lookups.bin
│ ├── strings.json
│ ├── vectors
│ └── vectors.cfg
└── model-last
├── config.cfg
├── meta.json
├── ner
│ ├── cfg
│ ├── model
│ └── moves
├── tok2vec
│ ├── cfg
│ └── model
├── tokenizer
└── vocab
├── key2row
├── lookups.bin
├── strings.json
├── vectors
└── vectors.cfg
8 directories, 26 files
This discards "loading directly from a .zip
file" as a valid option.
I think you may want to try the following:
model-best.zip
and see if you find a similar directory structure than the one shown above. If you are in a Linux-based system, here is how.nlp_ner = spacy.load("/path/to/your/model-best")
( nlp_ner = spacy.load("./model-best")
in your case) and see if it works.Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.