Skip to main content

Unified dataset loaders for e-SNLI, QASC, and WorldTree.

Project description

theoremkb

theoremkb is a Python package with a unified API for loading:

  • e-SNLI
  • QASC
  • WorldTree

The package uses Hugging Face datasets as the backend and keeps loader parameters consistent across all datasets.

Installation

pip install theoremkb

For pandas output:

pip install theoremkb[pandas]

Quick Start

from theoremkb import load_qasc

records = load_qasc(
    split="train",
    as_format="records",
    max_samples=100,
    shuffle=True,
    seed=7,
)
print(records[0])

Generic loader:

from theoremkb import load

dataset = load("worldtree", split="train")

Terminal demo: print the 30th eSNLI sample

PYTHONPATH=src python examples/esnli_thirtieth_record.py

Notebook demo

  • notebooks/theoremkb_esnli_demo.ipynb

Unified Parameters

All dataset-specific loaders have the same signature:

  • split: dataset split (train, validation, test; dev/val auto-mapped to validation)
  • subset: optional HF config name
  • cache_dir: custom cache directory
  • revision: dataset revision/commit
  • token: HF auth token
  • force_download: force redownload (True -> force_redownload)
  • streaming: use streaming mode
  • trust_remote_code: required for some datasets (currently esnli)
  • shuffle: shuffle loaded samples
  • seed: random seed for shuffle
  • max_samples: truncate sample size (required when streaming=True and as_format is records/pandas)
  • as_format: one of datasets, records, pandas
  • drop_empty_fields: when True (default), remove fields whose value is "" or None in records/pandas output
  • validate_split: query and validate split name before loading

Included Dataset Mapping

  • esnli -> esnli/esnli
  • qasc -> allenai/qasc
  • worldtree -> nguyen-brat/worldtree

Use list_datasets() to list canonical names.

Publishing

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*

Notes

  • load_esnli(...) requires trust_remote_code=True in current Hugging Face setup.
  • If you use streaming=True with as_format="records" or as_format="pandas", set max_samples to avoid unbounded materialization.

Troubleshooting

If you see an error like Dataset scripts are no longer supported, but found ..., your environment is likely using a too-new datasets version.

Run:

python -m pip install "datasets<3"

If you see TLS/SSL errors like UNEXPECTED_EOF_WHILE_READING, your machine cannot establish a secure connection to Hugging Face.

Check:

python - <<'PY'
import requests
print(requests.get("https://huggingface.co", timeout=15).status_code)
PY

If needed, configure proxy/certs (HTTPS_PROXY, HTTP_PROXY, REQUESTS_CA_BUNDLE). For temporary debugging only, you can disable SSL verification:

export HF_HUB_DISABLE_SSL_VERIFICATION=1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

theoremkb-0.2.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

theoremkb-0.2.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file theoremkb-0.2.0.tar.gz.

File metadata

  • Download URL: theoremkb-0.2.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for theoremkb-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4c14c882adfbaba469f4461072fdb8063e500f89ea98545a260f5301d838eabb
MD5 af0d0ca77e15d2555f11b401a274d990
BLAKE2b-256 ff9b6c15f981222778fbaeaeb01f345b67cdc16c8e2945c155ff76a3b3bd3d51

See more details on using hashes here.

File details

Details for the file theoremkb-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: theoremkb-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for theoremkb-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7a4c57d17278f0fdab9d5167249da95616835b656b2ee68d291e3cf0fd338ab
MD5 d925e6446eba2eaafc09424ab508f195
BLAKE2b-256 47da1b80de463a5854e4bcaf7bc574b4042687f61ea99ea4c3bbd173470be6a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page