Skip to content

Commit 3f0cd93

Browse files
lurunmingfacebook-github-bot
authored andcommitted
Implement serialization of Summarizer (#1293)
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: #1293 Reviewed By: MarcioPorto Differential Revision: D58227186 Pulled By: lurunming fbshipit-source-id: e99029548eef7efe37fe4e39cbbe14acadbb240d
1 parent 5022a41 commit 3f0cd93

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

captum/attr/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
Sum,
7676
Var,
7777
)
78-
from captum.attr._utils.summarizer import Summarizer
78+
from captum.attr._utils.summarizer import Summarizer, SummarizerSingleTensor
7979

8080
__all__ = [
8181
"Attribution",
@@ -147,4 +147,5 @@
147147
"Max",
148148
"Sum",
149149
"Count",
150+
"SummarizerSingleTensor",
150151
]

0 commit comments

Comments
 (0)