Skip to content

Commit 1b9afd1

Browse files
authored
update to v1.3.0 (#627)
* improve docs for refactoring PR * update to v1.3.0 * remove redudant toc
1 parent e96ca33 commit 1b9afd1

File tree

5 files changed

+150
-34
lines changed

5 files changed

+150
-34
lines changed

README.md

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,36 +76,6 @@ Besides, our paper is also updated to [v3](https://arxiv.org/abs/2309.02033).
7676
Table of Contents
7777
=================
7878

79-
- [Data Processing for and with Foundation Models](#data-processing-for-and-with-foundation-models)
80-
- [News](#news)
81-
- [Table of Contents](#table-of-contents)
82-
- [Why Data-Juicer?](#why-data-juicer)
83-
- [DJ-Cookbook](#dj-cookbook)
84-
- [Curated Resources](#curated-resources)
85-
- [Coding with Data-Juicer (DJ)](#coding-with-data-juicer-dj)
86-
- [Use Cases \& Data Recipes](#use-cases--data-recipes)
87-
- [Interactive Examples](#interactive-examples)
88-
- [Installation](#installation)
89-
- [Prerequisites](#prerequisites)
90-
- [From Source](#from-source)
91-
- [Using pip](#using-pip)
92-
- [Using Docker](#using-docker)
93-
- [Installation check](#installation-check)
94-
- [For Video-related Operators](#for-video-related-operators)
95-
- [Quick Start](#quick-start)
96-
- [Dataset configuration](#dataset-configuration)
97-
- [Data Processing](#data-processing)
98-
- [Distributed Data Processing](#distributed-data-processing)
99-
- [Data Analysis](#data-analysis)
100-
- [Data Visualization](#data-visualization)
101-
- [Build Up Config Files](#build-up-config-files)
102-
- [Sandbox](#sandbox)
103-
- [Preprocess Raw Data (Optional)](#preprocess-raw-data-optional)
104-
- [For Docker Users](#for-docker-users)
105-
- [License](#license)
106-
- [Contributing](#contributing)
107-
- [Acknowledgement](#acknowledgement)
108-
- [References](#references)
10979
- [News](#news)
11080
- [Why Data-Juicer?](#why-data-juicer)
11181
- [DJ-Cookbook](#dj-cookbook)
@@ -121,6 +91,7 @@ Table of Contents
12191
- [Installation check](#installation-check)
12292
- [For Video-related Operators](#for-video-related-operators)
12393
- [Quick Start](#quick-start)
94+
- [Dataset Configuration](#dataset-configuration)
12495
- [Data Processing](#data-processing)
12596
- [Distributed Data Processing](#distributed-data-processing)
12697
- [Data Analysis](#data-analysis)
@@ -332,19 +303,19 @@ Check if your environment path is set correctly by running the ffmpeg command fr
332303
DJ supports various dataset input types, including local files, remote datasets like huggingface; it also supports data validation and data mixture.
333304

334305
Two ways to configure a input file
335-
- legacy way
306+
- Simple scenarios, single path for local/HF file
336307
```yaml
337308
dataset_path: '/path/to/your/dataset' # path to your dataset directory or file
338309
```
339-
- updated way
310+
- advanced method, supports sub-configuration items and more features
340311
```yaml
341312
dataset:
342313
configs:
343314
- type: 'local'
344315
path: 'path/to/your/dataset' # path to your dataset directory or file
345316
```
346317

347-
Refer to [Dataset Configuration Guide](data_juicer/core/data/README.md) for more details.
318+
Refer to [Dataset Configuration Guide](docs/DatasetCfg.md) for more details.
348319

349320

350321

README_ZH.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Data-Juicer正在积极更新和维护中,我们将定期强化和新增更多
8585
- [安装校验](#安装校验)
8686
- [使用视频相关算子](#使用视频相关算子)
8787
- [快速上手](#快速上手)
88+
- [数据集配置](#数据集配置)
8889
- [数据处理](#数据处理)
8990
- [分布式数据处理](#分布式数据处理)
9091
- [数据分析](#数据分析)
@@ -281,6 +282,24 @@ print(dj.__version__)
281282
<p align="right"><a href="#table">🔼 back to index</a></p>
282283

283284
## 快速上手
285+
### 数据集配置
286+
287+
DJ 支持多种数据集输入类型,包括本地文件、远程数据集(如 huggingface);还支持数据验证和数据混合。
288+
289+
配置输入文件的两种方法
290+
- 简单场景,本地/HF 文件的单一路径
291+
```yaml
292+
dataset_path: '/path/to/your/dataset' # 数据集目录或文件的路径
293+
```
294+
- 高级方法,支持子配置项和更多功能
295+
```yaml
296+
dataset:
297+
configs:
298+
- type: 'local'
299+
path: 'path/to/your/dataset' # 数据集目录或文件的路径
300+
```
301+
302+
更多详细信息,请参阅 [数据集配置指南](docs/DatasetCfg_ZH.md)。
284303

285304
### 数据处理
286305

data_juicer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '1.2.2'
1+
__version__ = '1.3.0'
22

33
import os
44
import subprocess

data_juicer/core/data/README.md renamed to docs/DatasetCfg.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Dataset Configuration Guide
2+
EN | [中文](DatasetCfg_ZH.md)
23

34
This guide provides an overview of how to configure datasets using YAML format in the Data-Juicer framework. The configurations allow you to specify local and remote datasets, with data validation rules.
45

docs/DatasetCfg_ZH.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# 数据集配置指南
2+
中文 | [EN](DatasetCfg.md)
3+
4+
本指南概述了如何在 Data-Juicer 框架中使用 YAML 格式配置数据集。允许您指定本地和远程数据集以及数据验证规则。
5+
6+
## 支持的数据集格式
7+
8+
### 本地数据集
9+
10+
`local_json.yaml` 配置文件用于指定以 JSON 格式本地存储的数据集。*path* 是必需的,用于指定本地数据集路径,可以是单个文件或目录。*format* 是可选的,用于指定数据集格式。
11+
对于本地文件,DJ 将自动检测文件格式并相应地加载数据集。支持 parquet、jsonl、json、csv、tsv、txt 和 jsonl.gz 等格式
12+
有关更多详细信息,请参阅 [local_json.yaml](https://github.com/data-juicer/data-juicer/blob/main/configs/datasets/local_json.yaml)
13+
```yaml
14+
dataset:
15+
configs:
16+
- type: local
17+
path: path/to/your/local/dataset.json
18+
format: json
19+
```
20+
21+
```yaml
22+
dataset:
23+
configs:
24+
- type: local
25+
path: path/to/your/local/dataset.parquet
26+
format: parquet
27+
```
28+
29+
### Remote Huggingface 数据集
30+
31+
`remote_huggingface.yaml` 配置文件用于指定 huggingface 数据集。*type* 和 *source* 固定为 'remote' 和 'huggingface',以定位 huggingface 加载逻辑。*path* 是必需的,用于标识 huggingface 数据集。*name*、*split* 和 *limit* 是可选的,用于指定数据集名称/拆分并限制要加载的样本数量。
32+
更多详细信息请参阅 [remote_huggingface.yaml](https://github.com/data-juicer/data-juicer/blob/main/configs/datasets/remote_huggingface.yaml)。
33+
34+
```yaml
35+
dataset:
36+
configs:
37+
- type: 'remote'
38+
source: 'huggingface'
39+
path: "HuggingFaceFW/fineweb"
40+
name: "CC-MAIN-2024-10"
41+
split: "train"
42+
limit: 1000
43+
```
44+
45+
### 远程 Arxiv 数据集
46+
47+
`remote_arxiv.yaml` 配置文件用于指定以 JSON 格式远程存储的数据集。*type* 和 *source* 固定为 'remote' 和 'arxiv',以定位 arxiv 加载逻辑。 *lang*、*dump_date*、*force_download* 和 *url_limit* 是可选的,用于指定数据集语言、转储日期、强制下载和 URL 限制。
48+
有关更多详细信息,请参阅 [remote_arxiv.yaml](https://github.com/data-juicer/data-juicer/blob/main/configs/datasets/remote_arxiv.yaml)。
49+
50+
```yaml
51+
dataset:
52+
configs:
53+
- type: 'remote'
54+
source: 'arxiv'
55+
lang: 'en'
56+
dump_date: 'latest'
57+
force_download: false
58+
url_limit: 2
59+
```
60+
61+
### 其他支持的数据集格式
62+
63+
有关更多详细信息和支持的数据集格式,请参阅 [load_strategy.py](https://github.com/data-juicer/data-juicer/blob/main/data_juicer/core/data/load_strategy.py)。
64+
65+
## 其他功能
66+
67+
### 数据混合
68+
69+
`mixture.yaml` 配置文件演示了如何指定数据混合规则。DJ 将通过对数据集的一部分进行采样并应用适当的权重来混合数据集。
70+
有关更多详细信息,请参阅 [mixture.yaml](https://github.com/data-juicer/data-juicer/blob/main/configs/datasets/mixture.yaml)。
71+
```yaml
72+
dataset:
73+
max_sample_num: 10000
74+
configs:
75+
- type: 'local'
76+
weight: 1.0
77+
path: 'path/to/json/file'
78+
- type: 'local'
79+
weight: 1.0
80+
path: 'path/to/csv/file'
81+
```
82+
83+
### 数据验证
84+
85+
`validator.yaml` 配置文件演示了如何指定数据验证规则。DJ 将通过对数据集的一部分进行采样并应用验证规则来验证数据集。
86+
有关更多详细信息和支持的验证器,请参阅 [data_validator.py](https://github.com/data-juicer/data-juicer/blob/main/data_juicer/core/data/data_validator.py)。
87+
```yaml
88+
dataset:
89+
configs:
90+
- type: local
91+
path: path/to/data.json
92+
93+
validators:
94+
- type: swift_messages
95+
min_turns: 2
96+
max_turns: 20
97+
sample_size: 1000
98+
- type: required_fields
99+
required_fields:
100+
- "text"
101+
- "metadata"
102+
- "language"
103+
field_types:
104+
text: "str"
105+
metadata: "dict"
106+
language: "str"
107+
```
108+
109+
### 旧版 dataset_path 配置
110+
111+
`dataset_path` 配置是指定数据集路径的历史版本方式。它简单易用,但缺乏灵活性。它可以在 yaml 或命令行输入中使用。一些示例:
112+
113+
命令行输入:
114+
```bash
115+
# 命令行输入
116+
dj-process --dataset_path path/to/your/dataset.json
117+
118+
# 带权重的命令行输入
119+
dj-process --dataset_path 0.5 path/to/your/dataset1.json 0.5 path/to/your/dataset2.json
120+
```
121+
122+
Yaml 输入:
123+
```yaml
124+
dataset_path:path/to/your/dataset.json
125+
```

0 commit comments

Comments
 (0)