DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to sample a text dataset with a DataTrove pipeline with Datatrove

Read a CSV, randomly drop half the documents and write JSONL.

Short answer: Install with uv sync; then import from datatrove.pipeline.readers import CSVReader; add SamplerFilter(rate=0.5) between the reader and JsonlWriter. All steps.

  • Top pick
  • Data and analytics
  • Intermediate
  • 30 minutes
  • From the README
  • Claude Code
  • Codex
  • Cursor
  • Gemini CLI

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

  1. Install with uv sync
  2. Import from datatrove.pipeline.readers import CSVReader
  3. Add SamplerFilter(rate=0.5) between the reader and JsonlWriter
  4. Point data_folder and output_folder at your own paths
  5. 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

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer