|
Download README.md from crumb/bf_random_valid: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/datasets/crumb/bf_random_valid/resolve/main/README.md
- Command line
-
hf download hf://datasets/crumb/bf_random_valid/README.md
-
curl -L -o README.md https://huggingface.co/datasets/crumb/bf_random_valid/resolve/main/README.md
1.43 kB
| dataset_info: | |
| features: | |
| - name: code | |
| dtype: string | |
| - name: output | |
| list: int64 | |
| - name: n_cells | |
| dtype: int64 | |
| splits: | |
| - name: train | |
| num_bytes: 15602481 | |
| num_examples: 32768 | |
| download_size: 14512543 | |
| dataset_size: 15602481 | |
| configs: | |
| - config_name: default | |
| data_files: | |
| - split: train | |
| path: data/train-* | |
| ### dataset creation | |
| ```python | |
| import random | |
| from datasets import Dataset | |
| from tqdm.auto import trange | |
| bf = Brainfuck(n_cells = 1024, max_steps = 32768) | |
| SIMPLE = "><+-." | |
| def bf_program(p_continue=0.5, p_loop=0.3, max_depth=6, rng=random): | |
| # glm5.3-flash generated function sorry for my lazy | |
| def sequence(depth): | |
| parts = [] | |
| while rng.random() < p_continue: | |
| if depth > 0 and rng.random() < p_loop: | |
| parts += ["[", *sequence(depth - 1), "]"] | |
| else: | |
| parts.append(rng.choice(SIMPLE)) | |
| return parts | |
| return "".join(sequence(max_depth)) | |
| data = [] | |
| for _ in trange(32_000, miniters=100): | |
| valid = False | |
| output = [] | |
| while valid is False or (len(output) < 3 or len(code) > 256 or len(code)<8 or False not in [i==0 for i in output]): | |
| code = bf_program(p_continue=0.8) | |
| output, valid = bf.run(code) | |
| data.append({ | |
| "code": code, | |
| "output": output, | |
| "n_cells": 1024 | |
| }) | |
| dataset = Dataset.from_list(data) | |
| dataset.push_to_hub("crumb/bf_random_valid") | |
| ``` | |