File size: 2,567 Bytes
515253b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
license: mit
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: test
    path: data/test-*
dataset_info:
  features:
  - name: images
    sequence: string
  - name: problem
    dtype: string
  - name: answer
    dtype: string
  splits:
  - name: train
    num_bytes: 477238
    num_examples: 3000
  - name: test
    num_bytes: 93920
    num_examples: 600
  download_size: 287256
  dataset_size: 571158
language:
- en
size_categories:
- 1K<n<10K
---

Please download [images.tar](images.tar) to your local disk and use `tar -xvf images.tar` to unarchive the image files.

This dataset was mixed with [hiyouga/geometry3k](https://huggingface.co/datasets/hiyouga/geometry3k) and [hiyouga/math12k](https://huggingface.co/datasets/hiyouga/math12k) using the following script.

```python
import os
from functools import partial

from datasets import DatasetDict, Features, Sequence, Value, concatenate_datasets, load_dataset


def process_sample(example: dict, index: int, split: str):
    if "images" in example:
        image = example["images"][0]
        image_path = os.path.join("images", split, f"{index}.png")
        image.save(image_path)
        images = [image_path]
    else:
        images = []

    return {
        "images": images,
        "problem": example["problem"],
        "answer": example["answer"],
    }


def main():
    geo3k = load_dataset("hiyouga/geometry3k")
    math12k = load_dataset("hiyouga/math12k")
    os.makedirs(os.path.join("images", "train"), exist_ok=True)
    os.makedirs(os.path.join("images", "test"), exist_ok=True)
    map_kwargs = {
        "with_indices": True,
        "num_proc": 64,
        "features": Features(
            {"images": Sequence(Value("string")), "problem": Value("string"), "answer": Value("string")}
        ),
    }
    geo3k_train = geo3k["train"].select(range(1500)).map(partial(process_sample, split="train"), **map_kwargs)
    geo3k_test = geo3k["test"].select(range(300)).map(partial(process_sample, split="test"), **map_kwargs)
    math12k_train = math12k["train"].select(range(1500)).map(partial(process_sample, split="train"), **map_kwargs)
    math12k_test = math12k["test"].select(range(300)).map(partial(process_sample, split="test"), **map_kwargs)
    trainset = concatenate_datasets([geo3k_train, math12k_train])
    testset = concatenate_datasets([geo3k_test, math12k_test])
    dataset = DatasetDict({"train": trainset, "test": testset})
    dataset.push_to_hub("hiyouga/rl-mixed-dataset")


if __name__ == "__main__":
    main()
```