|
--- |
|
dataset_info: |
|
features: |
|
- name: instruction |
|
dtype: string |
|
- name: output |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 15268888.05 |
|
num_examples: 487500 |
|
- name: test |
|
num_bytes: 391509.95 |
|
num_examples: 12500 |
|
download_size: 12160789 |
|
dataset_size: 15660398.0 |
|
configs: |
|
- config_name: default |
|
data_files: |
|
- split: train |
|
path: data/train-* |
|
- split: test |
|
path: data/test-* |
|
--- |
|
|
|
# Simple Math |
|
|
|
Just like my teacher gave me homework, i thought maybe we can also add some of these basics on the trainings of our models. |
|
|
|
It was created with this code, if you add more complex operations and so.. please share the code :D thank you |
|
``` |
|
import random |
|
# Define the number of samples you want to generate |
|
num_samples = 500000 |
|
# Define the range for the random numbers |
|
min_value = -99.99 |
|
max_value = 99.99 |
|
# Define the arithmetic operations |
|
operations = ['+', '-', '*', '/'] |
|
# Generate data |
|
data = [] |
|
for _ in range(num_samples): |
|
num1 = float("%.3f" % random.uniform(min_value, max_value)) |
|
num2 = float("%.3f" % random.uniform(min_value, max_value)) |
|
while num2 == 0.0: |
|
num2 = float("%.3f" % random.uniform(min_value, max_value)) |
|
while num1 == 0.0: |
|
num1 = float("%.3f" % random.uniform(min_value, max_value)) |
|
operation = random.choice(operations) |
|
if operation == '/': |
|
result = num1 / num2 |
|
elif operation == '-': |
|
result = num1 - num2 |
|
elif operation == '*': |
|
result = num1 * num2 |
|
elif operation == '+': |
|
result = num1 + num2 |
|
output = "%.4f" % result |
|
instruction = f"{num1} {operation} {num2}" |
|
data.append({'instruction': instruction, 'output': output}) |
|
# Create the dataset |
|
import json |
|
out_file = 'arithmetic-float4a.json' |
|
with open(out_file, 'w') as f: |
|
json.dump(data, f) |
|
``` |
|
|
|
If you use Simple Math o train your model, please cite on the modelcard or the paper. |
|
Thank you |