Views
No views yet
1import os
2import argparse
3from pathlib import Path
4
5parser = argparse.ArgumentParser("Filter")
6parser.add_argument("--input_path",type=str, help="input path name")
7parser.add_argument("--output_path",type=str, help="output name")
8
9args = parser.parse_args()
10from datatrove.executor import LocalPipelineExecutor
11from datatrove.pipeline.filters import FastTextClassifierFilter
12from datatrove.pipeline.readers import ParquetReader,JsonlReader
13from datatrove.pipeline.writers.jsonl import JsonlWriter
14Path(f"{args.output_path}").mkdir(parents=True,exist_ok=True)
15
16dist_executor = LocalPipelineExecutor(
17 skip_completed=False,
18 pipeline=[
19 JsonlReader(f"{args.input_path}", text_key="text", default_metadata= {}),
20 FastTextClassifierFilter(f"PreSelect-classifier.bin", keep_labels=[("1",0.5)]),
21 JsonlWriter(f"{args.output_path}", compression=None)
22 ],
23 tasks=100,
24)
25dist_executor.run()@article{shum2025predictivedataselectiondata,
title={Predictive Data Selection: The Data That Predicts Is the Data That Teaches},
author={Kashun Shum and Yuzhen Huang and Hongjian Zou and Ding Qi and Yixuan Liao and Xiaoxin Chen and Qian Liu and Junxian He},
journal={arXiv preprint arXiv:2503.00808},
year={2025},
eprint={2503.00808},
}