Update README.md
Browse files
README.md
CHANGED
|
@@ -19,12 +19,40 @@ configs:
|
|
| 19 |
- split: train
|
| 20 |
path: data/train-*
|
| 21 |
---
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
```python
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
```
|
| 30 |
-
|
|
|
|
| 19 |
- split: train
|
| 20 |
path: data/train-*
|
| 21 |
---
|
| 22 |
+
|
| 23 |
+
### dataset creation
|
| 24 |
+
|
| 25 |
```python
|
| 26 |
+
import random
|
| 27 |
+
from datasets import Dataset
|
| 28 |
+
from tqdm.auto import trange
|
| 29 |
+
|
| 30 |
+
bf = Brainfuck(n_cells = 1024, max_steps = 16384)
|
| 31 |
+
SIMPLE = "><+-."
|
| 32 |
+
def bf_program(p_continue=0.5, p_loop=0.3, max_depth=6, rng=random):
|
| 33 |
+
# glm5.3-flash generated function sorry for my lazy
|
| 34 |
+
def sequence(depth):
|
| 35 |
+
parts = []
|
| 36 |
+
while rng.random() < p_continue:
|
| 37 |
+
if depth > 0 and rng.random() < p_loop:
|
| 38 |
+
parts += ["[", *sequence(depth - 1), "]"]
|
| 39 |
+
else:
|
| 40 |
+
parts.append(rng.choice(SIMPLE))
|
| 41 |
+
return parts
|
| 42 |
+
return "".join(sequence(max_depth))
|
| 43 |
+
data = []
|
| 44 |
+
for _ in trange(32_000, miniters=100):
|
| 45 |
+
valid = False
|
| 46 |
+
output = []
|
| 47 |
+
while valid is False or (len(output) < 3 or len(code) > 256):
|
| 48 |
+
code = bf_program(p_continue=0.8)
|
| 49 |
+
output, valid = bf.run(code)
|
| 50 |
+
data.append({
|
| 51 |
+
"code": code,
|
| 52 |
+
"output": output,
|
| 53 |
+
"n_cells": 1024
|
| 54 |
+
})
|
| 55 |
+
dataset = Dataset.from_list(data)
|
| 56 |
+
dataset.push_to_hub("crumb/bf_random_valid")
|
| 57 |
```
|
| 58 |
+
|