Update README.md
Browse files
README.md
CHANGED
|
@@ -22,3 +22,48 @@ configs:
|
|
| 22 |
- split: test
|
| 23 |
path: data/test-*
|
| 24 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
- split: test
|
| 23 |
path: data/test-*
|
| 24 |
---
|
| 25 |
+
|
| 26 |
+
# Simple Math
|
| 27 |
+
|
| 28 |
+
Just like my teacher gave me homework, i thought maybe we can also add some of these basics on the trainings of our models.
|
| 29 |
+
|
| 30 |
+
It was created with this code, if you add more complex operations and so.. please share the code :D thank you
|
| 31 |
+
```
|
| 32 |
+
import random
|
| 33 |
+
# Define the number of samples you want to generate
|
| 34 |
+
num_samples = 500000
|
| 35 |
+
# Define the range for the random numbers
|
| 36 |
+
min_value = -99.99
|
| 37 |
+
max_value = 99.99
|
| 38 |
+
# Define the arithmetic operations
|
| 39 |
+
operations = ['+', '-', '*', '/']
|
| 40 |
+
# Generate data
|
| 41 |
+
data = []
|
| 42 |
+
for _ in range(num_samples):
|
| 43 |
+
num1 = float("%.3f" % random.uniform(min_value, max_value))
|
| 44 |
+
num2 = float("%.3f" % random.uniform(min_value, max_value))
|
| 45 |
+
while num2 == 0.0:
|
| 46 |
+
num2 = float("%.3f" % random.uniform(min_value, max_value))
|
| 47 |
+
while num1 == 0.0:
|
| 48 |
+
num1 = float("%.3f" % random.uniform(min_value, max_value))
|
| 49 |
+
operation = random.choice(operations)
|
| 50 |
+
if operation == '/':
|
| 51 |
+
result = num1 / num2
|
| 52 |
+
elif operation == '-':
|
| 53 |
+
result = num1 - num2
|
| 54 |
+
elif operation == '*':
|
| 55 |
+
result = num1 * num2
|
| 56 |
+
elif operation == '+':
|
| 57 |
+
result = num1 + num2
|
| 58 |
+
output = "%.4f" % result
|
| 59 |
+
instruction = f"{num1} {operation} {num2}"
|
| 60 |
+
data.append({'instruction': instruction, 'output': output})
|
| 61 |
+
# Create the dataset
|
| 62 |
+
import json
|
| 63 |
+
out_file = 'arithmetic-float4a.json'
|
| 64 |
+
with open(out_file, 'w') as f:
|
| 65 |
+
json.dump(data, f)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
If you use Simple Math o train your model, please cite on the modelcard or the paper.
|
| 69 |
+
Thank you
|