-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
BUG: 'tuple' object has no attribute 'as_list' #3645
Comments
Thanks for reporting @Amirhossein4096 . Would you be so kind and provide an example that reproduces the issue? Your code is not complete since we cannot define the model in it. Would be great if you could trim your code down to the minimal steps needed to produce this bug. |
I am using same versions of TensorFlow and Shap. With a LSTM model, I've received same error:AttributeError Traceback (most recent call last) File ~\AppData\Local\anaconda3\Lib\site-packages\shap\explainers_deep_init_.py:90, in DeepExplainer.init(self, model, data, session, learning_phase_flags) File ~\AppData\Local\anaconda3\Lib\site-packages\shap\explainers_deep\deep_tf.py:172, in TFDeep.init(self, model, data, session, learning_phase_flags) AttributeError: 'tuple' object has no attribute 'as_list' |
@NanK77 would you be so kind to share code so that we can reproduce the issue? We need a definition of the data (at best a minimal set of row) and code to construct the model. |
I'm also running into this issue- I can't really share code that reproduces the issue because I work in health tech, but the inputs to shap.DeepExplainer are a 3 layer model trained in tensorflow: and a dataframe of numerical features with no nans can someone let me know if they found a workaround for this? Here's the exact error I'm gettingAttributeError Traceback (most recent call last) File /opt/conda/lib/python3.10/site-packages/shap/explainers/_deep/init.py:84, in DeepExplainer.init(self, model, data, session, learning_phase_flags) File /opt/conda/lib/python3.10/site-packages/shap/explainers/_deep/deep_tf.py:172, in TFDeep.init(self, model, data, session, learning_phase_flags) AttributeError: 'tuple' object has no attribute 'as_list' |
Sorry, should have known this before, but we currently do not support tensorflow 2.16 right now. See https://github.com/shap/shap/blob/master/pyproject.toml#L74. Will close this here, since support of tf 2.16 and keras 3 is way more complicated than this here. See the mentioned issue #3672 |
Issue Description
I used shap to interpret my cnn model. When shap tries to get the output shape in its internal function, i get error. I know it's because of the tensorflow version, how can I fix this error?
There isn't problem in tensorflow==2.15.0
Please solve this problem for tensorflow==2.16.1
Minimal Reproducible Example
Traceback
Expected Behavior
No response
Bug report checklist
Installed Versions
my package versions:
tensorflow==2.16.1
shap==0.45.1
The text was updated successfully, but these errors were encountered: