Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

[Mutators] full conversation history in flatten mutator #3578

Merged
merged 5 commits into from
Apr 13, 2021

Conversation

mojtaba-komeili
Copy link
Contributor

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:
Screen Shot 2021-04-09 at 4 50 16 PM

After:
Screen Shot 2021-04-09 at 4 59 43 PM

@mojtaba-komeili mojtaba-komeili changed the title added text to the history [Mutators] full conversation history in flatten mutator Apr 9, 2021
Copy link
Contributor

@stephenroller stephenroller left a 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

@@ -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'])
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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!

Copy link
Contributor

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.

@stephenroller stephenroller merged commit 74e3a78 into master Apr 13, 2021
@stephenroller stephenroller deleted the flatten-mut-history branch April 13, 2021 01:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants