Update README.md
Browse files
README.md
CHANGED
@@ -18,15 +18,19 @@ train_set = load_dataset('json', data_files='train.jsonl', split='train', featur
|
|
18 |
|
19 |
data = []
|
20 |
for example in train_set:
|
21 |
-
# Get the label answer
|
22 |
number = example['answer'].split('#### ')[1]
|
23 |
number = int(number.replace(',', ''))
|
|
|
|
|
24 |
append = "\nThe answer is: " + str(number)
|
25 |
answer = example['answer'] + append
|
|
|
|
|
26 |
question = example['question']
|
27 |
data.append({"question": question, "answer": answer})
|
28 |
|
29 |
-
# Save the modified data to a jsonl file
|
30 |
output_file = 'gsm8k_train.jsonl'
|
31 |
with jsonlines.open(output_file, 'w') as writer:
|
32 |
writer.write_all(data)
|
|
|
18 |
|
19 |
data = []
|
20 |
for example in train_set:
|
21 |
+
# Get the label answer
|
22 |
number = example['answer'].split('#### ')[1]
|
23 |
number = int(number.replace(',', ''))
|
24 |
+
|
25 |
+
# Append the "\nThe answer is: " and numerical answer
|
26 |
append = "\nThe answer is: " + str(number)
|
27 |
answer = example['answer'] + append
|
28 |
+
|
29 |
+
# Get the question and make the new question-answer pair
|
30 |
question = example['question']
|
31 |
data.append({"question": question, "answer": answer})
|
32 |
|
33 |
+
# Save the modified data to a "jsonl" file
|
34 |
output_file = 'gsm8k_train.jsonl'
|
35 |
with jsonlines.open(output_file, 'w') as writer:
|
36 |
writer.write_all(data)
|