-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Mutators] full conversation history in flatten mutator #3578
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to update the mutators tests
parlai/mutators/flatten.py
Outdated
@@ -23,4 +23,5 @@ def many_episode_mutation(self, episode: List[Message]) -> List[List[Message]]: | |||
for message in episode: | |||
history.append(message.pop('text')) | |||
message['text'] = '\n'.join(history) | |||
history.extend(message['labels']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be after the yield, and it shouldn't extend with all of labels. It should pick a random element from labels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change it to pick one random element from the labels.
Why putting it after yield matters? We have already used history and are not going to use it again until next iterator call. Does it have something to do with the another thread that possibly calls the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're leaking the label!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline why the implementation is correct, but potentially confusing.
Patch description
flatten mutator was only keeping one side of the conversations in its history and there was losing the context of the conversation after flattening. Keeping the previous labels in the history for having for conversation context.
Testing steps
Used
parlai display_data
to compare before and after. See images below:Before:
After: