Adding more contextual parameter in the custom jsonfile dataset.
Hi,
I am curious if we can add more context parameters in the given json dataset and use in the task:
--task jsonfile --jsonfile-datapath json_file_path
For example: Given the following json dataset sample, how can we add further context like context1 and context2 to train the model.
{
"dialog": [
{
"id": "partner1",
"text": "tell me a joke.",
"label": "One time, I put strawberry jam on my burger. I thought it was ketchup!",
"context1": "context1_val",
"context2": "context2_val",
"personas": [
"your persona: I am John",
"your persona: I live in Ohio."
],
"episode_done": true
},
{
"id": "partner1",
"text": "tell me a joke.",
"label": "Let me tell you my favorite joke. Why was six afraid of seven? Because seven ate nine!",
"context1": "context1_val",
"context2": "context2_val",
"personas": [
"your persona: I am Ellie",
"your persona: I live in New York."
],
"episode_done": true
}
]
}
As for as jsonfile agent is concerned, it seems like it does not parse the other context values like context1 and context2 for training the model.
Thanks!
Some of the agents may not do that on their own, but you may have agents that are using the extra context in the message. For example see this observe method for BlenderBot 2 that uses extra context from the message.
In addition, I'd recommend creating a custom task file that subclasses the jsonfile agent, and overrides the _get_ep_from_turns function to parse your context accordingly
Hi @klshuster and @mojtaba-komeili
Thanks for the response.
As suggested by @klshuster , I can add more context apart from text and labels for creating the task?
turn['text'] = xturn.get('text').strip()
turn['labels'] = [yturn.get('text').strip()]
Another question is... And once the task is created with other context, will the blenderbot2 model learn those contexts during training...? Thanks
As suggested by @klshuster , I can add more context apart from text and labels for creating the task?
you can access those context values (and place them in your observation) in something akin to the following:
turn['text'] = xturn.get('context1').strip() + '\n' + xturn.get('text').strip()
...
And once the task is created with other context, will the blenderbot2 model learn those contexts during training...?
If you include them in the text and labels fields, ideally yes
If you include them in the text and labels fields, ideally yes
So we have to include context1 field in the labels as well?
the text field is the input context, while the labels field is the output target. If you want BB2 to generate the context1 field, put it in labels; if you want it to simply understand it's necessity, put it in text
This issue has not had activity in 30 days. Please feel free to reopen if you have more issues. You may apply the "never-stale" tag to prevent this from happening.