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

[TOD][Agents] Helper Agents for simulation + tests #4232

Merged

Conversation

moyapchen
Copy link
Contributor

@moyapchen moyapchen commented Dec 8, 2021

Effectively does same thing as #4176 but broken out to be easier to review.

This diff does 2 things:

  1. Adds the helper agents for simulation (Goal + API Description agents necessary for simulation; agents for dumping data from a dataset) in tod_agents.py.
  2. Adds tests for these agents + the teachers in the previous diff in the stack.

@moyapchen moyapchen merged commit 85f1c52 into simpler_tod_2a_teachers_only Dec 13, 2021
@moyapchen moyapchen deleted the simpler_tod_2b_simulation_agents branch December 13, 2021 23:13
moyapchen added a commit that referenced this pull request Dec 13, 2021
moyapchen added a commit that referenced this pull request Dec 13, 2021
@moyapchen moyapchen restored the simpler_tod_2b_simulation_agents branch December 13, 2021 23:16
@moyapchen moyapchen deleted the simpler_tod_2b_simulation_agents branch December 13, 2021 23:16
@moyapchen moyapchen restored the simpler_tod_2b_simulation_agents branch December 13, 2021 23:16
Copy link
Contributor

@skiingpacman skiingpacman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some general comments.

Was somewhat confused by what some sections were trying to achieve. Will cycle back and take a 2nd look.


Implements an "epoch done"

Member variables assumed to be set in init downstream:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering if you could use 'ABC' and include an abstract method that downstream is forced to implement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this more, this comment doesn't exactly make any sense. I'll deal with it... in the __init__ here...

parlai/core/tod/tod_agents.py Show resolved Hide resolved
parlai/core/tod/tod_agents.py Show resolved Hide resolved
parlai/core/tod/tod_agents.py Show resolved Hide resolved
This is not actually "episode_done" so much as "we want to signify to the world
that we have gone past the batch".

This class should not control whether or not the episode is actually done since
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confused as to what the aim is here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this is per the conversation structure — It's assumed by convention that the User agent ends the conversation with a [DONE] token... can make this more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: After staring at this a bit more, realized it's clearer just editing the code to be more explicit rather than trying to explain what's going on.

return episode_idx % 2 == 1 and max_turns > 0


def use_broken_api_calls_this_turn(round_idx, episode_idx):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"used_" as in already happened and testing that it happened, or "includes_" as in this round includes a broken API call?

Possibly reading this wrong but I don't think this is a signal to "use" something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file generates mock conversations. This is an arbitrary function to decide to use a broken API call once in a while in a deterministic way to test if the #s in the metrics is correct.

I can make this comment more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing this in context again, I can make it more clear relative to the other function above.

return [
tod_core.TodStructuredRound(
user_utt=f"user_utt_{episode_idx}_{round_idx}",
api_call_machine=make_api_call_machine(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if there might be a better postfix, other than "_machine", which expresses a list of dicts structure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline; we can use _dict rather than _machine here (but will do in a diff at the end of the stack)

parlai/core/tod/tod_test_utils/test_agents.py Show resolved Hide resolved
parlai/core/tod/tod_test_utils/test_agents.py Show resolved Hide resolved
@moyapchen moyapchen deleted the simpler_tod_2b_simulation_agents branch December 13, 2021 23:17
@moyapchen moyapchen restored the simpler_tod_2b_simulation_agents branch December 13, 2021 23:17
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