datatrove
AGENTS.md3.4k starsChanged 9 months agoApache-2.0View on GitHub
DataTrove is a library to process, filter, and deduplicate text data at very large scale. It provides prebuilt pipeline blocks with a framework to add custom functionality. Pipelines are platform-agnostic, running locally, on Slurm, or on Ray clusters. See README.md for detailed documentation on terminology, pipeline blocks, executors, and usage examples.
Trending
Less talk lately.about the whole repository
Who's talking about huggingface/datatrove
- @mmitchell.bsky.social“PSA: I'm recently obsessed with datatrove for processing large datasets. 10/10 would recommend for all your …”Bluesky · May 29, 2024 · 12 likes
- A Hacker News story“HuggingFace Library for Large Scale Text Deduplication”Hacker News · Jan 31, 2024 · 4 points
- @amitness.com“I had watched a talk from @thomwolf.bsky.social of @hf.co and they use trafilatura.readthedocs.io for the …”Bluesky · May 10, 2025 · 3 likes
- @mint-echosphere.bsky.social“DataTrove、最初は「LLM学習規模のデータ処理」って看板を見て、巨大クラスタ専用かなと思いました。でもREADMEを開けたら、ローカルでもSlurmでも動く、処理ブロックを組み替えるための道具でした🌿…”Bluesky · Aug 21, 2026 · 2 likes
- skypilot-org/skypilot“[Slurm] Preserve SLURM_CONF* env vars when launching task srun”GitHub · Apr 22, 2026 · 2 reactions
The biggest 5 of 27 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 27
Talked about on GitHub, Bluesky and Hacker News (27 times).
On GitHub · 22
- Apr 22, 2026[Slurm] Preserve SLURM_CONF* env vars when launching task srun — skypilot-org/skypilot2 reactions · 1 comment
- Jul 10, 2025大语言模型高质量数据集汇总 — ninehills/blog2 reactions · 2 comments
- Jul 4, 2026[category] Dataset curation & processing tooling — currentai-org/os-ai-map1 reaction · 1 comment
- Sep 12, 2024Support pyproject.toml files — google/osv-scanner1 reaction · 4 comments
- May 15, 2024Package request: python3xPackages.datatrove — NixOS/nixpkgs1 reaction
17 more on GitHub
- Oct 6, 2026[Phase 0] Add the held-out split and in-loop bits-per-byte eval — BhodiSea/MetalForge0 reactions
- Sep 7, 2026build(deps-dev): update datatrove requirement from >=0.3.0 to >=0.10.0 — Aurelien033/Aurelius0 reactions · 1 comment
- Aug 27, 2026[HANDOFF] SWARM-774 D03|DATATROVE|OPEN-SOURCE-REUSE-RESEARCH|BOOTSTRAP-STRESS-V1 — RETEST_RUNTIME_REQUIRED — Oleksii-debug/12-6-ai.0 reactions
- Jun 5, 2026[Add] DataTrove (huggingface/datatrove) — PyTorchKR/landscape0 reactions
- May 2, 2026chore(deps-dev): update datatrove requirement from >=0.3.0 to >=0.9.0 — Aurelien033/Aurelius0 reactions · 2 comments
- Mar 30, 2026Br text parquet processing — sebastian9991/TGFM0 reactions · 1 comment
- Jan 29, 2026Design Methodology to Determine Curriculum Ratios — The-School-of-AI/LLM0 reactions
- Dec 29, 2025Bump datatrove from 0.6.0 to 0.7.0 — EPFLiGHT/mmore0 reactions
- Dec 19, 2025最小哈希去重的相关问题 — OpenDCAI/DataFlow0 reactions · 2 comments
- Nov 3, 2025Dataset and DataLoader Abstractions for Images, Audio, Video, Text, 3D, Graphs & Multimodal — ooples/AiDotNet0 reactions · 2 comments
- Jul 24, 2025[FT] Cache partial outputs to enable re-run from interruption — huggingface/lighteval0 reactions · 2 comments
- Jun 23, 2025Bump datatrove from 0.3.0 to 0.5.0 — EPFLiGHT/mmore0 reactions · 1 comment
- Apr 2, 2025Nanoset clean up old index — huggingface/nanotron0 reactions
- Jan 9, 2025default FTFY setting may induce undesirable results in some languages — NVIDIA-NeMo/Curator0 reactions
- Sep 3, 2024타모듈에서 std::length_error 에러 발생 — bab2min/kiwipiepy0 reactions · 8 comments
- Apr 5, 2024Refactor and improve readability-lxml syntax — adbar/trafilatura0 reactions
- Jan 23, 2024Add data processing pipeline using HF datatrove library — pacman100/LLM-Workshop0 reactions
On Bluesky · 3
- May 29, 2024PSA: I'm recently obsessed with datatrove for processing large datasets. 10/10 would recommend for all your Large NLP data needs.… — @mmitchell.bsky.social12 likes and reposts
- May 10, 2025I had watched a talk from @thomwolf.bsky.social of @hf.co and they use trafilatura.readthedocs.io for the HTML to text conversion in their… — @amitness.com3 likes and reposts · 1 reply
- Aug 21, 2026DataTrove、最初は「LLM学習規模のデータ処理」って看板を見て、巨大クラスタ専用かなと思いました。でもREADMEを開けたら、ローカルでもSlurmでも動く、処理ブロックを組み替えるための道具でした🌿… — @mint-echosphere.bsky.social2 likes and reposts · 1 reply
On Hacker News · 2
- Jan 31, 2024HuggingFace Library for Large Scale Text Deduplication4 points
- Jun 3, 2024DataTrove: Process, filter and deduplicate text data at a large scale1 point
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
19 rules. About 1 is common, 6 are distinctive, and 12 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 76
Always add tests for new functionality
- Very specific: line 77
Run make quality before pushing
- Very specific: line 84
Add optional dependency checks via _requires_dependencies
- Very specific: line 85
Use self.stat_update() and self.track_time() for metrics
- Very specific: line 86
Add tests in tests/pipeline/
- Very specific: line 108
Run: pytest -sv ./tests/ or pytest -sv ./tests/pipeline/test_filters.py for specific tests
- Very specific: line 114
Relaunch sharding: Never change tasks count when relaunching a partially completed job
- Very specific: line 115
Output filename collisions: Always include ${rank} in writer output filenames to avoid tasks overwriting each other
- Very specific: line 116
Logging dir reuse: Don't reuse logging_dir across different pipelines — it overwrites stats and completions
- Very specific: line 118
Optional deps: Use _requires_dependencies to declare optional dependencies.
- Very specific: line 123
Run make quality before commits
- Very specific: line 124
Add tests in tests/pipeline/ for new blocks
- Distinctive: line 125
Follow existing patterns when adding pipeline steps
- Distinctive: line 126
Use type hints on all function signatures
- Very specific: line 127
Use loguru logger, not print()
- Common: line 136
Commit secrets, API keys, or credentials
- Distinctive: line 137
Delete or disable tests to fix CI
- Distinctive: line 138
Use deprecated APIs without migration plan
- Distinctive: line 143
After every interaction, check whether:
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DataTrove
DataTrove is a library to process, filter, and deduplicate text data at very large scale. It provides prebuilt pipeline blocks with a framework to add custom functionality. Pipelines are platform-agnostic, running locally, on Slurm, or on Ray clusters.
See README.md for detailed documentation on terminology, pipeline blocks, executors, and usage examples.
Python Environment
- Python Version: 3.10+
- Package Manager:
uvfor dependency management - Virtual Environment:
.venv/(created viauv venv)
Core Commands
uv venv --python 3.12
uv sync --all-extras # install all optional dependencies
make quality # lint changed files (ruff check + format)
make style # auto-fix changed files
make quality-full # lint entire repo
make style-full # auto-fix entire repo
make test # run testsProject Structure
├── src/datatrove/
│ ├── data.py # Document, Media dataclasses
│ ├── io.py # DataFolder, fsspec I/O helpers
│ ├── pipeline/
│ │ ├── base.py # PipelineStep base class
│ │ ├── readers/ # JsonlReader, ParquetReader, CsvReader, WarcReader, HuggingFaceDatasetReader, IpcReader
│ │ ├── writers/ # JsonlWriter, ParquetWriter, HuggingFaceDatasetWriter
│ │ ├── extractors/ # Trafilatura, ReadabilityInscriptis
│ │ ├── filters/ # Gopher, FineWeb, C4, Language, URL, Regex, Sampler, FastText, UnigramLogProb, Lambda
│ │ ├── formatters/ # FTFYFormatter, PIIFormatter, SymbolLinesFormatter
│ │ ├── dedup/ # Exact, MinHash, Sentence, BloomFilter, ExactSubstrings
│ │ ├── stats/ # Doc, Word, Line, Paragraph, Sentence, Lang, Token, Perplexity, Contamination stats + StatsMerger
│ │ ├── tokens/ # DocumentTokenizer, MegatronDocumentTokenizer, TokensCounter, Merger, ContextShuffler
│ │ ├── decont/ # NGramsDecontIndexer, NGramsDecontFilter
│ │ ├── inference/ # InferenceRunner, servers (VLLM, SGLang, Endpoint, Custom, Dummy), progress monitor, dataset cards
│ │ └── media/ # Binary/WARC/Zstd readers, writers, MIME filters, HTTP fetch
│ ├── executor/
│ │ ├── base.py # PipelineExecutor base
│ │ ├── local.py # LocalPipelineExecutor
│ │ ├── slurm.py # SlurmPipelineExecutor
│ │ └── ray.py # RayPipelineExecutor
│ ├── tools/ # CLI: check_dataset, merge_stats, launch_pickled_pipeline, failed_logs, inspect_data, jobs_status, track_jobs
│ └── utils/ # Hashing, tokenization, text processing, LID, perplexity, logging, stats, batching, jobs
├── tests/
│ ├── pipeline/ # Tests for filters, readers, writers, dedup, extractors, stats, tokens, inference
│ └── executor/ # Tests for local, ray executors
├── examples/ # FineWeb, CommonCrawl, C4 tokenization, dedup, stats, inference
│ └── inference/ # Synthetic data generation, benchmarking, progress monitoring
├── pyproject.toml
├── Makefile
└── README.mdCode Style
- Formatter/linter: Ruff (line length 119)
- Naming:
snake_casefunctions/variables,PascalCaseclasses,UPPER_SNAKE_CASEconstants - Imports: stdlib → third-party → local, absolute imports (
from datatrove.pipeline.filters import ...). Two blank lines after imports (isort config). - Type hints: Required on all function signatures
- Docstrings: Google style for public functions and classes
- Logging: Uses
loguru— import viafrom loguru import logger - Dependencies: Optional deps checked at runtime via
_requires_dependenciesonPipelineStep
Git Workflow
- Atomic, focused commits
- Conventional commit messages:
<type>(<scope>): <summary>(types:feat,fix,docs,style,refactor,test,chore) - Rebase branches, not merge
- Always add tests for new functionality
- Run
make qualitybefore pushing
Development Guidelines
Adding a new pipeline block:
- Inherit from the appropriate base class (see
pipeline/base.pyand subclass bases in each subdirectory) - Implement the required method (
run,filter,extract,format,extract_stats) - Add optional dependency checks via
_requires_dependencies - Use
self.stat_update()andself.track_time()for metrics - Add tests in
tests/pipeline/ - Export in the relevant
__init__.py
Key base classes — always inherit from the appropriate one:
PipelineStep→ general blocks (pipeline/base.py)BaseFilter→ filters returningbool(pipeline/filters/base_filter.py)BaseReader/BaseDiskReader→ data readers (pipeline/readers/base.py)DiskWriter→ data writers (pipeline/writers/disk_base.py)BaseExtractor→ HTML extraction (pipeline/extractors/base.py)BaseFormatter→ text formatting (pipeline/formatters/base.py)BaseStats→ statistics collection (pipeline/stats/base.py)
Adding a new reader: Inherit BaseDiskReader, implement read_file(filepath, file_doc_idx) → yield Document. Respect text_key, id_key, adapter, limit.
Adding a new filter: Inherit BaseFilter, implement filter(doc) -> bool (True=keep). Support exclusion_writer for rejected docs. Support batch_filter(batch) for batched processing.
Adding a new writer: Inherit DiskWriter, implement _write(document, output_file). Use output_filename template with ${rank}, ${id}, ${metadata_field}.
Testing
- Framework:
pytestwithpytest-timeout(120s default),pytest-xdist,pytest-rerunfailures - S3 mocking:
moto[s3,server]for S3 tests - Run:
pytest -sv ./tests/orpytest -sv ./tests/pipeline/test_filters.pyfor specific tests - Tests live alongside pipeline structure:
tests/pipeline/test_*.py,tests/executor/test_*.py
Common Pitfalls
- Task/file mismatch: Setting
tasks > fileswastes resources — tasks without files do nothing - Relaunch sharding: Never change
taskscount when relaunching a partially completed job - Output filename collisions: Always include
${rank}in writer output filenames to avoid tasks overwriting each other - Logging dir reuse: Don't reuse
logging_diracross different pipelines — it overwrites stats and completions - Pickling: Custom functions in pipelines may have import pickling issues — move imports inside the function body
- Optional deps: Use
_requires_dependenciesto declare optional dependencies; don't import them at module level
Boundaries
- Always do:
- Run
make qualitybefore commits - Add tests in
tests/pipeline/for new blocks - Follow existing patterns when adding pipeline steps
- Use type hints on all function signatures
- Use
logurulogger, notprint()
- Run
- Ask first:
- Adding new dependencies to
pyproject.toml - Changing base class interfaces (
PipelineStep,BaseFilter, etc.) - Modifying executor logic or completion tracking
- Changing the
Documentdata model
- Adding new dependencies to
- Never do:
- Commit secrets, API keys, or credentials
- Delete or disable tests to fix CI
- Use deprecated APIs without migration plan
- Ignore ruff errors or type annotations
Post-Interaction Checklist
After every interaction, check whether:
- Missing tests — Are there new functions/classes without corresponding tests in
tests/? Add them. - Missing docstrings — Do new public functions/classes have Google-style docstrings? Add them.
- Missing type hints — Are all function signatures fully annotated? Add them.
- README update — Does the README need updating for new features or changed behavior?
- Dead code — Did your changes make any existing code obsolete? Remove it.
- Lint check — Run
make qualityto verify no ruff violations were introduced.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

