File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 88# open datasets/sql/prompts.json
99# create id map for prompts in datasets/sql/prompts.json
1010id_prompt_map = {}
11- with open ('../datasets/sql/prompts.json' , 'r' ) as f :
11+ with open ('../datasets/sql/llm- prompts.json' , 'r' ) as f :
1212 data = json .loads (f .read ())
1313 for row in data :
14- id_prompt_map [row ['id' ]] = row ['prompt ' ]
14+ id_prompt_map [row ['id' ]] = row ['requiredType ' ]
1515
1616
1717with open ('../datasets/sql/repositories-5k.jsonl' , 'r' ) as f :
1818 data = [json .loads (row ) for row in f .readlines ()]
1919
2020 with open ('../datasets/sql/repository-5k-train.jsonl' , 'w' ) as f :
2121 for row in data :
22- print ( row )
22+ requiredType = ""
2323 id = int (row ['id' ])
24+ if id in id_prompt_map :
25+ # id_prompt_map[id] is a list, check if it is empty
26+ if id_prompt_map [id ]:
27+ requiredType = "###" + " " .join (id_prompt_map [id ]) + "###"
28+
2429 item = {
2530 'instruction' : 'text to kotlin repository with class' ,
26- 'input' : row ['output' ],
31+ 'input' : row ['output' ] + " \n " + requiredType ,
2732 'output' : row ['input' ]
2833 }
2934
30- f .write (json .dumps (item ) + '\n ' )
31-
35+ f .write (json .dumps (item ) + '\n ' )
3236
3337 # 5kl to csv
3438 with open ('../datasets/sql/repository-5k.csv' , 'w' ) as f :
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments