Skip to content

Add regression test for csfno checkpoint output being unchanged#870

Merged
mcgibbon merged 9 commits intomainfrom
feature/csfno_checkpoint_regression
Feb 24, 2026
Merged

Add regression test for csfno checkpoint output being unchanged#870
mcgibbon merged 9 commits intomainfrom
feature/csfno_checkpoint_regression

Conversation

@mcgibbon
Copy link
Contributor

These changes are used to test performance improvements in #861

Changes:

  • Added asdict and from_dict methods to Context

  • Added regression test which ensures the output of the conditional sfno after loading checkpoint data from disk is unchanged

  • Tests added

Copy link
Collaborator

@frodre frodre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few minor comments.

)
round_trip = Context.from_dict(context.asdict())
for attr_name in dir(context):
if not attr_name.startswith("_") and not callable(getattr(context, attr_name)):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use an intermediate variable / comment to hint at what you're targeting here in the conditional or just spell out the names you want to check in a sequence since they are also specified above. I had to go back into the Context definition to try and get more information.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it's just checking the top-level dataclass attributes, if it's testing more than that it would be good to know.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ai companion suggested dataclass.fields could be an option to extract just the top-level info rather than dir(), if that's the intention

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it's just checking the top-level dataclass attributes, if it's testing more than that it would be good to know.

Currently it is, but I'd like the test to fail if we ever add additional attributes (which may or may not be dataclass fields).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I'd spell that out at least in a comment

if not attr_name.startswith("_") and not callable(getattr(context, attr_name)):
original = getattr(context, attr_name)
round_tripped = getattr(round_trip, attr_name)
if original is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this case happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it did when the dim=0 but I don't think it does. Will update.

mcgibbon and others added 3 commits February 24, 2026 13:31
Co-authored-by: W. Andre Perkins <frodre@gmail.com>
…m/ace into feature/csfno_checkpoint_regression
@mcgibbon mcgibbon enabled auto-merge (squash) February 24, 2026 18:36
@mcgibbon mcgibbon merged commit 884d159 into main Feb 24, 2026
7 checks passed
@mcgibbon mcgibbon deleted the feature/csfno_checkpoint_regression branch February 24, 2026 19:35
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.

2 participants