Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally persist intermediates for reduce #14

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

shreyashankar
Copy link
Collaborator

Add persist_intermediates feature to ReduceOperation

This PR closes #13.

Changes

  • Users can now specify "persist_intermediates": True in the reduce operation config.
  • When enabled, intermediate fold outputs are saved to a special key "_{op_name}_intermediates" in the result.

New Functionality

  • The persist_intermediates option allows users to track the progression of the reduce operation.
  • Intermediate results are stored as a list of dictionaries, each containing:
    • iter: The iteration number
    • intermediate: The intermediate result
    • scratchpad: Any additional information from the fold operation

Testing

  • Added a new test case test_reduce_operation_persist_intermediates to verify the functionality.
  • The test ensures that:
    • Intermediates are correctly persisted when the option is enabled
    • The structure of the intermediates is as expected
    • Intermediates are stored in the correct order

Usage Example

reduce_config = {
"name": "example_reduce",
"type": "reduce",
"reduce_key": "group",
"persist_intermediates": True,
# ... other config options ...
}

With this configuration, the results will include a key _example_reduce_intermediates containing the list of intermediate results.

Notes

  • This feature is optional and does not affect the normal operation of the ReduceOperation when not enabled.
  • The persisted intermediates can be useful for debugging, auditing, or analyzing the reduce process in detail.

@shreyashankar shreyashankar merged commit be8a8bb into main Sep 25, 2024
3 checks passed
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.

Persist intermediates of reduce operations
1 participant