coco_pipe.decoding.persistence#
Resumable decoding-run artifact utilities.
Attributes#
Functions#
|
Pick the primary metric name from available |
|
Add |
|
Recursively redact credentials before persisting configs or reports. |
|
Return a stable short hash for a run configuration. |
|
Short SHA-256 over array-likes: dtype, shape and contents ( |
|
Recursively convert NumPy types to JSON-safe Python primitives. |
|
Write a unit's manifest in one step, so it is never seen half-written. |
|
Return a unit's manifest, or None if the unit has not finished. |
|
Return whether |
|
Rehydrate aggregate rows for a safely resumed experiment. |
|
Write exactly one run-level success, partial, or failure marker. |
Module Contents#
- coco_pipe.decoding.persistence.resolve_primary_metric_name(available, metrics=None)#
Pick the primary metric name from available
<metric>_meancolumns.Preference order:
balanced_accuracy(the group-robust default), then the first configured metric that has a_meancolumn, then the first available*_meancolumn. ReturnsNonewhen no scalar metric column is present.- Parameters:
available (collections.abc.Sequence[str])
metrics (collections.abc.Sequence[str] | None)
- Return type:
str | None
- coco_pipe.decoding.persistence.stamp_primary_metric(record, metrics=None)#
Add
primary_metric_name+primary_metricto a summary record in place.Keeps every downstream consumer (leaderboards, head-to-head, reports) on one metric contract instead of re-deriving it. No-op when the record carries no scalar
*_meanmetric column.
- coco_pipe.decoding.persistence.redact_sensitive(value)#
Recursively redact credentials before persisting configs or reports.
- Parameters:
value (Any)
- Return type:
Any
- coco_pipe.decoding.persistence.config_hash(config)#
Return a stable short hash for a run configuration.
- Parameters:
config (collections.abc.Mapping[str, Any])
- Return type:
- coco_pipe.decoding.persistence.data_digest(*values)#
Short SHA-256 over array-likes: dtype, shape and contents (
Noneallowed).The decoding runner uses it for a unit’s input-data fingerprint (part of the resume hash) and for the sample-set signature paired comparisons must share.
- Parameters:
values (Any)
- Return type:
- coco_pipe.decoding.persistence.RUN_MANIFEST_FILENAME = 'run_manifest.json'#
- coco_pipe.decoding.persistence.make_serializable(obj)#
Recursively convert NumPy types to JSON-safe Python primitives.
- Parameters:
obj (Any)
- Return type:
Any
- coco_pipe.decoding.persistence.write_run_manifest(output_dir, manifest)#
Write a unit’s manifest in one step, so it is never seen half-written.
- Parameters:
output_dir (str | pathlib.Path)
manifest (collections.abc.Mapping[str, Any])
- Return type:
- coco_pipe.decoding.persistence.read_run_manifest(output_dir)#
Return a unit’s manifest, or None if the unit has not finished.
- Parameters:
output_dir (str | pathlib.Path)
- Return type:
- coco_pipe.decoding.persistence.completed_for_config(output_dir, config)#
Return whether
output_dircontains a successful matching run.- Parameters:
output_dir (str | pathlib.Path)
config (collections.abc.Mapping[str, Any])
- Return type:
- coco_pipe.decoding.persistence.load_completed_result_records(output_dir, context, *, metrics=None)#
Rehydrate aggregate rows for a safely resumed experiment.
- Parameters:
output_dir (str | pathlib.Path)
context (collections.abc.Mapping[str, Any])
metrics (collections.abc.Sequence[str] | None)
- Return type:
- coco_pipe.decoding.persistence.write_run_status(root, status)#
Write exactly one run-level success, partial, or failure marker.
- Parameters:
root (str | pathlib.Path)
status (str)
- Return type: