code / HUGGINGFACE_UPLOAD.md
anonymous
[code] Reproduction bundle.
2e511b5
|
Raw
History Blame Contribute Delete
9.28 kB
# How to publish LEGEX to Hugging Face anonymously
This walkthrough takes the contents of `submission/` and publishes **three
public Hugging Face dataset repositories** under the anonymous account
`legexbenchmark`:
1. **`legexbenchmark/goldensets`** — expert-coded gold annotations
(19 jurisdictions, 1,548 judgments / 1,974 rows incl. secondary
re-annotations).
2. **`legexbenchmark/inference-results`** — Harvey (2 runs) / Gemini / GPT /
Legora (2 runs) outputs (19 jurisdictions × 6 runs = 114 files, JSONL)
plus the per-column prompts of the commercial runs (`prompts/`, 4 files).
3. **`legexbenchmark/code`** — Python pipeline (scrape → process → infer →
clean → evaluate).
> **All data files are JSONL** (one JSON object per line). Inference was CSV
> in the first release and is now JSONL — see *Updating an existing release*
> below.
---
## 0. Updating an existing release (goldensets + inference-results)
The three repos already exist, and local clones live in
`../hf-uploads/{goldensets,inference-results,code}`. The staged bundle
(`submission/goldensets/`, `submission/inference-results/`) mirrors the two
data repos 1:1: data + the per-repo dataset card (`README.md`).
Rebuild the bundle only if the underlying data changed
(`convert_goldenset_to_jsonl.py` needs the local-only
`data/reannotation/annotators.json` + `ANNOTATOR_SALT` from `.env`):
```bash
uv run python submission/convert_goldenset_to_jsonl.py --data-dir data --out-dir submission/goldensets/data
(cd submission && uv run python build_inference_jsonl.py --data-dir ../data --gold-dir goldensets/data --out-dir inference-results/data)
```
When the working trees in `../hf-uploads/` are already synced from
`submission/` (data + README copied in, stale CSVs removed), pushing the
update is:
```bash
# Log in once with the anonymous account's WRITE token.
pip install --upgrade huggingface_hub && git lfs install --skip-repo
huggingface-cli login # paste the hf_… write token
huggingface-cli whoami # must print: legexbenchmark
# --- goldensets ---
cd ../hf-uploads/goldensets
git status && git diff --stat # review: data/<cc>/*.jsonl + README.md
git config user.name anonymous && git config user.email anonymous@anonymous.invalid
git add -A
git commit -m "Update: re-annotations, Nepal/Singapore extensions, traceability fields, refreshed card"
git push
cd -
# --- inference-results (CSV -> JSONL) ---
cd ../hf-uploads/inference-results
git status # review: CSVs deleted, 57 JSONL added, README.md, .gitattributes
git config user.name anonymous && git config user.email anonymous@anonymous.invalid
git add -A
git commit -m "Switch inference to JSONL; 19 jurisdictions; cleaning provenance; refreshed card"
git push
cd -
```
Then **verify usability** (the old CSV raised `ArrowInvalid`):
```python
from datasets import load_dataset
load_dataset("legexbenchmark/goldensets", split="brazil")
load_dataset("legexbenchmark/inference-results", "harvey", split="united_states")
load_dataset("legexbenchmark/inference-results", "gpt", split="switzerland")
```
Also confirm on the web UI that every commit author reads **`anonymous`**, the
dataset viewer renders both repos, and no `inference_*.csv` remain in
`inference-results`.
**`code`** is updated separately once the cleaned analysis package is staged —
see item 3 of [CHANGES_SINCE_SUBMISSION.md](CHANGES_SINCE_SUBMISSION.md).
---
## 1. Create the anonymous Hugging Face account (once)
1. Open a private / incognito browser window so cookies from any existing
HF account are isolated.
2. Visit <https://huggingface.co/join>.
3. Sign up with a **fresh email address** that is not tied to any of the
authors (a `proton.me` / `tutanota.com` mailbox works fine).
4. Pick the username **`legexbenchmark`** so the public URLs match the
names used in the paper.
5. Verify the email and log in.
> **Why a fresh account?** HF attaches your account's display name, avatar
> and email to commits in each repo's history. Reusing an existing account
> would leak your identity even if every file in the repo is clean.
## 2. Create a write-scoped access token (once)
1. Visit <https://huggingface.co/settings/tokens>.
2. Click **New token**, name it `upload`, role **Write**, click **Generate
token**, copy the value (it starts with `hf_`).
## 3. Install the tooling and log in (once)
```bash
pip install --upgrade huggingface_hub
git lfs install --skip-repo # macOS: brew install git-lfs first
# Paste the write token created in step 2 when prompted.
huggingface-cli login
```
## 4. Push the three repositories (initial release)
Run steps 4a → 4c **in order**. Each step is independent — if something
breaks in 4b you can fix it without redoing 4a.
### 4a. Push `legexbenchmark/goldensets`
```bash
# 1. Create the empty repo via the web UI:
# https://huggingface.co/new-dataset
# Owner: legexbenchmark | Name: goldensets | License: MIT | Public
# 2. Clone, anonymise local git, copy in the staged files.
git clone https://huggingface.co/datasets/legexbenchmark/goldensets hf-goldensets
cd hf-goldensets
git config user.name "anonymous"
git config user.email "anonymous@anonymous.invalid"
git lfs track "*.jsonl"
git add .gitattributes
cp -R ../submission/goldensets/. .
# 3. Commit and push.
git add .
git commit -m "Initial release"
git push -u origin main
cd ..
```
Open <https://huggingface.co/datasets/legexbenchmark/goldensets>. Verify:
- The dataset card renders with the jurisdiction tables.
- `data/<cc>/goldenset_<cc>.jsonl` is browsable for all 19 jurisdictions.
- The author next to every commit is **`anonymous`**.
### 4b. Push `legexbenchmark/inference-results`
```bash
# 1. Create the empty repo:
# https://huggingface.co/new-dataset
# Owner: legexbenchmark | Name: inference-results | License: MIT | Public
# 2. Clone, anonymise, copy in.
git clone https://huggingface.co/datasets/legexbenchmark/inference-results hf-inference
cd hf-inference
git config user.name "anonymous"
git config user.email "anonymous@anonymous.invalid"
git lfs track "*.jsonl"
git add .gitattributes
cp -R ../submission/inference-results/. .
# 3. Commit and push.
git add .
git commit -m "Initial release"
git push -u origin main
cd ..
```
Verify on <https://huggingface.co/datasets/legexbenchmark/inference-results>:
- 19 `data/<cc>/` folders (all jurisdictions).
- Each folder has `inference_harvey.jsonl`, `inference_gemini.jsonl`,
`inference_gpt.jsonl` (no `.csv`).
### 4c. Push `legexbenchmark/code`
```bash
# 1. Create the empty repo:
# https://huggingface.co/new-dataset
# Owner: legexbenchmark | Name: code | License: MIT | Public
# (HF dataset repos accept arbitrary files — we use "dataset" type as
# the most permissive container for source code.)
# 2. Clone, anonymise, copy in the cleaned package (see
# CHANGES_SINCE_SUBMISSION.md item 3 for what goes into the code repo).
git clone https://huggingface.co/datasets/legexbenchmark/code hf-code
cd hf-code
git config user.name "anonymous"
git config user.email "anonymous@anonymous.invalid"
# 3. Commit and push.
git add .
git commit -m "Initial release"
git push -u origin main
cd ..
```
Verify on <https://huggingface.co/datasets/legexbenchmark/code>:
- The repo card lists the CLI entrypoints and the workflow.
- `legex/scrapers/` contains 19 jurisdiction modules.
## 5. Cross-verify the org page
Open <https://huggingface.co/legexbenchmark> in a fresh tab — you should
see three pinned datasets. Click each card and confirm:
- The README renders correctly.
- The "Files and versions" tab is browsable.
- No identifying information appears next to commits (everything should
read `anonymous`).
Also run one final string search per repo via the file viewer for your own
surname, your affiliation, and your work email domain:
```
<your-surname> # must return nothing
<your-affiliation> # must return nothing
<your-email-domain> # must return nothing
```
## 6. Share with reviewers
The single URL that ties the three repos together is
<https://huggingface.co/legexbenchmark>. Add it to the supplementary
material of your OpenReview submission; reviewers can browse all three
datasets from that org page without logging into HF.
---
## Troubleshooting
**A commit shows your real name despite the local config.** Run
`git log -1 --pretty='%an <%ae>'` inside the clone. If it still shows your
real identity, redo `git config user.name / user.email` and then
`git commit --amend --reset-author` before pushing.
**HF complains about LFS quota.** Free accounts get 1 GB of LFS storage;
this release uses ~30 MB so quota is not a concern.
**A file exceeds 5 GB.** None of the files in this release do. If a future
addition does, `git lfs track` the path and recommit.
**You want to delete a repo.** Each repo's Settings page has "Delete this
dataset repository" — that removes files and history.
**You need to re-push after a fix.** `cd` into the local clone, edit, commit
with `--reset-author` if you also re-ran `git config`, then `git push`.
**Reviewers ask for a single zip.** HF's "Use this dataset" → "Repository
size" → "Download repository" gives a `.tar.gz` of the whole repo.