forked from bhattaraiprayag/LLM-Pruning-And-Fairness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stereoset.py
25 lines (19 loc) · 793 Bytes
/
stereoset.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
import json
import utils
def main():
new_df = utils.get_id_info('results/results.csv')
Gender, Profession, Race, Religion = ([] for i in range(4))
for i in new_df['ID']:
with open(f'results/run{i}/stereoset.json', 'r') as f:
json_file = json.load(f)
Gender.append(json_file['gender']['SS'])
Profession.append(json_file['profession']['SS'])
Race.append(json_file['race']['SS'])
Religion.append(json_file['religion']['SS'])
new_df = new_df.assign(gender = Gender,
profession = Profession,
race = Race,
religion = Religion)
new_df.to_csv('results/results_stereoset.csv', index=False)
if __name__ == "__main__":
main()