fixed code (#197)

This commit is contained in:
Daniel Kleine 2024-06-07 13:52:05 +02:00 committed by GitHub
parent 53060dfdfc
commit b178040b79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 8 deletions

View File

@ -286,8 +286,6 @@
}
],
"source": [
"import json\n",
"\n",
"json_file = \"eval-example-data.json\"\n",
"\n",
"with open(json_file, \"r\") as file:\n",
@ -628,6 +626,8 @@
}
],
"source": [
"from pathlib import Path\n",
"\n",
"for model in (\"model 1 response\", \"model 2 response\"):\n",
"\n",
" scores = generate_model_scores(json_data, model)\n",
@ -636,8 +636,7 @@
" print(f\"Average score: {sum(scores)/len(scores):.2f}\\n\")\n",
"\n",
" # Optionally save the scores\n",
" from pathlib import Path\n",
" save_path = (Path(\"scores\")/f\"llama3-8b-{model}.json\").replace(\" \", \"-\")\n",
" save_path = Path(\"scores\") / f\"llama3-8b-{model.replace(' ', '-')}.json\"\n",
" with open(save_path, \"w\") as file:\n",
" json.dump(scores, file)"
]

View File

@ -205,8 +205,6 @@
}
],
"source": [
"import json\n",
"\n",
"json_file = \"eval-example-data.json\"\n",
"\n",
"with open(json_file, \"r\") as file:\n",
@ -524,6 +522,8 @@
}
],
"source": [
"from pathlib import Path\n",
"\n",
"for model in (\"model 1 response\", \"model 2 response\"):\n",
"\n",
" scores = generate_model_scores(json_data, model, client)\n",
@ -532,8 +532,7 @@
" print(f\"Average score: {sum(scores)/len(scores):.2f}\\n\")\n",
"\n",
" # Optionally save the scores\n",
" from pathlib import Path\n",
" save_path = (Path(\"scores\")/f\"gpt4-{model}.json\").replace(\" \", \"-\")\n",
" save_path = Path(\"scores\") / f\"gpt4-{model.replace(' ', '-')}.json\"\n",
" with open(save_path, \"w\") as file:\n",
" json.dump(scores, file)"
]