Who it is forAn engineer building a smaller training subset from a large corpus.
The problemHand written scripts for reading, filtering and writing documents do not scale or compose.
The outcomeA folder of JSONL files holding roughly half of your documents.
What you need first
- Python 3.11 or newer
- uv for installing
- Input text data such as CSV, JSONL or parquet
Steps
- Install with
uv sync - Import
from datatrove.pipeline.readers import CSVReader - Add
SamplerFilter(rate=0.5)between the reader andJsonlWriter - Point
data_folderandoutput_folderat your own paths - Run the pipeline with an executor
Prompt for your agent
Using huggingface/datatrove, run `uv sync`, then build a pipeline with `CSVReader`, `SamplerFilter(rate=0.5)` and `JsonlWriter` for my data folder and run it.
Caveat. This card is written from the huggingface/datatrove README, not from a test run by Deduped. Before you start, make sure you have Python 3.11 or newer. Check the repo for newer instructions before you rely on these steps.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for huggingface/datatrove and "Sample a text dataset with a DataTrove pipeline"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer