Merge nucleic/sleek-ember-seal-uady into dev
This commit is contained in:
+34
-1
@@ -28,6 +28,7 @@ from purpose_data import (
|
||||
write_json,
|
||||
write_jsonl,
|
||||
)
|
||||
from review_contract import apply_completed_human_review
|
||||
|
||||
|
||||
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
@@ -121,6 +122,8 @@ def _build_manifest(
|
||||
seed: int,
|
||||
near_duplicate_threshold: float,
|
||||
curation_review_path: Path | None,
|
||||
human_review_path: Path | None,
|
||||
human_review_summary: dict[str, Any] | None,
|
||||
) -> dict[str, Any]:
|
||||
manifest = {
|
||||
"schemaVersion": 1,
|
||||
@@ -181,6 +184,12 @@ def _build_manifest(
|
||||
if curation_review_path is not None:
|
||||
manifest["curation"]["reviewPath"] = _relative(curation_review_path)
|
||||
manifest["curation"]["reviewSha256"] = file_sha256(curation_review_path)
|
||||
if human_review_path is not None:
|
||||
manifest["curation"]["humanReview"] = {
|
||||
"path": _relative(human_review_path),
|
||||
"sha256": file_sha256(human_review_path),
|
||||
"summary": human_review_summary,
|
||||
}
|
||||
return manifest
|
||||
|
||||
|
||||
@@ -195,6 +204,7 @@ def prepare(
|
||||
seed: int,
|
||||
near_duplicate_threshold: float,
|
||||
curation_review_path: Path | None = None,
|
||||
human_review_path: Path | None = None,
|
||||
) -> dict[str, Any]:
|
||||
records = load_sources(sources)
|
||||
fixtures = load_classifiable_fixtures(fixtures_path)
|
||||
@@ -215,8 +225,18 @@ def prepare(
|
||||
if curation_review_path is not None
|
||||
else CurationResult(records=lexical_curation.records, duplicates=[])
|
||||
)
|
||||
human_review_summary = None
|
||||
reviewed_records = reviewed_curation.records
|
||||
if human_review_path is not None:
|
||||
human_review = apply_completed_human_review(
|
||||
human_review_path,
|
||||
reviewed_records,
|
||||
dataset_version=DATASET_VERSION,
|
||||
)
|
||||
reviewed_records = human_review.records
|
||||
human_review_summary = human_review.summary
|
||||
curated = CurationResult(
|
||||
records=reviewed_curation.records,
|
||||
records=reviewed_records,
|
||||
duplicates=lexical_curation.duplicates + reviewed_curation.duplicates,
|
||||
)
|
||||
splits = split_records(
|
||||
@@ -283,6 +303,8 @@ def prepare(
|
||||
seed=seed,
|
||||
near_duplicate_threshold=near_duplicate_threshold,
|
||||
curation_review_path=curation_review_path,
|
||||
human_review_path=human_review_path,
|
||||
human_review_summary=human_review_summary,
|
||||
)
|
||||
# The frozen path can be overridden in tests or experiments.
|
||||
manifest["frozenEval"]["syntheticPath"] = _relative(frozen_test_path)
|
||||
@@ -328,6 +350,14 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
default=DEFAULT_CURATION_REVIEW,
|
||||
help="completed semantic duplicate review applied after lexical deduplication",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--human-review",
|
||||
type=Path,
|
||||
help=(
|
||||
"completed label-and-difficulty review ledger from review_data.py; "
|
||||
"omitted until human review is complete"
|
||||
),
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
@@ -349,6 +379,9 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||
seed=args.seed,
|
||||
near_duplicate_threshold=args.near_duplicate_threshold,
|
||||
curation_review_path=args.curation_review.resolve(),
|
||||
human_review_path=(
|
||||
args.human_review.resolve() if args.human_review is not None else None
|
||||
),
|
||||
)
|
||||
except (DataError, OSError, UnicodeError, json.JSONDecodeError) as exc:
|
||||
print(f"error: {exc}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user