run_report.py
attributes
| source_path | references/auto-labeling/code_templates/run_report.py |
|---|---|
| source_sha256 | ee3f9901e5239a950c84225c61a9ebd9b069dd0108a213b433ebc476855ebfcf |
| source_url | https://github.com/aws/agent-toolkit-for-aws/blob/903433d67cc4eeab334355620373f33a0c162dd4/skills/core-skills/aws-ai-ml/references/auto-labeling/code_templates/run_report.py |
| supporting_skill_id | 40202 |
| upstream_revision | 903433d67cc4eeab334355620373f33a0c162dd4 |
# Cell 0 [markdown]: The run report
# # The run report
#
# `report.html` and `report.md` from the project's artifacts: the labeled DataSet, the job's
# certificate and held-out report, the review fold and the run log. No labeled row is read.
# Cell 1: Configuration
PROJECT_DIR = "[PROJECT_DIR]" # the project directory holding the run outputs
DATASET = "" # [DATASET]: the dataset name shown in the title
FORMAT = "both" # html | md | both
OUT = None # [OUT]: dir for both, file for one format; None = PROJECT_DIR
CALIBRATION = None # [CALIBRATION]: the job's labeling_summary.json; None = <proj>/labeling_summary.json, else the corpus run's run-log entry
PRED_FIELD = "label" # [PRED_FIELD]: a local labels.jsonl's prediction field (`entities` for ner)
GT = None # [GT]: a gold file: checked by the split guard (the test read is logged), never joined to rows
import sys
from sagemaker.core import Attribution, set_attribution
set_attribution(Attribution.SAGEMAKER_AGENT_PLUGIN)
from sagemaker.ai_registry.data_preparer.exceptions import DataPreparerOperatorError
from sagemaker.ai_registry.data_preparer.auto_labeling.operators.report import write_report
from sagemaker.ai_registry.data_preparer.auto_labeling.operators.seed import split_state
# Cell 2: Build both documents, then write them
try:
touched = GT and split_state.guard_split_read_or_raise(GT, "report", {"dev", "val", "test"},
project_dir=PROJECT_DIR, log=False)
written = write_report(PROJECT_DIR, dataset=DATASET, fmt=FORMAT, out=OUT, calibration=CALIBRATION,
pred_field=PRED_FIELD, gt=GT)
if touched and touched.get("test"): # the completion gate passed: the test read is logged
split_state.log_test_read(PROJECT_DIR, GT, "report", touched["test"])
except (OSError, ValueError, DataPreparerOperatorError) as e:
sys.exit(f"report: {e}")
print("wrote " + ", ".join(written["wrote"]))
Children
No children yet.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.