-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
4,025 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# open datasets/text-to-code/java.jsonl and fetch the first 4000 items | ||
# ``` | ||
# output format: | ||
# [{ | ||
# instruction: "text to java code", | ||
# input: items[index].text, | ||
# output: items[index].code | ||
# }] | ||
|
||
import json | ||
|
||
with open('../datasets/text-to-code/java.jsonl', 'r') as f: | ||
data = [json.loads(row) for row in f.readlines()] | ||
|
||
data = data[:4000] | ||
|
||
with open('../datasets/text-to-code/java-train.jsonl', 'w') as f: | ||
for row in data: | ||
item = { | ||
'instruction': 'text to java code', | ||
'input': row['text'], | ||
'output': row['code'] | ||
} | ||
|
||
f.write(json.dumps(item) + '\n') |
Oops, something went wrong.