-
Notifications
You must be signed in to change notification settings - Fork 23
/
show_samples.py
29 lines (21 loc) · 948 Bytes
/
show_samples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import argparse
import json
def show(database, mode="all"):
for each in database:
test_case = each["test"]
for i, train_case in enumerate(each["train"]):
if each["results"][i]:
print(f"Test case:\n{test_case}\n")
print(f"Train case:\n{train_case}\n")
rephrase_num = sum([1 if True in each["results"] else 0 for each in database])
print(f"Rephrase num: {rephrase_num}")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="LLM Decontaminator")
parser.add_argument("--database_path", type=str, required=True, help="The path to the JSONL database file")
parser.add_argument("--mode", type=str, default="all", help="The mode to show")
args = parser.parse_args()
database_path = args.database_path
mode = args.mode
with open(database_path, "r") as fin:
database = [json.loads(l) for l in fin]
show(database, mode)