wflying commited on
Commit
ad078ab
·
verified ·
1 Parent(s): d5ca735

Use datasets library for loading

Browse files

Updates the Loading example to use load_dataset.

Files changed (1) hide show
  1. README.md +5 -14
README.md CHANGED
@@ -79,24 +79,15 @@ Because `label` and parts of `metadata` have mixed JSON types, preserve them as
79
 
80
  ## Loading
81
 
82
- Direct JSONL reading preserves every value exactly:
83
 
84
  ```python
85
- import json
86
- from huggingface_hub import hf_hub_download
87
 
88
- path = hf_hub_download(
89
- repo_id="wflying/rl-if-math-coding-logic-60k",
90
- repo_type="dataset",
91
- filename="rl-if-math-coding-logic-60k.jsonl",
92
  )
93
-
94
- with open(path, encoding="utf-8") as file:
95
- for line in file:
96
- example = json.loads(line)
97
- prompt = example["prompt"]
98
- label = example["label"]
99
- metadata = example["metadata"]
100
  ```
101
 
102
  Users who require `datasets.Dataset` should first normalize heterogeneous JSON fields or define an explicit schema appropriate for their training stack.
 
79
 
80
  ## Loading
81
 
82
+ Load the dataset with the Hugging Face `datasets` library:
83
 
84
  ```python
85
+ from datasets import load_dataset
 
86
 
87
+ dataset = load_dataset(
88
+ "wflying/rl-if-math-coding-logic-60k",
89
+ split="train",
 
90
  )
 
 
 
 
 
 
 
91
  ```
92
 
93
  Users who require `datasets.Dataset` should first normalize heterogeneous JSON fields or define an explicit schema appropriate for their training stack.