fblgit commited on
Commit
8ff98ca
1 Parent(s): cb4d9ac

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -108
README.md CHANGED
@@ -29,116 +29,20 @@ tags:
29
 
30
  Just like my teacher gave me homework, i thought maybe we can also add some of these basics on the trainings of our models.
31
 
32
- It was created with this code, if you add more complex operations and so.. please share the code :D thank you
33
- ```py
34
- import random
35
- # Define the number of samples you want to generate
36
- num_samples = 500000
37
- # Define the range for the random numbers
38
- min_value = -99.99
39
- max_value = 99.99
40
- # Define the arithmetic operations
41
- operations = ['+', '-', '*', '/']
42
- # Generate data
43
- data = []
44
- for _ in range(num_samples):
45
- num1 = float("%.3f" % random.uniform(min_value, max_value))
46
- num2 = float("%.3f" % random.uniform(min_value, max_value))
47
- while num2 == 0.0:
48
- num2 = float("%.3f" % random.uniform(min_value, max_value))
49
- while num1 == 0.0:
50
- num1 = float("%.3f" % random.uniform(min_value, max_value))
51
- operation = random.choice(operations)
52
- if operation == '/':
53
- result = num1 / num2
54
- elif operation == '-':
55
- result = num1 - num2
56
- elif operation == '*':
57
- result = num1 * num2
58
- elif operation == '+':
59
- result = num1 + num2
60
- output = "%.4f" % result
61
- instruction = f"{num1} {operation} {num2}"
62
- data.append({'instruction': instruction, 'output': output})
63
- # Create the dataset
64
- import json
65
- out_file = 'arithmetic-float4a.json'
66
- with open(out_file, 'w') as f:
67
- json.dump(data, f)
68
- ```
69
 
70
- We have also a new community submission for a more complex dataset of 3 elements:
71
- ```py
72
- import random
73
- import json
74
- import operator
 
 
75
 
76
- # Define the number of samples you want to generate
77
- num_samples = 500000
78
- # Define the range for the random numbers
79
- min_value = -99.99
80
- max_value = 99.99
81
- # Define the arithmetic operations and their corresponding functions
82
- operations = {
83
- '+': operator.add,
84
- '-': operator.sub,
85
- '*': operator.mul,
86
- '/': operator.truediv
87
- }
88
 
89
- def generate_random_number():
90
- return float("%.3f" % random.uniform(min_value, max_value))
91
-
92
- def safe_division(numerator, denominator):
93
- return numerator if denominator == 0 else numerator / denominator
94
-
95
- # Generate complex data
96
- data = []
97
- for _ in range(num_samples):
98
- num1 = generate_random_number()
99
- num2 = generate_random_number()
100
- num3 = generate_random_number()
101
- # Ensure num2 and num3 are not zero if they will be used as divisors
102
- if num2 == 0.0:
103
- num2 = generate_random_number()
104
- if num3 == 0.0:
105
- num3 = generate_random_number()
106
-
107
- # Randomly choose two operations
108
- operation1 = random.choice(list(operations.keys()))
109
- operation2 = random.choice(list(operations.keys()))
110
-
111
- # Create a more complex expression
112
- if random.choice([True, False]):
113
- # With parentheses
114
- expression = f"({num1} {operation1} {num2}) {operation2} {num3}"
115
- if operation1 == '/':
116
- intermediate_result = safe_division(num1, num2)
117
- else:
118
- intermediate_result = operations[operation1](num1, num2)
119
- if operation2 == '/' and intermediate_result != 0:
120
- result = safe_division(intermediate_result, num3)
121
- else:
122
- result = operations[operation2](intermediate_result, num3)
123
- else:
124
- # Without parentheses
125
- expression = f"{num1} {operation1} {num2} {operation2} {num3}"
126
- if operation1 == '/':
127
- intermediate_result = safe_division(num1, num2)
128
- else:
129
- intermediate_result = operations[operation1](num1, num2)
130
- if operation2 == '/':
131
- result = safe_division(intermediate_result, num3)
132
- else:
133
- result = operations[operation2](intermediate_result, num3)
134
-
135
- output = "%.4f" % result
136
- data.append({'instruction': expression, 'output': output})
137
-
138
- # Create the dataset
139
- out_file = 'arithmetic-float-complex.json'
140
- with open(out_file, 'w') as f:
141
- json.dump(data, f)
142
- ```
143
  If you use Simple Math o train your model, please cite on the modelcard or the paper.
144
  Thank you
 
29
 
30
  Just like my teacher gave me homework, i thought maybe we can also add some of these basics on the trainings of our models.
31
 
32
+ It was created with very simple code that is in the repo, if you add more complex operations and so.. please share the code :D thank you
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ Note to contributors:
35
+ **thank you to those contributing on the experiment with beautiful commits and good spirit**
36
+ * The model needs some splits
37
+ * The complexity has to be gradual as show in experiments
38
+ * Feel free to contribute on the readme Evaluation tests.
39
+ * Lets aim to build an ablation & paper together. All contributors will be cited.
40
+ * Add your log entry on the version so we can keep a track, thanks.
41
 
42
+ *
43
+ ## Versions
44
+ 24.01.24 Added gradual complexity on a separate script
45
+ 20-23.01.24 Multiple contributions with operations and increased complexity on the main generator script.
 
 
 
 
 
 
 
 
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  If you use Simple Math o train your model, please cite on the modelcard or the paper.
48
  Thank you