I have trained an NLU model using the
supervised_embedding pipeline. For my specific use case, I would now like to use the trained model to extract the embeddings for new messages, and then compare them with the embeddings of messages in the training data.
Through reading through the source code, I have tried different things such as:
from rasa.nlu.model import Interpreter import os interpreter = Interpreter.load( os.path.join('models', 'nlu-20200127-101026/nlu'), # Had to extract the tar.gz model file before running this code ) result = interpreter.parse('hello world') print(result)
As expected, this just outputs the classified intent and the other most probable intents. I a not sure if I am heading in the correct direction.
How can I use the Python API to load a trained model, input a string of text, and receieve as output the embedding of this string?