Skip to content

Config

Typed configuration follows module ownership:

  • graphids.exp.config defines experiments, resolved runs, resources, outputs, and the fit/test payload (RunPayload).
  • graphids.data.config.CANEventDataConfig defines event data loading and chronological stream batching.
  • graphids.models.config.EventGraphMambaConfig defines the graph-Mamba model and its training objectives.
  • graphids.data.representation.CANEventRepresentationConfig defines the message-preserving event contract.

Experiments may extend one relative base YAML. See configuration composition for merge rules, expanded config snapshots, and standalone compatibility.

graphids.exp.run resolves the built-in YAML types can_event_dm and event_graph_mamba directly to their config classes. Custom components and callbacks use class_path with optional init_args. Config builders and direct data/model constructors share validation; checkpoint reconstruction uses the same model settings.

Python imports use the domain packages above. The old graphids.core and graphids.primitives* modules have been removed without forwarding aliases. Input YAML and checkpoint contracts are preserved. Current run manifests use schema 2 for saved results; readers also accept historical manifests and MLflow ingest payloads. Configuration objects do not write files or format tracking data.

config

Typed experiment config objects.

This is intentionally framework-agnostic: CLI, SLURM, and future adapters consume the same domain config.

ExperimentConfig

Bases: _StrictModel

Top-level experiment description.

This is the domain entrypoint: compose here, then resolve to one RunConfig.

OutputConfig

Bases: _StrictModel

Filesystem layout for a run.

ResourceConfig

Bases: _StrictModel

Execution resources for a run.

RunConfig

Bases: _StrictModel

Resolved launch config for a single run.

RunPayload

Bases: _StrictModel

Typed payload for fit/test launches.

load_experiment_yaml

load_experiment_yaml(path: str | Path, _parents: tuple[Path, ...] = ()) -> dict[str, Any]

Expand a single relative base before validating the experiment.

Source code in graphids/exp/config.py
def load_experiment_yaml(
    path: str | Path, _parents: tuple[Path, ...] = ()
) -> dict[str, Any]:
    """Expand a single relative base before validating the experiment."""
    path = Path(path).resolve()
    if path in _parents:
        chain = " -> ".join(str(p) for p in (*_parents, path))
        raise ValueError(f"experiment inheritance cycle: {chain}")
    try:
        value = yaml.safe_load(path.read_text())
    except FileNotFoundError as exc:
        parent = f" (extended by {_parents[-1]})" if _parents else ""
        raise FileNotFoundError(f"experiment YAML not found: {path}{parent}") from exc
    if not isinstance(value, dict):
        raise ValueError(f"experiment YAML must be a mapping: {path}")
    if "extends" not in value:
        return value
    base = value.pop("extends")
    if not isinstance(base, str) or not base.strip():
        raise ValueError(f"extends must be one non-empty file path: {path}")
    return merge_config(
        load_experiment_yaml(path.parent / base, (*_parents, path)), value
    )

merge_config

merge_config(base: Mapping[str, Any], child: Mapping[str, Any]) -> dict[str, Any]

Merge overrides without carrying arguments across component identities.

Source code in graphids/exp/config.py
def merge_config(base: Mapping[str, Any], child: Mapping[str, Any]) -> dict[str, Any]:
    """Merge overrides without carrying arguments across component identities."""
    if any(
        key in child and child[key] != base.get(key) for key in ("type", "class_path")
    ):
        return copy.deepcopy(dict(child))
    result = copy.deepcopy(dict(base))
    for key, value in child.items():
        previous = result.get(key)
        result[key] = (
            merge_config(previous, value)
            if isinstance(previous, Mapping) and isinstance(value, Mapping)
            else copy.deepcopy(value)
        )
    return result