Skip to content

Implement serialization of Summarizer #1293

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

Closed
wants to merge 1 commit into from

Conversation

yucu
Copy link
Contributor

@yucu yucu commented Jun 6, 2024

Summary:
To save a checkpoint of a Feature Importance job, we will need to persistent below fields in https://www.internalfb.com/code/fbsource/[5e3ebcd68e0c]/fbcode/model_understanding/feature_importance/summarizer.py?lines=89-99 in order save the state of the job:

        # Initialize summarizers
        self.input_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.input_coverage_summarizer = Summarizer([Mean()])
        self.derived_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.derived_coverage_summarizer = Summarizer([Mean()])
        self.neuron_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])

        # Initialize batch counts
        self.input_batch_count = 0
        self.derived_batch_count = 0
        self.neuron_batch_count = 0

This diff implements (de)serialization of Summarizer.

future diffs include:

  • save FI checkpoints to manifold
  • add the hook to Mast graceful preemption to save the checkpoint of Feature Importance Job
  • load checkpoint when initializing the Feature Importance Job

Differential Revision: D58227186

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58227186

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58227186

yucu pushed a commit to yucu/captum that referenced this pull request Jun 7, 2024
Summary:
Pull Request resolved: pytorch#1293

To save a checkpoint of a Feature Importance job, we will need to persistent below fields in https://www.internalfb.com/code/fbsource/[5e3ebcd68e0c]/fbcode/model_understanding/feature_importance/summarizer.py?lines=89-99 in order save the state of the job:
```
        # Initialize summarizers
        self.input_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.input_coverage_summarizer = Summarizer([Mean()])
        self.derived_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.derived_coverage_summarizer = Summarizer([Mean()])
        self.neuron_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])

        # Initialize batch counts
        self.input_batch_count = 0
        self.derived_batch_count = 0
        self.neuron_batch_count = 0
```

This diff implements (de)serialization of Summarizer.

### future diffs include:
 - save FI checkpoints to manifold
 - add the hook to Mast graceful preemption to save the checkpoint of Feature Importance Job
 - load checkpoint when initializing the Feature Importance Job

Reviewed By: MarcioPorto

Differential Revision: D58227186
@yucu yucu force-pushed the export-D58227186 branch from 4caf81a to 1bc6bb6 Compare June 7, 2024 21:47
@facebook-github-bot
Copy link
Contributor

@lurunming has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58227186

yucu pushed a commit to yucu/captum that referenced this pull request Jun 10, 2024
Summary:
To save a checkpoint of a Feature Importance job, we will need to persistent below fields in https://www.internalfb.com/code/fbsource/[5e3ebcd68e0c]/fbcode/model_understanding/feature_importance/summarizer.py?lines=89-99 in order save the state of the job:
```
        # Initialize summarizers
        self.input_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.input_coverage_summarizer = Summarizer([Mean()])
        self.derived_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.derived_coverage_summarizer = Summarizer([Mean()])
        self.neuron_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])

        # Initialize batch counts
        self.input_batch_count = 0
        self.derived_batch_count = 0
        self.neuron_batch_count = 0
```

This diff implements (de)serialization of Summarizer.

### future diffs include:
 - save FI checkpoints to manifold
 - add the hook to Mast graceful preemption to save the checkpoint of Feature Importance Job
 - load checkpoint when initializing the Feature Importance Job

Pull Request resolved: pytorch#1293

Reviewed By: MarcioPorto

Differential Revision: D58227186

Pulled By: lurunming
@yucu yucu force-pushed the export-D58227186 branch from 1bc6bb6 to d481a3b Compare June 10, 2024 16:47
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58227186

yucu pushed a commit to yucu/captum that referenced this pull request Jun 10, 2024
Summary:
To save a checkpoint of a Feature Importance job, we will need to persistent below fields in https://www.internalfb.com/code/fbsource/[5e3ebcd68e0c]/fbcode/model_understanding/feature_importance/summarizer.py?lines=89-99 in order save the state of the job:
```
        # Initialize summarizers
        self.input_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.input_coverage_summarizer = Summarizer([Mean()])
        self.derived_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.derived_coverage_summarizer = Summarizer([Mean()])
        self.neuron_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])

        # Initialize batch counts
        self.input_batch_count = 0
        self.derived_batch_count = 0
        self.neuron_batch_count = 0
```

This diff implements (de)serialization of Summarizer.

### future diffs include:
 - save FI checkpoints to manifold
 - add the hook to Mast graceful preemption to save the checkpoint of Feature Importance Job
 - load checkpoint when initializing the Feature Importance Job

Pull Request resolved: pytorch#1293

Reviewed By: MarcioPorto

Differential Revision: D58227186

Pulled By: lurunming
@yucu yucu force-pushed the export-D58227186 branch from d481a3b to b57ed3c Compare June 10, 2024 20:43
Summary:
To save a checkpoint of a Feature Importance job, we will need to persistent below fields in https://www.internalfb.com/code/fbsource/[5e3ebcd68e0c]/fbcode/model_understanding/feature_importance/summarizer.py?lines=89-99 in order save the state of the job:
```
        # Initialize summarizers
        self.input_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.input_coverage_summarizer = Summarizer([Mean()])
        self.derived_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])
        self.derived_coverage_summarizer = Summarizer([Mean()])
        self.neuron_attr_summarizer = Summarizer([Mean(), StdDev(order=0)])

        # Initialize batch counts
        self.input_batch_count = 0
        self.derived_batch_count = 0
        self.neuron_batch_count = 0
```

This diff implements (de)serialization of Summarizer.

### future diffs include:
 - save FI checkpoints to manifold
 - add the hook to Mast graceful preemption to save the checkpoint of Feature Importance Job
 - load checkpoint when initializing the Feature Importance Job

Pull Request resolved: pytorch#1293

Reviewed By: MarcioPorto

Differential Revision: D58227186

Pulled By: lurunming
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58227186

@facebook-github-bot
Copy link
Contributor

@lurunming merged this pull request in 3f0cd93.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants