我已经训练了一个supervised_embeddings拉萨NLU模型使用rasa train nlu。对于我的特定用例,我现在需要获取输入用户消息的嵌入,并将嵌入与我的NLU培训数据中的消息进行比较。
是否可以使用Python来加载经过训练的模型,并使用它来获得文本字符串的嵌入?
发布于 2020-02-11 18:12:55
这是在rasa论坛上回答的。为了方便地将only_output_properties=False传递给interpreter.parse方法,可以:
您可以在python脚本中这样做:
from rasa.nlu.model import Interpreter
interpreter = Interpreter.load('models/nlu-xyz/nlu')) ## this should be an extracted model
result = interpreter.parse('hello world',only_output_properties=False)
embeds = result.get("text_sparse_features")发布于 2020-02-11 10:14:40
@KOB不幸的是,我们没有它的API。您可以查看classifier.py#L572上的代码,并使用message_embed作为嵌入。请随时提出任何进一步的问题。
https://stackoverflow.com/questions/60089012
复制相似问题