-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (43 loc) · 1.77 KB
/
Copy pathMakefile
File metadata and controls
50 lines (43 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
CHALLENGE ?= ../mib-doc-challenge
PY := ./.venv/bin/python
IMAGE := mib-submission
OUT := /tmp/mib-output
.DEFAULT_GOAL := help
.PHONY: help build policy score validate clean
help:
@echo "Targets:"
@echo " build build the linux/amd64 submission image"
@echo " policy cross-validate the adjudication cascade on ground-truth fields"
@echo " score run the image over the training set and score it"
@echo " validate check predictions.jsonl against the submission format"
@echo " clean remove build and output artifacts"
# --platform is load-bearing: this builds on arm64 but the graders run x86_64,
# and an arm64-only image is a zero.
build:
docker build --platform linux/amd64 -t $(IMAGE) .
policy:
$(PY) scripts/fit_policy.py --labels $(CHALLENGE)/data/train_labels.csv
# Mirrors the scoring invocation in DOCKER_SUBMISSION.md, limits included.
score: build
mkdir -p $(OUT)
docker run --rm --network none \
--cpus 4 --memory 8g --pids-limit 512 \
--read-only --tmpfs /tmp:rw,nosuid,nodev,size=2g \
--mount type=bind,src="$(abspath $(CHALLENGE))/data/train",dst=/input,readonly \
--mount type=bind,src="$(OUT)",dst=/output \
$(IMAGE) /input /output/predictions.jsonl
$(MAKE) validate
python3 $(CHALLENGE)/scripts/evaluate.py \
--truth $(CHALLENGE)/data/train_labels.csv \
--submission $(OUT)/predictions.jsonl \
--output-json $(OUT)/evaluation.json \
--case-scores-jsonl $(OUT)/case_scores.jsonl
# Hard gate: a format violation scores zero, so this runs on every scored build,
# not once at the end.
validate:
python3 $(CHALLENGE)/scripts/validate_submission.py \
--submission $(OUT)/predictions.jsonl \
--manifest $(CHALLENGE)/data/train_labels.csv
clean:
rm -rf out
find . -name __pycache__ -type d -prune -exec rm -rf {} +