我想用 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'])