Repository navigation
Loading Reference
Full signatures and usage: Loading and cache policy.
load(source, *, type, file=None, split=None, config="default", revision=None, download=False, token=None, provider="hf", limits=None)
| Input | Result |
|---|---|
| Local directory or complete repository snapshot, model or dataset |
pathlib.Path to the directory |
Local model file or model repository with file=
|
Path to the file |
Supported dataset shard supplied as a local path or as file=
|
Repeatable native Dataset of row dictionaries |
List or tuple of local dataset shard paths, using type="dataset"
|
One repeatable native Dataset reading the shards in list order |
SafeTensors file or model repository with file=, using type="safetensors"
|
Context manager for reading one tensor archive. The specialized SafeTensors.load(source, ...) selects this mode automatically. An optional SafeTensors.TensorLimits sets its resource budgets. |
HF dataset repository with split=
|
Repeatable native Dataset for that named split |
Choose type="model", type="dataset" or type="safetensors". Use an existing local path, a Path to an intended local file, or a repository ID. A missing Path raises FileNotFoundError. file is a relative path inside the directory or repository. split selects a Hub dataset split and is mutually exclusive with file. For several local shards, pass an ordered list of paths without file or split; for local split discovery, use hf_compat.load_dataset.
| Download argument | Behavior |
|---|---|
Omitted or False
|
Use local disk and permitted caches. A missing artifact or Viewer page raises an error. |
True or DownloadConfig()
|
Reuse completed cache entries and permit fetching missing content. |
DownloadConfig(force=True) |
Refresh remote content, including a cached file. HF_HUB_OFFLINE=1 prevents the refresh. |
DownloadConfig(*, force=False) is immutable and requires a boolean. A local filesystem source always takes the local path. provider accepts "hf" (default revision main) and "modelscope" (default master). Pin a commit or provider revision when you need reproducible inputs.
from datashoal import DownloadConfig, load
config_path = load("org/model", type="model", file="config.json",
download=DownloadConfig(force=True))A model file loads as a Path and a dataset file as rows. When a consumer needs the cached path of a dataset repository file, call hf_compat.hf_hub_download(repo, file, repo_type="dataset", local_files_only=False); it returns a string.
Read a local checkpoint · Hub cache layout · ModelScope options · Upload reference
Get started
- Installation and quickstart
- Python API reference
- Native templates
- Native extension ABI
- Loading reference
Prepare calibration data
Manage artifacts
Operate and contribute