acubench / UPLOAD.md
fromhope's picture
Add AcuBench (build-script pattern: skeleton + build/eval scripts, no AcuKG labels)
2803982 verified
|
Raw
History Blame Contribute Delete
5.63 kB
# AcuBench → Hugging Face: upload runbook
This runbook is for **you** (the author) to run with **your own** HF token.
The packaging step did **not** log in, create accounts, enter tokens, or upload
anything. Everything below is copy-pasteable; replace `<username>` with your HF
username (and adjust repo names if you like).
Two staging trees are ready:
- `acubench/hf/` → the HF **dataset** repo (build-script pattern; no
AcuKG-derived labels shipped).
- `acubench/hf_space/` → the HF **Space** (Gradio leaderboard).
---
## 0. One-time setup
```bash
pip install -U "huggingface_hub[cli]"
huggingface-cli login # paste your token (needs write scope)
huggingface-cli whoami # confirm you are logged in
```
---
## 1. Create + upload the dataset repo
```bash
# Create the dataset repo (idempotent: --exist-ok won't fail if it exists).
huggingface-cli repo create acubench --repo-type dataset --exist-ok
# Upload the ENTIRE staging folder as the repo root.
huggingface-cli upload <username>/acubench \
/Users/yutaewan/test/fromhope1/merdian/acubench/hf \
. \
--repo-type dataset \
--commit-message "Add AcuBench (build-script pattern: skeleton + build/eval scripts, no AcuKG labels)"
```
**Guardrail double-check before/after upload** — the dataset repo must contain
ONLY these files. It must NOT contain `acubench.jsonl` or any raw AcuKG data:
```bash
ls /Users/yutaewan/test/fromhope1/merdian/acubench/hf
# expected: README.md NOTICE LICENSE UPLOAD.md
# build_acubench.py eval.py
# who_acupoints.csv meridian_adjacency.csv sample_labels.jsonl
```
Then view it at `https://huggingface.co/datasets/<username>/acubench`.
---
## 2. Create + upload the Space (Gradio leaderboard)
```bash
# Create a Gradio Space.
huggingface-cli repo create acubench-leaderboard --repo-type space --space_sdk gradio --exist-ok
# Upload the Space staging folder.
huggingface-cli upload <username>/acubench-leaderboard \
/Users/yutaewan/test/fromhope1/merdian/acubench/hf_space \
. \
--repo-type space \
--commit-message "Add AcuBench leaderboard (operator-held gold)"
```
The Space builds automatically and serves the leaderboard (seeded with the
paper's reference baselines). View it at
`https://huggingface.co/spaces/<username>/acubench-leaderboard`.
---
## 3. Private gold handling (operator-held gold)
The private **test** gold is **never** uploaded to the public Space or dataset
repo. You build it locally and keep it on your machine:
```bash
# You need your own AcuKG clone (its labels are not redistributed):
git clone https://github.com/<acukg-owner>/AcuKG.git /path/to/acukg
# Build the labels + splits locally (byte-reproduces the canonical dataset):
cd /Users/yutaewan/test/fromhope1/merdian/acubench/hf
python3 build_acubench.py --acukg /path/to/acukg --out ~/acubench_gold
# -> ~/acubench_gold/acubench.jsonl (keep this PRIVATE; it holds the test labels)
```
If you ever want automated scoring *inside* the Space (optional, not required by
the operator-held-gold flow), add the gold as a **private Space secret/file**
rather than committing it:
- **As a file** (private): `huggingface-cli upload <username>/acubench-leaderboard
~/acubench_gold/acubench.jsonl gold/acubench.jsonl --repo-type space` — but
only if the Space is **private**; do NOT do this on a public Space.
- **As a secret**: Space → Settings → *Variables and secrets* → add a secret
(e.g. `ACUBENCH_GOLD_PATH` or the gold contents) and read it via
`os.environ` in `app.py`. Recommended only if you make the Space private.
The default, safe design keeps the Space public and the gold entirely on your
machine (see next section).
---
## 4. Operator scoring + appending leaderboard rows
When a participant sends you a predictions JSONL (they do **not** have the
gold), score it locally and commit the resulting row:
```bash
cd /Users/yutaewan/test/fromhope1/merdian/acubench/hf_space
# Score against your private, locally-built test gold:
python3 score_submission.py \
--pred /path/to/participant_preds.jsonl \
--gold ~/acubench_gold/acubench.jsonl \
--who ../hf/who_acupoints.csv \
--eval ../hf/eval.py \
--split test \
--model "Participant Model v1" \
--submitter "Participant Name" \
--out submissions/010_participant_model.json
# Push just the new row to the Space:
huggingface-cli upload <username>/acubench-leaderboard \
submissions/010_participant_model.json \
submissions/010_participant_model.json \
--repo-type space \
--commit-message "Leaderboard: add Participant Model v1"
```
The Space picks up the new `submissions/*.json` on reload. No gold labels ever
leave your machine.
---
## 5. TODO / decisions for you
- [ ] **Confirm the license.** The packaging step defaulted to **CC BY 4.0**
for the data/knowledge artifacts (WHO skeleton, adjacency, sample) and
**MIT** for the code (`build_acubench.py`, `eval.py`). See `LICENSE`.
If you prefer a single license, edit `LICENSE` and the `license:` field in
`README.md`'s YAML frontmatter accordingly.
- [ ] **Fill in the AcuKG URL** in `README.md`, `NOTICE`, and the build/upload
commands above (`<acukg-owner>`), and add the AcuKG citation.
- [ ] **Confirm the citation** block in `README.md` (author list, venue/year).
- [ ] Consider **contacting AcuKG's authors** for an explicit LICENSE or
redistribution permission (recommended, not blocking).
- [ ] Decide whether the Space stays **public** (default, operator-held gold) or
goes **private** to enable in-Space automated scoring (§3).