README: document the full snapshot series (v11-50k / v12-100k / v13-500k / v14-1M)
Browse files
README.md
CHANGED
|
@@ -8,8 +8,9 @@ tags:
|
|
| 8 |
- wikidata
|
| 9 |
- preprocessed
|
| 10 |
- text-corpus
|
|
|
|
| 11 |
size_categories:
|
| 12 |
-
- 1M<n<
|
| 13 |
task_categories:
|
| 14 |
- text-generation
|
| 15 |
- feature-extraction
|
|
@@ -26,6 +27,41 @@ out.
|
|
| 26 |
|
| 27 |
License inherits from Wikidata: **CC-BY-SA 4.0**.
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
## What it is
|
| 30 |
|
| 31 |
One triple per line, tab-separated:
|
|
@@ -35,8 +71,11 @@ subject\tpredicate\tobject
|
|
| 35 |
```
|
| 36 |
|
| 37 |
All three positions are **English labels** — QIDs and PIDs are resolved to
|
| 38 |
-
their `rdfs:label@en`
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
## What was stripped
|
| 42 |
|
|
@@ -56,8 +95,17 @@ shapes onto unrelated predicates:
|
|
| 56 |
Predicates **kept**: `wikibase-item`, `wikibase-property`, `string`, `quantity`,
|
| 57 |
`time`, `monolingualtext`.
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
## What was normalized
|
| 63 |
|
|
@@ -73,54 +121,61 @@ System-reserved provenance triples (predicates under
|
|
| 73 |
off so it doesn't leak into training tokens. The datatype is consulted to
|
| 74 |
decide normalization rules and then dropped.
|
| 75 |
|
| 76 |
-
##
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
## How it was built
|
| 84 |
|
| 85 |
-
``
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
| 89 |
--label-db training/data/wikidata_labels.sqlite \
|
| 90 |
-
--output training/data/
|
| 91 |
-
--fetch-missing-from-wikidata
|
| 92 |
```
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
triples on a laptop without the 21 GB RAM bloat the previous one-shot version
|
| 101 |
-
hit.
|
| 102 |
-
|
| 103 |
-
## Snapshots
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
```python
|
| 110 |
-
from huggingface_hub import hf_hub_download
|
| 111 |
-
path = hf_hub_download(
|
| 112 |
-
repo_id="EmmaLeonhart/normalized-wikidata",
|
| 113 |
-
repo_type="dataset",
|
| 114 |
-
filename="triples_normalized.txt",
|
| 115 |
-
revision="v13-500k",
|
| 116 |
-
)
|
| 117 |
-
```
|
| 118 |
|
| 119 |
## Provenance
|
| 120 |
|
| 121 |
See [`Loka` on GitHub](https://github.com/EmmaLeonhart/Loka) for the engine,
|
| 122 |
-
the preprocessor source,
|
| 123 |
-
pipeline that motivated this corpus.
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
## Citation
|
| 126 |
|
|
|
|
| 8 |
- wikidata
|
| 9 |
- preprocessed
|
| 10 |
- text-corpus
|
| 11 |
+
- world-model
|
| 12 |
size_categories:
|
| 13 |
+
- 1M<n<10M
|
| 14 |
task_categories:
|
| 15 |
- text-generation
|
| 16 |
- feature-extraction
|
|
|
|
| 27 |
|
| 28 |
License inherits from Wikidata: **CC-BY-SA 4.0**.
|
| 29 |
|
| 30 |
+
This dataset is the input to a corresponding series of Loka world-model
|
| 31 |
+
checkpoints at [`EmmaLeonhart/loka`](https://huggingface.co/datasets/EmmaLeonhart/loka).
|
| 32 |
+
Each snapshot here is named to match the Loka model trained on it — e.g.
|
| 33 |
+
the `v11-50k` snapshot is the corpus the `v11` Loka model was trained on,
|
| 34 |
+
`v12-100k` corresponds to `v12`, and so on.
|
| 35 |
+
|
| 36 |
+
## Snapshots
|
| 37 |
+
|
| 38 |
+
| Tag | Entity rows | Output triples | File size | Trained Loka model |
|
| 39 |
+
|---|---|---|---|---|
|
| 40 |
+
| `v11-50k` (alias `v0.1-50k`) | 50,000 | **350,428** | 14.7 MB | [`EmmaLeonhart/loka@v11`](https://huggingface.co/datasets/EmmaLeonhart/loka/tree/v11) |
|
| 41 |
+
| `v12-100k` | 100,000 | **671,817** | 28.4 MB | [`EmmaLeonhart/loka@v12`](https://huggingface.co/datasets/EmmaLeonhart/loka/tree/v12) |
|
| 42 |
+
| `v13-500k` | 500,000 | **2,511,771** | 109 MB | (training in progress 2026-05-14) |
|
| 43 |
+
| `v14-1M` | 1,000,000 | ~7 M (est.) | ~300 MB (est.) | (queued) |
|
| 44 |
+
|
| 45 |
+
The latest tag pushed is `v13-500k`. Iterate the table here as new tags
|
| 46 |
+
ship.
|
| 47 |
+
|
| 48 |
+
**Pulling a specific snapshot:**
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
from huggingface_hub import hf_hub_download
|
| 52 |
+
path = hf_hub_download(
|
| 53 |
+
repo_id="EmmaLeonhart/normalized-wikidata",
|
| 54 |
+
repo_type="dataset",
|
| 55 |
+
filename="triples_normalized.txt",
|
| 56 |
+
revision="v11-50k", # or v12-100k, v13-500k, ...
|
| 57 |
+
)
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
Each snapshot is **strictly larger than the previous** — same first-N rows from
|
| 61 |
+
the same upstream stream, just with N raised. The SQLite label cache at
|
| 62 |
+
`wikidata_labels.sqlite` also grows monotonically across snapshots (~7,300
|
| 63 |
+
curated property labels preloaded, plus all entity labels seen in the slice).
|
| 64 |
+
|
| 65 |
## What it is
|
| 66 |
|
| 67 |
One triple per line, tab-separated:
|
|
|
|
| 71 |
```
|
| 72 |
|
| 73 |
All three positions are **English labels** — QIDs and PIDs are resolved to
|
| 74 |
+
their `rdfs:label@en`. Entity labels come from the entity's own row in the
|
| 75 |
+
source dump; **property labels come from a curated cache** of 7,312 manually-
|
| 76 |
+
resolved Wikidata properties, never from corpus `rdfs:label` rows on
|
| 77 |
+
properties (those are corrupted by an upstream RDF-star executor bug — see
|
| 78 |
+
"Known issues with raw Wikidata" below).
|
| 79 |
|
| 80 |
## What was stripped
|
| 81 |
|
|
|
|
| 95 |
Predicates **kept**: `wikibase-item`, `wikibase-property`, `string`, `quantity`,
|
| 96 |
`time`, `monolingualtext`.
|
| 97 |
|
| 98 |
+
In addition, object-level guards drop:
|
| 99 |
+
|
| 100 |
+
- URL-shaped values (`http://`, `https://`, `ftp://`, `irc://`, `mailto:`) that
|
| 101 |
+
slipped through with non-catalog predicates
|
| 102 |
+
- Long digit-only strings (8+ digits — GND/VIAF/ISNI shape) and DOIs
|
| 103 |
+
(`10.NNNN/...`) in the object position
|
| 104 |
+
- Rows where the subject *or* object is itself a property IRI
|
| 105 |
+
(`wdt:P\d+`) — these are RDF-star annotation rows surfacing in the wrong
|
| 106 |
+
slot, never legitimate
|
| 107 |
+
- System-reserved provenance triples (predicates under
|
| 108 |
+
`http://loka.dev/provenance/`)
|
| 109 |
|
| 110 |
## What was normalized
|
| 111 |
|
|
|
|
| 121 |
off so it doesn't leak into training tokens. The datatype is consulted to
|
| 122 |
decide normalization rules and then dropped.
|
| 123 |
|
| 124 |
+
## Known issues with raw Wikidata that this corpus addresses
|
| 125 |
+
|
| 126 |
+
1. **Catalog / identifier explosion.** ~82 % of Wikidata's property types by
|
| 127 |
+
count are external identifiers, URLs, or other non-semantic catalog refs.
|
| 128 |
+
Training on them teaches the model catalog formats rather than world
|
| 129 |
+
knowledge. We strip them by datatype.
|
| 130 |
+
2. **Property `rdfs:label` corruption when materialised through some RDF-star
|
| 131 |
+
executors.** A `<<S P O>> rdfs:label "..."@en` annotation row, depending
|
| 132 |
+
on the executor, can surface as `wdt:Pnnn rdfs:label "object-value"@en`
|
| 133 |
+
— i.e. the property gets keyed against the inner triple's object value
|
| 134 |
+
instead of its real label. Entity labels are unaffected. We work around
|
| 135 |
+
this by sourcing property labels from a curated cache and never from
|
| 136 |
+
in-corpus `rdfs:label` rows on properties.
|
| 137 |
+
3. **Datatype suffix leakage.** `"2012-10-15T00:00:00Z"^^<...dateTime>` if
|
| 138 |
+
processed naively leaks tokens like `xmlschema`, `dateTime` etc. into the
|
| 139 |
+
training corpus. We strip these.
|
| 140 |
+
4. **Mixed-language values.** Wikidata's `monolingualtext` includes all
|
| 141 |
+
languages; we keep them but strip the `@lang` tag so values like `Tokyo`
|
| 142 |
+
and `東京` are plain strings.
|
| 143 |
|
| 144 |
## How it was built
|
| 145 |
|
| 146 |
+
The current preprocessor streams `philippesaade/wikidata` directly from
|
| 147 |
+
Hugging Face, with a SQLite label cache that persists across runs:
|
| 148 |
+
|
| 149 |
+
```bash
|
| 150 |
+
python tools/preprocess_from_hf.py \
|
| 151 |
+
--max-rows 100000 \ # entity-row count, sets the size tier
|
| 152 |
--label-db training/data/wikidata_labels.sqlite \
|
| 153 |
+
--output training/data/normalized/normalized_wikidata_v12_100k.txt
|
|
|
|
| 154 |
```
|
| 155 |
|
| 156 |
+
Two passes over the dataset:
|
| 157 |
+
- **Pass 1** scans every row to extract English `labels.en.value` into the
|
| 158 |
+
SQLite cache (constant memory regardless of corpus size).
|
| 159 |
+
- **Pass 2** streams again to emit the tab-separated text corpus, using the
|
| 160 |
+
cache for label lookups, applying the noise-datatype filter, normalising
|
| 161 |
+
time/quantity values, and dropping engine-bug-#2 RDF-star fallout at the
|
| 162 |
+
s/o level.
|
| 163 |
|
| 164 |
+
Source code: [`tools/preprocess_from_hf.py`](https://github.com/EmmaLeonhart/Loka/blob/main/tools/preprocess_from_hf.py),
|
| 165 |
+
[`tools/hf_push_normalized.py`](https://github.com/EmmaLeonhart/Loka/blob/main/tools/hf_push_normalized.py).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
+
An earlier two-pass version that fetched from a Loka `.sdb` over SPARQL
|
| 168 |
+
(`tools/preprocess_streaming.py`) hit O(offset) cost at multi-million-triple
|
| 169 |
+
scale; the HF-direct version sidesteps that by streaming the upstream parquet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
## Provenance
|
| 172 |
|
| 173 |
See [`Loka` on GitHub](https://github.com/EmmaLeonhart/Loka) for the engine,
|
| 174 |
+
the preprocessor source, the trained model checkpoints, and the paper
|
| 175 |
+
describing the world-model training pipeline that motivated this corpus.
|
| 176 |
+
|
| 177 |
+
The Loka model series on Hugging Face:
|
| 178 |
+
[`EmmaLeonhart/loka`](https://huggingface.co/datasets/EmmaLeonhart/loka).
|
| 179 |
|
| 180 |
## Citation
|
| 181 |
|