Comments (4)
Puuhh, this seems pretty tough to fix. I tried to set every ReLU activation to inplace=False
but that still fails at the line
out += identity
of the resnet module with the same error. Strangely this works if I replace it with
out = out + identity
but then the shapes mismatch.
from shap.
Thanks for the reproducible example. I can confirm this on master.
I will have a look at this in the upcoming weeks.
from shap.
I am attempting to apply DeepExplainer for resnet50 and densenet121 and I am getting BackwardHookFunctionBackward error msg. I tried to modify the ReLU activation to disable the inplace operation by setting it to False. I am using the following approach to update the inplace:
class ModifiedDenseNet121(nn.Module):
def __init__(self, pretrained=True, input_channels=3, num_classes=1000):
super(ModifiedDenseNet121, self).__init__()
self.densenet = models.densenet121(weights=DenseNet121_Weights.DEFAULT if pretrained else None)
if input_channels != 3:
self.densenet.features[0] = nn.Conv2d(input_channels, 64, kernel_size=7, stride=2, padding=3, bias=False)
self.densenet.classifier = nn.Linear(self.densenet.classifier.in_features, num_classes)
# Fix the usage of ReLU activation with inplace=True
for module in self.densenet.modules():
if isinstance(module, nn.ReLU):
module.inplace = False
def forward(self, x):
return self.densenet(x)
However, I'm still encountering a runtime error: RuntimeError: Output 0 of BackwardHookFunctionBackward is a view and is being modified inplace. Any guidance or updates on how to resolve this error would be greatly appreciated. Thank you!
from shap.
If you really need this maybe have a look at captum. Would be great if you could report back your findings, so that we can borrow a couple of ideas from them
from shap.
Related Issues (20)
- Support for KerasClassifier HOT 1
- BUG: Failed in nopython mode pipeline (step: native lowering) float16 HOT 4
- Questions: question about SamplingExplainer HOT 1
- BUG: SHAP values calculated using CPU differ from SHAP values calculated using GPU HOT 5
- BUG: TypeError: ufunc 'isfinite' not supported for the input types HOT 4
- BUG: Additivity check failed HOT 1
- When plotting the shap text it is showing an extra letter(Ġ) before every word. HOT 1
- Demangle pytorch and tensorflow dependencies
- ENH: Python 3.13 Support
- TypeError: In v0.20, force plot now requires the base value as the first parameter! Try shap.plots.force(explainer.expected_value, shap_values) or for multi-output models try shap.plots.force(explainer.expected_value[0], shap_values[0]). HOT 1
- Key not found with shap.TreeExplainer and XGBRegressor HOT 1
- BUG: Unable to Generate SHAP values for a dataframe containing text data trained on lstm model HOT 2
- BUG: Error with SHAP Partial Dependence Plot: ValueError: DataFrame.dtypes for data must be int, float, bool or category
- ENH: integrated gradients
- Support tf 2.16 and keras 3 HOT 4
- BUG: shap.plots.bar(shap_values) TypeError
- BUG: Custom masker offset is not working properly
- BUG: AssertionError, the SHAP explanations do not sum up to the model's output!
- BUG: Background dataset subsampling HOT 4
- BUG: AttributeError: 'tuple' object has no attribute 'as_list' (tensorflow 2.15.0) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shap.