Download inspect.py from harness-race/opencode-scripts: direct link, hf CLI and curl.
- Browser
- Download file 873 Bytes
-
https://huggingface.co/datasets/harness-race/opencode-scripts/resolve/main/inspect.py
- Command line
-
hf download hf://datasets/harness-race/opencode-scripts/inspect.py
-
curl -L -o inspect.py https://huggingface.co/datasets/harness-race/opencode-scripts/resolve/main/inspect.py
873 Bytes
| # /// script | |
| # dependencies = ["datasets", "huggingface_hub"] | |
| # /// | |
| import json | |
| from datasets import load_dataset | |
| ds = load_dataset("biglam/loc_beyond_words") | |
| for split in ds: | |
| print("=== SPLIT:", split, len(ds[split])) | |
| f = ds[split].features | |
| print("features:", list(f.keys())) | |
| print("features detail:", {k: str(v) for k, v in f.items()}) | |
| # look at labels in a sample row | |
| row = ds["validation"][0] | |
| print("sample keys:", list(row.keys())) | |
| for k, v in row.items(): | |
| if k != "image": | |
| print(" ", k, ":", v) | |
| # gather all training classes | |
| train = ds["train"] | |
| classes = set() | |
| imgs_per_class = {} | |
| N = len(train) | |
| for i in range(N): | |
| objs = train[i]["objects"] | |
| for el in objs.get("label", []): | |
| el = el if isinstance(el, int) else int(el) | |
| classes.add(el) | |
| print("\nnum rows train:", N) | |
| print("label set in train:", sorted(classes)) | |