Hello,
My goal is to set up a blender model so my scripts can easily access it like so:
from something import Blender
model = Blender()
model.context = ["Hello", "how are you?", "Good thanks!"]
user_utt = "What are you doing?"
blender_utt = model.get_utt(user_utt)
print(blender_utt)
From my understanding, this probably isn't the easiest way to do it as we have the worlds and agents and how they all interact together.
So far, my approach was to:
config.yml and configure itMessengerChatBotTaskWorld & subclass itgenerate_worldparley functionHowever, I was running into a lot of issues.
config.yml specified anywhere?from parlai.core.params import ParlaiParser
parser = ParlaiParser(False, False)
parser.add_parlai_data_path()
parser.add_messenger_args()
opt = parser.parse_args()
_load_model function?The rest of the steps seem pretty straight forward.
I was wondering if this is the easiest way to get the sort of/similar functionality I described above? I am mostly interested in being able to automatically feed in utterances to a blender model through a script and capture its output.
Thanks!
Update: I have figured out that I can use the ParlAI/parlai/scripts/interactive.py, subclass LocalHumanAgent and override def act() and replace human_agent = LocalHumanAgent(opt) with human_agent = EvalAgent(opt). Then in the act() method I can control what response to feed the Blender model and when to stop the episode/chat.
I run this method: Interactive.main(model_file='zoo:blender/blender_90M/model')
I have a few new questions:
1. How can I feed the Blender model a specific dialogue history? E.g, say I have 3 turns, (A: Hey, B: how are you?, A: great, how about you?), and then prompt blender to respond to "great, how about you?" but with the context of the first two turns: "A: Hey, B: how are you?". I was thinking I could manually feed in the previous dialog, but I don't want blender to respond to each utterance, I only want blender to respond to the last utterance given the entire context of the conversation. Is this possible? Would I just concatenate the initial responses?. I realized I can use the agent.self_observe(utterance) function.
2. What is the best way to configure the persona of blender using the interactive.py script? I cannot seem to figure this out, it seems different than other referenced posts. I cannot see in the self.opt anywhere that even includes the 'include_persona` option? What am I missing?
Thanks!
I am mostly interested in being able to automatically feed in utterances to a blender model through a script and capture its output
If your responses are known in advance, perhaps you could create a ParlAI task/teacher, and then use the parlai/scripts/display_model script with --model zoo:blender/blender_90m/model and then -t your_task.
What is the best way to configure the persona of blender using the interactive.py script?
If you specify a task when running interactive.py, e.g. python parlai/scripts/interactive.py -t convai2, the interactive script will create an InteractiveWorld, if one is defined for that task. This InteractiveWorld handles the parleys between agents, and will load the agent with appropriate context prior to conversation. Using -t convai2 will load up a convai2 interactive world, which provides personas to the model. You can take a look at the linked file or also the InteractiveBaseWorld to see how personas (or context in general) is given to the model.
Most helpful comment
If your responses are known in advance, perhaps you could create a ParlAI task/teacher, and then use the
parlai/scripts/display_modelscript with--model zoo:blender/blender_90m/modeland then-t your_task.If you specify a task when running
interactive.py, e.g.python parlai/scripts/interactive.py -t convai2, the interactive script will create anInteractiveWorld, if one is defined for that task. ThisInteractiveWorldhandles theparleys between agents, and will load the agent with appropriate context prior to conversation. Using-t convai2will load up a convai2 interactive world, which provides personas to the model. You can take a look at the linked file or also theInteractiveBaseWorldto see how personas (or context in general) is given to the model.