#!/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.")