gpt4 book ai didi

python - 从 'train model from_config' 导入 'deeppavlov.core.commands.train' 时出错

转载 作者:行者123 更新时间:2023-11-30 09:58:56 24 4
gpt4 key购买 nike

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但深度巴甫洛夫的重要性给我带来了麻烦。已在我的虚拟机上安装了该库。

错误信息如下:

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)

screenshot of code and error message

最佳答案

您正在链接版本 0.0.7 的文档而最新的稳定版本是0.7.1 .

现在可以像这样构建和使用预训练的 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'])

关于python - 从 'train model from_config' 导入 'deeppavlov.core.commands.train' 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59855814/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com