Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix empty background issue #27

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion examples/fix_missing_episodes_with_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def get_combo_model_map(
bad_gpt4_rewards_count = 0
bad_combo_count = 0
bad_lite_mode_count = 0
bad_background_count = 0
episodes_to_delete = []

# iterate through episodes
Expand Down Expand Up @@ -181,6 +182,15 @@ def get_combo_model_map(
# bad_lite_mode_count += 1
# continue

# check if the background is present
# if not "lite" in curr_ep.tag:
# concat_text = "\n".join(rendered_ep[:-2])
# if "'s background" not in concat_text:
# print("Background not found in: ", curr_ep.pk)
# episodes_to_delete.append(curr_ep.pk)
# bad_background_count += 1
# continue

if len(interaction_list) <= 5:
# bad_rewards_count += 1
episodes_to_delete.append(curr_ep.pk)
Expand Down Expand Up @@ -211,7 +221,8 @@ def get_combo_model_map(
# episodes_to_delete.append(curr_ep.pk)

bad_combo_count += 1
print("Bad lite mode count: ", bad_lite_mode_count)
# print("Bad lite mode count: ", bad_lite_mode_count)
# print("Bad background count: ", bad_background_count)
# exit(0)
print("-" * 20 + "Deleting Bad Combos" + "-" * 20)
for ep_pk in episodes_to_delete:
Expand Down
13 changes: 10 additions & 3 deletions sotopia/messages/message_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,20 @@ class ScriptBackground(Message):
p2_goal: str = Field(description="goal of participant 2")

def to_natural_language(self) -> str:
if self.p1_background and self.p2_background:
if self.p1_background or self.p2_background:
p1_background = (
self.p1_background if self.p1_background else "Unknown"
)
p2_background = (
self.p2_background if self.p2_background else "Unknown"
)
# Not using AND, since in stranger relation the background is not visible
return format_docstring(
f"""Here is the context of this interaction:
Scenario: {self.scenario}
Participants: {self.p1_name} and {self.p2_name}
{self.p1_name}'s background: {self.p1_background}
{self.p2_name}'s background: {self.p2_background}
{self.p1_name}'s background: {p1_background}
{self.p2_name}'s background: {p2_background}
{self.p1_name}'s goal: {self.p1_goal}
{self.p2_name}'s goal: {self.p2_goal}
"""
Expand Down
2 changes: 2 additions & 0 deletions tests/renderers/test_xml_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def test_renderer_in_env() -> None:
obs["John"].last_turn == "Here is the context of this interaction:\n"
"Scenario: test\n"
"Participants: John and Jane\n"
"John's background: John Doe is a 0-year-old . pronouns. Personality and values description: John's secrets: \n"
"Jane's background: Unknown\n"
"John's goal: agent_1's goal\n"
"Jane's goal: Unknown"
)
Loading