Skip to content

Disable model.graph output by default - #1264

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/disable-model-graph
May 15, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/disable-model-graph

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

model.graph is now gated by a new model_graph flag in autofit/config/output.yaml (default false). Previously the file was always opened — and stayed empty for ordinary PriorModel/Collection fits because model.graph_info raised AttributeError after the file had already been created. This left an empty model.graph in every fit output folder.

The metadata file is intentionally unchanged: it is the sentinel Aggregator.from_directory() (autofit/aggregator/aggregator.py:177) uses to detect search output directories, and SearchOutput.__init__ parses its name=... / non_linear_search=... lines into attributes (autofit/aggregator/search_output.py:207-217).

API Changes

  • New config key output.model_graph (default false) in autofit/config/output.yaml.
  • Default behaviour change: model.graph is no longer written for any fit unless model_graph: true is set in the user's output.yaml. Graphical-model users who want the factor-graph summary file must opt in.

No public Python symbols are added, removed, renamed, or changed in signature.

See full details below.

Test Plan

  • pytest test_autofit/non_linear/paths -x passes.
  • Run a small workspace fit (e.g. autofit_workspace/scripts/overview/simple/fit.py) — confirm model.graph is NOT present in the output folder.
  • Set model_graph: true in output.yaml and run a graphical-model fit; confirm model.graph is written with the factor-graph summary.
  • Aggregator regression: Aggregator.from_directory(...) still discovers fits (sentinel metadata file is unchanged).
Full API Changes (for automation & release notes)

Added

  • Config key output.model_graph in autofit/config/output.yaml — boolean, default false. When true, _save_model_info writes model.graph for models that expose a graph_info attribute.

Changed Behaviour

  • DirectoryPaths._save_model_info no longer creates an empty model.graph for non-graphical models. The write is now gated by should_output("model_graph") and hasattr(model, "graph_info"). Replaces the previous try/except AttributeError block that opened the file before checking for the attribute.

Removed

  • None.

Migration

  • Default users: no migration — empty model.graph files simply stop being produced.
  • Graphical-model users who relied on model.graph being present: add model_graph: true to your workspace's config/output.yaml.

🤖 Generated with Claude Code

Adds a `model_graph` flag in autofit/config/output.yaml (default
`false`) and gates the `_save_model_info` write in directory.py with
`should_output("model_graph") and hasattr(model, "graph_info")`.

The previous `try/except AttributeError` block opened the file before
accessing `model.graph_info`, so an empty `model.graph` was created
for every non-graphical-model fit. The new gate avoids the empty file
and lets users opt in via the config flag.

The `metadata` file in the output folder is intentionally unchanged:
it is the sentinel Aggregator.from_directory() uses to detect search
output directories, and SearchOutput parses its key=value lines into
attributes.
@Jammy2211
Jammy2211 merged commit 889a41d into main May 15, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/disable-model-graph branch May 15, 2026 07:22
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant