Merge nucleic/sleek-ember-seal-uady into dev

This commit is contained in:
2026-07-30 19:21:08 -07:00
parent bb6d53a520
commit 09f98cdd00
7 changed files with 511 additions and 25 deletions
+14 -1
View File
@@ -65,6 +65,17 @@ def reviewed_population(args: argparse.Namespace) -> list[SourceRecord]:
).records
def review_policy_status(path: Path) -> str:
try:
value = json.loads(path.read_text(encoding="utf-8"))
status = value["humanLabelAndDifficultyReview"]["status"]
except (OSError, UnicodeError, json.JSONDecodeError, KeyError, TypeError) as exc:
raise DataError(f"{path}: cannot read human-review policy: {exc}") from exc
if not isinstance(status, str) or not status:
raise DataError(f"{path}: invalid human-review policy status")
return status
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--source", action="append", type=Path)
@@ -98,6 +109,7 @@ def main(argv: Sequence[str] | None = None) -> int:
args = build_parser().parse_args(argv)
try:
population = reviewed_population(args)
policy_status = review_policy_status(args.curation_review.resolve())
sample = stratified_review_sample(
population,
fraction=args.review_fraction,
@@ -152,7 +164,8 @@ def main(argv: Sequence[str] | None = None) -> int:
print(
f"Human review: {progress.completed}/{progress.records} complete "
f"({progress.accepted} accept, {progress.relabeled} relabel, "
f"{progress.rejected} reject, {progress.incomplete} remaining)."
f"{progress.rejected} reject, {progress.incomplete} remaining). "
f"Dataset policy: {policy_status}."
)
return 0