You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

25 lines
885 B

import os
import csv
fichier = "fineTuning/data_appreciations_generales_tuning.csv"
fichier_out = "fineTuning/finetuning_appreciations_generales_tuning.jsonl"
with open(fichier, 'r') as file:
reader = csv.reader(file,delimiter=';')
data = list(reader)
output = []
prompt=""
content = "Rédige une appréciation générale (500 caractères max) en utilisant la liste suivante qui contient les appréciations au format 'MATIERE':'APPRECIATION'"
for i in range(1, len(data)):
if data[i][3]!="GENERALE":
prompt += "\'"+data[i][3]+"\':\'"+data[i][4]+"\';"
else:
output.append('{"messages": [{"role": "system", "content": "'+content+'"},{"role": "user", "content": "'+prompt+'"},{"role": "assistant", "content": "'+data[i][4]+'"}]}')
prompt = ""
with open(fichier_out, 'w') as fp:
for item in output:
fp.write("%s\n" % item)