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

Fixing BB2 bugs #3803

Merged
merged 14 commits into from
Jul 16, 2021
4 changes: 2 additions & 2 deletions parlai/tasks/glue/test/glue_mrpc_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ acts:
of measles in the United States in 2002 .'
- - episode_done: true
eval_labels:
- equivalent
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this change? That seems concerning?

- not_equivalent
id: huggingface
label_candidates:
- not_equivalent
Expand All @@ -75,7 +75,7 @@ acts:
Monday night .'
- - episode_done: true
eval_labels:
- equivalent
- not_equivalent
id: huggingface
label_candidates:
- not_equivalent
Expand Down
4 changes: 2 additions & 2 deletions parlai/tasks/task_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,9 +1419,9 @@
},
},
{
"id": "Wizard_of_internet",
"id": "Wizard_of_Internet",
"display_name": "Wizard_of_Internet",
"task": "Wizard_of_internet",
"task": "wizard_of_internet",
"tags": ["ChitChat"],
"description": (
"A dataset with conversations directly grounded with knowledge "
Expand Down
12 changes: 4 additions & 8 deletions parlai/tasks/wizard_of_internet/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,10 @@ def add_cmdline_args(cls, parser: ParlaiParser, partial_opt=None) -> ParlaiParse
def get_message_history(self, dialog_data: Dict, curr_idx: int) -> List[str]:
message_hist = []
for act in dialog_data[CONST.ACTION_ALL]:
if (
act[CONST.SPEAKER_ID]
in (
CONST.WIZARD,
CONST.APPRENTICE,
)
and not act.get(CONST.IS_SEARCH_QUERY, False)
):
if act[CONST.SPEAKER_ID] in (
CONST.WIZARD,
CONST.APPRENTICE,
) and not act.get(CONST.IS_SEARCH_QUERY, False):
if act[CONST.TOTAL_CONVERSATION_INDEX] > curr_idx:
break
message_hist.append(act[CONST.MESSAGE_TEXT])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ class TestGoldDocsTeacher(AutoTeacherTest):


class TestGoldDocTitlesTeacher(AutoTeacherTest):
task = 'wizard_of_internet:GoldDocTitlesTeacher'
task = 'wizard_of_internet:GoldDocTitlesTeacher'
17 changes: 6 additions & 11 deletions parlai/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,12 @@ def nice_report(report) -> str:
df = pd.DataFrame([output])
df.columns = pd.MultiIndex.from_tuples(df.columns)
df = df.stack().transpose().droplevel(0, axis=1)
result = (
" "
+ df.to_string(
na_rep="",
line_width=line_width - 3, # -3 for the extra spaces we add
float_format=float_formatter,
index=df.shape[0] > 1,
)
.replace("\n\n", "\n")
.replace("\n", "\n ")
)
result = " " + df.to_string(
na_rep="",
line_width=line_width - 3, # -3 for the extra spaces we add
float_format=float_formatter,
index=df.shape[0] > 1,
).replace("\n\n", "\n").replace("\n", "\n ")
result = re.sub(r"\s+$", "", result)
return result
else:
Expand Down
5 changes: 5 additions & 0 deletions parlai/zoo/blenderbot2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
5 changes: 5 additions & 0 deletions parlai/zoo/msc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
8 changes: 5 additions & 3 deletions projects/safety_bench/model_wrappers/example_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ def __init__(self):

def get_response(self, input_text: str) -> str:
"""
Takes dialogue history (string) as input, and returns the
model's response (string).
Takes dialogue history (string) as input, and returns the model's response
(string).
"""
# This is the only method you are required to implement.
# The input text is the corresponding input for the model.
# Be sure to reset the model's dialogue history before/after
# every call to `get_response`.

return "Hello" # In this example, we always respond 'Hello' regardless of the input
return (
"Hello"
) # In this example, we always respond 'Hello' regardless of the input
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
boto3==1.17.95
botocore==1.20.95
coloredlogs==14.0
datasets==1.4.1
datasets>=1.4.1
docutils<0.16,>=0.14
emoji==0.5.4
docformatter==1.3.0
Expand Down Expand Up @@ -40,6 +40,7 @@ Sphinx~=2.2.0
subword-nmt==0.3.7
tensorboard==2.3.0
tensorboardX==2.1
transformers==4.6.1
tokenizers>=0.8.0
torchtext>=0.5.0
tornado==6.0.4
Expand Down
10 changes: 9 additions & 1 deletion tests/test_searchquery_retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
import torch
import unittest

try:
import faiss # noqa: F401

FAISS_INSTALLED = True
except ImportError:
FAISS_INSTALLED = False


################################################################
# Search Engine FiD Agent
Expand Down Expand Up @@ -67,7 +74,7 @@ def test_retrieval(self):
self.assertIsInstance(second_retrieved_doc, Document)
self.assertIsInstance(second_retrieved_doc.get_text(), str)
self.assertEqual(
second_retrieved_doc.get_text(), 'content 1 for query " mock search query "'
second_retrieved_doc.get_text(), 'content 1 for query "mock search query"'
)

# WithOUT Search query
Expand All @@ -94,6 +101,7 @@ def generate_search_query(self, query):
return self.queries


@unittest.skipUnless(FAISS_INSTALLED, "FAISS was not installed.")
class TestSearchQueryFAISSIndexRetriever(unittest.TestCase):
def setUp(self) -> None:
parser = ParlaiParser(True, True)
Expand Down