Skip to content

Installation and Quickstart

Qubitium edited this page Dec 5, 2026 · 3 revisions

Installation and quickstart

Use Python 3.11 or newer. Install the checkout in a virtual environment:

git clone https://github.com/ModelCloud/DataShoal.git
cd DataShoal
python -m venv .venv
. .venv/bin/activate
python -m pip install .

LogBar is the only required Python package and has zero runtime dependencies. For the best performance, install and run DataShoal with CPython, matching development headers, and a C11 compiler on PATH. DataShoal builds and caches its accelerator on first use. When the accelerator is unavailable, the Python implementations take over and DataShoal logs the reason once per process. Reading local JSONL works without a compiler, credentials, or a network connection.

from pathlib import Path
from tempfile import TemporaryDirectory
from datashoal import load

with TemporaryDirectory() as tmp:
    shard = Path(tmp) / "train.jsonl"
    shard.write_text('{"text":"first"}\n{"text":"second"}\n', encoding="utf-8")
    rows = load(shard, type="dataset")
    assert rows.take(1) == [{"text": "first"}]
    assert len(rows.collect()) == 2  # a new pass starts at the first row

Fetch once, reopen offline

This example opts into a public dataset download. Both calls return a row stream for the same file. Omitting download in the second call requires a cache hit.

from datashoal import load

source = "neuralmagic/calibration"
revision = "fb6bc2f8c66543876fb31613f5872b9030220e15"
options = dict(type="dataset", file="llm.parquet", revision=revision)
first = load(source, download=True, **options).take(1)
assert load(source, **options).take(1) == first

Next choose a calibration sampling strategy or look up load parameters and return types.

Clone this wiki locally