首页 > 解决方案 > Allennlp 德国 elmo 模型

问题描述

我想用 allennlp 构建一个问答机器人。我已经找到了它的代码和一个英文模型——我想用德语的机器人。我已经搜索过了,但我只找到了这个与 allennlp 不兼容的模型。您是否知道任何兼容的德国 elmo 型号,或者是否有更常见的替代 allennlp 具有更多兼容型号?

这是我找到的代码:

from allennlp.predictors.predictor import Predictor
import allennlp_models.rc

predictor = Predictor.from_path("https://storage.googleapis.com/allennlp-public-models/bidaf-elmo-model-2020.03.19.tar.gz")

result = predictor.predict(
  passage="Steve Jobs died in 2011. He was born in 1955. He has multiple children.",
  question="When did Steve Jobs die?"
)
print(result['best_span_str'])

标签: pythonelmoallennlp

解决方案


经过更多研究,我发现 TensorFlow 提供了一个多语言句子编码器,它也可以用于问答。训练我自己的 Elmo 模型不是一种选择,因为它的计算成本太高。


推荐阅读