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

Commit

Permalink
Add a randomize_conversations to ACUTE blueprint + use (#3528)
Browse files Browse the repository at this point in the history
* Add a `randomize_conversations` to ACUTE blueprint + use

...cause I want to be able to not randomize conversations.

Context here is that I have chats generated from different models using a fixed set of prompts. I want to be able to compare how different models do on the same prompt and consequently do not want the chats to be randomized.

Test plan:
Print out the pairs value from this function; verify that things align.

* fix test with yaml (thanks for feedback)

* get right .yaml file; run tests locally
  • Loading branch information
moyapchen committed Apr 17, 2021
1 parent 36bc4ae commit 5081caa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions parlai/crowdsourcing/tasks/acute_eval/conf/example.yaml
Expand Up @@ -13,6 +13,7 @@ mephisto:
s1_choice: "I would prefer to talk to <Speaker 1>"
s2_choice: "I would prefer to talk to <Speaker 2>"
subtasks_per_unit: 5
randomize_conversations: True
task:
allowed_concurrent: 1
assignment_duration_in_seconds: 600
Expand Down
Expand Up @@ -7,3 +7,4 @@ mephisto:
num_self_chats: 5
root_dir: ${task_dir}/task_config
task: blended_skill_talk
randomize_conversations: True
6 changes: 6 additions & 0 deletions parlai/crowdsourcing/tasks/acute_eval/fast_acute_blueprint.py
Expand Up @@ -81,6 +81,12 @@ class FastAcuteBlueprintArgs(AcuteEvalBlueprintArgs):
default=False,
metadata={'help': "Use any existing self-chat files without prompting"},
)
randomize_conversations: bool = field(
default=True,
metadata={
'help': "Randomize conversations used for match-ups or take conversations in order"
},
)


@register_mephisto_abstraction()
Expand Down
13 changes: 8 additions & 5 deletions parlai/crowdsourcing/tasks/acute_eval/fast_eval.py
Expand Up @@ -329,12 +329,15 @@ def _build_conversation_pairs(
self.fast_acute_args.matchups_per_pair
* self.fast_acute_args.sufficient_matchups_multiplier
)
# Write random pairs of conversations
# Write pairs of conversations
for model_pair in self.combos:
for _ in range(pairs_per_model):
conversation_indices = [
random.choice(range(len(conversations[m]))) for m in model_pair
]
for i in range(pairs_per_model):
if self.fast_acute_args.randomize_conversations:
conversation_indices = [
random.choice(range(len(conversations[m]))) for m in model_pair
]
else:
conversation_indices = [i for _ in model_pair]
pair = []
pair_ids = []
for i, c_id in enumerate(conversation_indices):
Expand Down

0 comments on commit 5081caa

Please sign in to comment.