import json
#from deeppavlov.core.commands.infer import build_model_from_config
from deeppavlov.core.commands.train import train_model_from_config
from deeppavlov.download import deep_download
PIPELINE_CONFIG_PATH = 'deeppavlov/configs/ner/ner_ontonotes.json'
with open(PIPELINE_CONFIG_PATH) as f:
config = json.load(f)
train_model_from_config(PIPELINE_CONFIG_PATH)
ner_model = build_model_from_config(config)
ner_model(['Computer Sciences Corp. is close to making final an agreement to buy Cleveland Consulting Associates'])我正在使用tutorial,但是deep pavlov的导入给我带来了麻烦。我已经在我的虚拟机上安装库。
错误消息如下:
ImportError Traceback (most recent call last)
<ipython-input-40-a6e1af262d62> in <module>
1 import json
2 #from deeppavlov.core.commands.infer import build_model_from_config
----> 3 from deeppavlov.core.commands.train import train_model_from_config
4 from deeppavlov.download import deep_download
5
ImportError: cannot import name 'train_model_from_config' from 'deeppavlov.core.commands.train' (/opt/anaconda3/lib/python3.7/site-packages/deeppavlov/core/commands/train.py)发布于 2020-01-23 15:49:22
当最新的稳定版本是0.7.1时,您正在链接0.0.7版本的文档。
现在,构建和使用预训练的OntoNotes NER模型可以像这样完成:
from deeppavlov import build_model, configs
ner_model = build_model(configs.ner.ner_ontonotes, download=True)
ner_model(['Computer Sciences Corp . , El Segundo , Calif . , said it is close to making final an agreement to buy Cleveland Consulting Associates'])https://stackoverflow.com/questions/59855814
复制相似问题