File size: 741 Bytes
41f037f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3
"""Load every config through `datasets` exactly as the Hub will (README configs),
check the schema and print a few rows. Run before uploading."""
from pathlib import Path

from datasets import get_dataset_config_names, load_dataset

ROOT = Path(__file__).resolve().parent.parent

configs = get_dataset_config_names(str(ROOT))
print("configs:", configs)
for name in configs:
    ds = load_dataset(str(ROOT), name, split="train")
    assert ds.num_rows > 0, name
    assert "text" in ds.column_names and "lang_heuristic" in ds.column_names, name
    print(f"\n== {name}: {ds.num_rows:,} rows")
    print("   ", ds.features)
    print("   ", ds[0]["text"][:100].replace("\n", " "))
print("\nAll configs load correctly.")