DeepPavlov FAQ Bot 返回 'collections.OrderedDict' object is not callable 错误

DeepPavlov FAQ Bot is returning a 'collections.OrderedDict' object is not callable error

我正在尝试使用 collab 为 DeepPavlov 的 FAQ 构建一个机器人,我修改了 DeepPavlov 在他们网站上的教程笔记本,我唯一改变的是使用我的示例数据集,但我得到了 'collections.OrderedDict' object is not callable 调用 on

时出现错误
answer=model_config(["help"])
answer

完整代码(以单元格分隔)是

!pip install -q deeppavlov

from deeppavlov import configs
from deeppavlov.core.common.file import read_json
from deeppavlov.core.commands.infer import build_model
from deeppavlov import configs, train_model

model_config = read_json(configs.faq.tfidf_logreg_en_faq)

model_config["dataset_reader"]["data_path"] = None
model_config["dataset_reader"]["data_url"] = "https://docs.google.com/spreadsheets/d/e/2PACX-1vSUFqHL9u_KkSCfw03bYCIuzfCzfOwXlvsQeTb8tMVaSDYohcHbfL8jNtV24AZiSLNnJJQs58dIsO8A/pub?gid=788315638&single=true&output=csv"
model_config

answer=model_config(["help"])
answer

任何人都知道帮助我的机器人 运行 使用我在代码中提供的示例数据集 url 的修复程序?我是机器人、deeppavlov 和协作的新手,所以我在这里有一个陡峭的学习曲线。

您的代码缺少 模型训练 部分 - 您正在尝试调用配置对象而不是实际训练并使用模型对您的数据进行预测。

然而,这不是这里唯一的问题。首先,您可能希望将 data_path 变量更改为字符串对象,否则您将在此处遇到问题(您可以自己尝试检查)。其次,在尝试 运行 您的代码和我的更正时,我遇到了 csv-parsing 错误 - 请再次检查您的 csv 文件并确保删除其中的空行。执行此操作后,此代码应该可以正常工作。

model_config = read_json(configs.faq.tfidf_logreg_en_faq)
model_config["dataset_reader"]["data_path"] = ''
model_config["dataset_reader"]["data_url"] = "your-dataset-link"

faq = train_model(model_config)
answer = faq(["help"])
answer