Skip to content

Datasets

Datasets

Datasets(url: str | None = None, token: str | None = None, *, directory: str | Path | None = None, verify_ssl: bool | None = None, client: HttpClient | None = None)

A client for one Visin instance's datasets.

close

close() -> None

Release the connection. with Datasets() as datasets does this for you.

list

list(search: str | None = None) -> list[Dataset]

The datasets this credential can read (all public ones without a token).

get

get(ref: str | Dataset) -> Dataset

A dataset by id, or by name (case-insensitive).

download

download(ref: str | Dataset, directory: str | Path | None = None, *, quiet: bool = False, unzip: bool = True, keep_archive: bool = False) -> Path

The dataset's folder on disk, downloaded and unpacked the first time.

ref is a name, an id or a :class:~visin.models.Dataset from list(). Returns the folder holding the dataset: the zip's single top-level folder when it has one. With unzip=False, return the downloaded ZIP path instead and always retain it. With keep_archive=True, retain the ZIP alongside the extracted dataset.

push

push(ref: str | Dataset, repo: str, *, private: bool = True, directory: str | Path | None = None, quiet: bool = False) -> str

Publish a dataset kept on Visin to the Hugging Face Hub and point Visin at it.

Downloads the dataset if it is not on this machine, uploads its folder to the dataset repo repo (org/name, created if needed, private unless private=False) with your own Hub token, then tells Visin the repo and the commit that upload made. The zip kept on Visin stays as the fallback. Needs pip install 'visin[hf]' and a token that may manage the dataset. Returns the commit hash.

Do this only for data whose licence allows redistribution.