Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: odc-by
|
3 |
+
---
|
4 |
+
|
5 |
+
# DuckDB datasets for (dump, id) querying on FineWeb 2
|
6 |
+
|
7 |
+
## Download
|
8 |
+
|
9 |
+
All files:
|
10 |
+
|
11 |
+
```shell
|
12 |
+
huggingface-cli download BramVanroy/fineweb-2-duckdbs --local-dir duckdbs/fineweb-2/ --include *.duckdb --repo-type dataset
|
13 |
+
```
|
14 |
+
|
15 |
+
One file:
|
16 |
+
|
17 |
+
```shell
|
18 |
+
huggingface-cli download BramVanroy/fineweb-2-duckdbs fw2-deu_Latn.duckdb --local-dir duckdbs/fineweb-2/ --repo-type dataset
|
19 |
+
```
|
20 |
+
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
```python
|
25 |
+
import re
|
26 |
+
import duckdb
|
27 |
+
|
28 |
+
uuid_re = re.compile(r"<urn:uuid:([a-zA-Z0-9]{8}-?[a-zA-Z0-9]{4}-?[a-zA-Z0-9]{4}-?[a-zA-Z0-9]{4}-?[a-zA-Z0-9]{12})>")
|
29 |
+
duckdb_path = "duckdbs/fineweb-2/fw2-deu_Latn.duckdb"
|
30 |
+
|
31 |
+
dump = "CC-MAIN-2013-20"
|
32 |
+
uuid_urn = "<urn:uuid:4cd2db15-ae0c-482a-8688-d023d4b19f60>"
|
33 |
+
# !! Important: extract the UUID from the URN
|
34 |
+
uid = uuid_re.sub("\\1", uuid_urn).replace("-", "")
|
35 |
+
|
36 |
+
query = "SELECT EXISTS (SELECT 1 FROM dataset WHERE dump = ? AND id = ?)"
|
37 |
+
exists = bool(con.execute(query, (dump, uuid)).fetchone()[0])
|
38 |
+
|
39 |
+
print(f"Does ID {uid} exist in {dump}? {exists}")
|
40 |
+
```
|