muellerzr / fastinference

A collection of inference modules for fastai2
https://muellerzr.github.io/fastinference
Apache License 2.0
89 stars 16 forks source link

SHAP won't install "from fastinference.tabular import *" Fails #15

Closed md598 closed 4 years ago

md598 commented 4 years ago

Trying to install, use SHAP.

!pip install fastinference fastai -q, this works

from fastinference.tabular import * produces:

ModuleNotFoundError Traceback (most recent call last)

in () ----> 1 from fastinference.tabular import * 3 frames /usr/local/lib/python3.6/dist-packages/fastinference/tabular/__init__.py in () 3 raise ImportError("The interp module is not installed.") 4 ----> 5 from .shap import * 6 from .interpretation import * /usr/local/lib/python3.6/dist-packages/fastinference/tabular/shap/__init__.py in () ----> 1 from .interp import * /usr/local/lib/python3.6/dist-packages/fastinference/tabular/shap/interp.py in () 4 5 # Cell ----> 6 from .core import _prepare_data, _predict 7 import shap 8 from fastai.tabular.all import * /usr/local/lib/python3.6/dist-packages/fastinference/tabular/shap/core.py in () 4 5 # Cell ----> 6 from fastai.tabular.all import * 7 8 # Cell ModuleNotFoundError: No module named 'fastai.tabular.all' --------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. To view examples of installing some common dependencies, click the "Open Examples" button below. Have also tried: !pip install fastinference[interp] -q and no luck. Thanks!
muellerzr commented 4 years ago

I'd presume you're using colab, as this means you have the wrong version of fastai. You need to install with --upgrade. Also you need to install with interp as the README states.

md598 commented 4 years ago

Using colab. Did upgrade fastai with !pip install fastai --upgrade and did !pip install fastinference[interp] per README, same issue. Any ideas?

md598 commented 4 years ago

Copy/pasted in a bunch of the code from this notebook and it worked! https://github.com/muellerzr/fastinference/blob/master/nbs/02_shap.interp.ipynb Hopefully that's insightful! Congrats on the new release! Got the book on order!

muellerzr commented 4 years ago

I didn't get an issue, did you make sure to restart your instance? (also updating the shap requirement, didn't realize I missed one) I did the following steps:

!pip install fastinference[interp] shap
!pip install fastai --upgrade
from fastinference.tabular import *

Also, I had nothing to do with Jeremy & Sylvain's book :)

md598 commented 4 years ago

It worked! Thank you!