Sync from GitHub via hub-sync
Browse files
README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
viewer: false
|
| 3 |
+
tags: [uv-script, deduplication, semantic-similarity, data-processing, hf-jobs]
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Semantic Deduplication UV Script
|
| 7 |
+
|
| 8 |
+
> Part of [uv-scripts](https://huggingface.co/uv-scripts) — self-contained UV scripts you run locally or on Hugging Face Jobs in one command.
|
| 9 |
+
|
| 10 |
+
Remove duplicate / near-duplicate text samples from a Hugging Face dataset by semantic similarity — clean training data and prevent train/test leakage. Uses [SemHash](https://github.com/MinishLab/semhash) with Model2Vec embeddings: **CPU-optimized, no GPU required.**
|
| 11 |
+
|
| 12 |
+
## Quick start
|
| 13 |
+
|
| 14 |
+
```bash
|
| 15 |
+
# CPU is enough — run on Hugging Face Jobs
|
| 16 |
+
hf jobs uv run --flavor cpu-upgrade --secrets HF_TOKEN \
|
| 17 |
+
https://huggingface.co/datasets/uv-scripts/deduplication/raw/main/semantic-dedupe.py \
|
| 18 |
+
your-input-dataset text your-output-dataset
|
| 19 |
+
|
| 20 |
+
# or locally
|
| 21 |
+
uv run https://huggingface.co/datasets/uv-scripts/deduplication/raw/main/semantic-dedupe.py \
|
| 22 |
+
your-input-dataset text your-output-dataset
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Arguments are `INPUT_DATASET TEXT_COLUMN OUTPUT_DATASET`. Tune with `--threshold` (similarity cutoff) and `--max-samples` (for testing); run with `--help` for all options.
|