File size: 1,753 Bytes
ab769bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599b965
 
 
 
ab769bb
 
 
 
 
 
b674cf4
 
6bccad2
 
 
 
 
 
 
 
b674cf4
 
6bccad2
b674cf4
6bccad2
b674cf4
71e4b7e
 
 
 
 
 
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
---
dataset_info:
  features:
  - name: source
    dtype: string
  - name: task_type
    dtype: string
  - name: in_source_id
    dtype: string
  - name: problem
    dtype: string
  - name: gold_standard_solution
    dtype: string
  - name: problem_id
    dtype: string
  - name: metadata
    struct:
    - name: difficulty
      dtype: string
    - name: memory_limit
      dtype: string
    - name: memory_limit_bytes
      dtype: int64
    - name: problem_url
      dtype: string
    - name: time_limit
      dtype: string
  - name: verification_info
    struct:
    - name: language
      dtype: string
    - name: test_cases
      list:
      - name: fn_name
        dtype: string
      - name: input
        dtype: string
      - name: output
        dtype: string
      - name: type
        dtype: string
  splits:
  - name: train
    num_bytes: 385930754
    num_examples: 27839
  download_size: 235246000
  dataset_size: 385930754
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---
```python
import datasets
import random


def limit_test_cases_uniformly(example, max_test_cases=6):
    num_test_cases = random.randint(1, max_test_cases)
    example['verification_info']['test_cases'] = example['verification_info']['test_cases'][:num_test_cases]
    return example


ds = datasets.load_dataset("open-r1/verifiable-coding-problems-python_decontaminated", split="train")
ds_filtered = ds.map(limit_test_cases_uniformly, num_proc=10)

ds_filtered.push_to_hub("rasdani/verifiable-coding-problems-python_decontaminated_fewer_test_cases")
```

Before:
<img src="before.png" alt="before.png" style="width: 400px; height: auto;">

After:
<img src="after.png" alt="after.png" style="width: 400px; height: auto;">