~/bend-docscommunity

hf/main.bend fails

raw source on the hub · import mlbend-datasets@0.1.0.0/hf/main.bend as Main

mlbend-hf: a HuggingFace client for Bend 2.

import mlbend-hf@0.1.0.0/main.bend as Hf

Two APIs, both JSON over HTTP.

The dataset's own host:

GET huggingface.co/api/datasets/<name> the dataset's page GET huggingface.co/api/datasets/<name>/tree/<rev> the files in it GET huggingface.co/datasets/<name>/resolve/<rev>/<path> a file's bytes

And the rows server, which answers a dataset that is stored as data as JSON rows, with the features beside them:

GET datasets-server.huggingface.co/rows?dataset=<name>&config=<c>&split=<s>&offset=<n>&length=<k>

A dataset that is a script rather than data cannot be read this way. The rows server says so, and its message says what to do about it: convert the dataset to Parquet. The file tree and the raw file download work for those anyway.

Everything is an effect at the edge, so the estimators that use a dataset stay pure and a run is reproducible.

A note on the shape of the code: Bend's checker will not let a match scrutinize a computed value, so every helper that unwraps a Maybe takes it as a parameter and matches on that. The callers get one call each.

4 imports
import Base
import bend-kit-http@0.36.0.0/http.bend as Http
import bend-kit-json@0.6.1.1/json.bend as Json
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes