![](/img/trans.png)
[英]How could I read image from a directory as input and output while traing a CNN model in Tensorflow?
[英]OSError: [E053] Could not read meta.json from model-best.zip
我試圖加載訓練有素的 spacy model 但出現此錯誤:
OSError: [E053] Could not read meta.json from model-best.zip
這是我的代碼:
nlp_ner = spacy.load("model-best.zip")
對於 spaCy 3,您可以從 3 個來源加載模型:
python -m spacy download YOUR_MODEL
spacy train
訓練的自定義模型。nlp.from_disk
加載模型通常,這些模型中的任何一個都存儲為文件夾或目錄,其結構與此類似(對於 NER model,這似乎是您要加載的內容):
/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
這會將“直接從.zip
文件加載”作為有效選項丟棄。
我想您可能想嘗試以下操作:
model-best.zip
並查看是否找到與上面顯示的類似的目錄結構。 如果您使用的是基於 Linux 的系統,方法如下。nlp_ner = spacy.load("/path/to/your/model-best")
( nlp_ner = spacy.load("./model-best")
在你的情況下)看看它是否有效。希望能幫助到你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.