Skip to content
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

Tutorial for Shapley Value Sampling likely needs update #1486

Open
ayan-cpath opened this issue Jan 16, 2025 · 4 comments
Open

Tutorial for Shapley Value Sampling likely needs update #1486

ayan-cpath opened this issue Jan 16, 2025 · 4 comments

Comments

@ayan-cpath
Copy link

📚 Documentation

In the tutorials for perturbation based attribution for HuggingFace CasualLMs, in the block 12 that demonstrates how to use SHAP values, the parameter skip_tokens is being passed:

Image

Running that code gives the error - TypeError: ShapleyValues.attribute() got an unexpected keyword argument 'skip_tokens':

Image

Neither the API doc nor the source has the attribute method has parameter skip_tokens, likely removed in one of the more current versions of the package.

Image

Thanks for the great package and documentation.

@sarahtranfb
Copy link
Contributor

What version of Captum are you on? The tutorials are for the latest version; based on the screenshot provided, you're on a previous version where LLMAttribution.attribute() doesn't have skip_tokens as a parameter, and therefore it's being passed to ShapleyValues.attribute() as part of **kwarg, though ShapleyValues never supported skip_tokens.

Based on the code snippet, please remove skip_tokens from LLMAttribution.attribute() or update to a newer version.

@ayan-cpath
Copy link
Author

What version of Captum are you on? The tutorials are for the latest version; based on the screenshot provided, you're on a previous version where ...

Could be the case. I installed captum using pip install captum and it installed 0.7.0, which looks like the latest released version on here on github.

@ayan-cpath
Copy link
Author

I can likely do something along the lines of pip install --upgrade git+https://github.com/pytorch/captum.git and get the latest one, but then, it would be great to get a new stable release or update the doc to mention this.

@sarahtranfb
Copy link
Contributor

Ah yeah it's been a little over a year since the last package release, though we're actively trying to get one out soon. I'll leave this open and come back in a month if we still don't have a release to update the website and notebook to call out that a manual installation is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants