python - 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'])
解决方案
经过更多研究,我发现 TensorFlow 提供了一个多语言句子编码器,它也可以用于问答。训练我自己的 Elmo 模型不是一种选择,因为它的计算成本太高。
推荐阅读
- php - 从 php 中的 url 中删除 %20
- c++ - librsvg 和 cairo;rsvg_handle_render_cairo() 失败;我究竟做错了什么?
- c# - C#:制作类时哪些成员将被序列化为XML元素[Serializable]
- unity3d - 使用 Unity SDK 从 Vimeo 流式传输可在编辑器中工作,但不会在构建中加载视频
- javascript - 替换和正则表达式异常
- azure - Azure Pipeline:如何将项目二进制文件发布到 Azure 机器中
- laravel - 不在 Laravel 控制器上工作,在 Tinker 上工作
- angular - github页面可以向外部服务器发送http请求吗?
- django - 如何将总和与除法一起使用?
- python-3.x - 当一个类的特征与另一个类重叠时,哪种机器学习模型效果很好?