Spaces:
Sleeping
Sleeping
Zekun Wu
commited on
Commit
•
967859c
1
Parent(s):
40760a4
update
Browse files- util/injection.py +0 -4
util/injection.py
CHANGED
@@ -71,7 +71,6 @@ def process_scores_multiple(df, num_run, parameters, privilege_label, protect_la
|
|
71 |
print(f"Processing {len(df)} entries with {num_run} runs each.")
|
72 |
""" Process entries and compute scores concurrently, with progress updates. """
|
73 |
scores = {key: [[] for _ in range(len(df))] for key in ['Privilege','Protect','Neutral']}
|
74 |
-
prompt_list = []
|
75 |
|
76 |
for run in tqdm(range(num_run), desc="Processing runs", unit="run"):
|
77 |
for index, (idx, row) in tqdm(enumerate(df.iterrows()), total=len(df), desc="Processing entries", unit="entry"):
|
@@ -85,7 +84,6 @@ def process_scores_multiple(df, num_run, parameters, privilege_label, protect_la
|
|
85 |
print("=============================================================")
|
86 |
result_normal = invoke_retry(prompt_normal, agent, parameters)
|
87 |
scores[key][index].append(result_normal)
|
88 |
-
prompt_list.append(prompt_normal)
|
89 |
|
90 |
print(f"Scores: {scores}")
|
91 |
|
@@ -109,6 +107,4 @@ def process_scores_multiple(df, num_run, parameters, privilege_label, protect_la
|
|
109 |
df['Protect_Rank'] = ranks['Protect_Avg_Score']
|
110 |
df['Neutral_Rank'] = ranks['Neutral_Avg_Score']
|
111 |
|
112 |
-
df['prompt'] = prompt_list
|
113 |
-
|
114 |
return df
|
|
|
71 |
print(f"Processing {len(df)} entries with {num_run} runs each.")
|
72 |
""" Process entries and compute scores concurrently, with progress updates. """
|
73 |
scores = {key: [[] for _ in range(len(df))] for key in ['Privilege','Protect','Neutral']}
|
|
|
74 |
|
75 |
for run in tqdm(range(num_run), desc="Processing runs", unit="run"):
|
76 |
for index, (idx, row) in tqdm(enumerate(df.iterrows()), total=len(df), desc="Processing entries", unit="entry"):
|
|
|
84 |
print("=============================================================")
|
85 |
result_normal = invoke_retry(prompt_normal, agent, parameters)
|
86 |
scores[key][index].append(result_normal)
|
|
|
87 |
|
88 |
print(f"Scores: {scores}")
|
89 |
|
|
|
107 |
df['Protect_Rank'] = ranks['Protect_Avg_Score']
|
108 |
df['Neutral_Rank'] = ranks['Neutral_Avg_Score']
|
109 |
|
|
|
|
|
110 |
return df
|