You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently our dependencies for the deep explainer are mangled together somewhere deep down. This best visible when running the notebook notebooks/image_examples/image_classification/PyTorch Deep Explainer MNIST example.ipynb without tf_keras installed, then one gets an error. This is completely counter intuitive since this notebook just needs pytorch related dependencies. We should definitely get this into a state where pytorch and tensorflow code can coexist without the other framework being installed.
Minimal Reproducible Example
pipuninstalltf_kerasthenrun`notebooks/image_examples/image_classification/PyTorch Deep Explainer MNIST example.ipynb`thenthisthrowsanerrorinthecell# since shuffle=True, this is a random sample of test databatch=next(iter(test_loader))
images, _=batchbackground=images[:100]
test_images=images[100:103]
e=shap.DeepExplainer(model, background)
shap_values=e.shap_values(test_images)
``
Traceback
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
File ~/programming/github/shap_master/.venv/lib/python3.10/site-packages/transformers/activations_tf.py:22
21 try:
---> 22 import tf_keras as keras
23 except (ModuleNotFoundError, ImportError):
ModuleNotFoundError: No module named 'tf_keras'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
File ~/programming/github/shap_master/.venv/lib/python3.10/site-packages/transformers/utils/import_utils.py:1472, in _LazyModule._get_module(self, module_name)
1471 try:
-> 1472 return importlib.import_module("." + module_name, self.__name__)
1473 except Exception as e:
File /usr/lib/python3.10/importlib/__init__.py:126, in import_module(name, package)
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
File <frozen importlib._bootstrap>:1050, in _gcd_import(name, package, level)
File <frozen importlib._bootstrap>:1027, in _find_and_load(name, import_)
...
1476 f" traceback):\n{e}"
1477 ) from e
RuntimeError: Failed to import transformers.modeling_tf_utils because of the following error (look up to see its traceback):
Your currently installed version of Keras is Keras 3, but this is not yet supported in Transformers. Please install the backwards-compatible tf-keras package with `pip install tf-keras`.
Expected Behavior
should work without any tensorflow dependencies
Bug report checklist
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest release of shap.
I have confirmed this bug exists on the master branch of shap.
I'd be interested in making a PR to fix this bug
Installed Versions
master
The text was updated successfully, but these errors were encountered:
Issue Description
Currently our dependencies for the deep explainer are mangled together somewhere deep down. This best visible when running the notebook
notebooks/image_examples/image_classification/PyTorch Deep Explainer MNIST example.ipynb
withouttf_keras
installed, then one gets an error. This is completely counter intuitive since this notebook just needs pytorch related dependencies. We should definitely get this into a state where pytorch and tensorflow code can coexist without the other framework being installed.Minimal Reproducible Example
Traceback
Expected Behavior
should work without any tensorflow dependencies
Bug report checklist
Installed Versions
master
The text was updated successfully, but these errors were encountered: