Skip to content

Tutorial for Shapley Value Sampling likely needs update #1486

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

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

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.

sarahtranfb added a commit to sarahtranfb/captum that referenced this issue Feb 13, 2025
Summary:
Got pytorch#1486 when I was oncall

They ran into this error:
> TypeError: ShapleyValues.attribute() got an unexpected keyword argument 'skip_tokens'

due to being on a package of Captum 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

It's not sufficient to be on the latest Captum release (v0.7), atp they need to install from Github

Differential Revision: D69566114
sarahtranfb added a commit to sarahtranfb/captum that referenced this issue Feb 20, 2025
pytorch#1496)

Summary:

Got pytorch#1486 when I was oncall a while ago. A user ran into this error:
> TypeError: ShapleyValues.attribute() got an unexpected keyword argument 'skip_tokens'

due to being on a package of Captum 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

It's not sufficient to be on the latest Captum release (v0.7), atp they need to install from Github

Differential Revision: D69566114
facebook-github-bot pushed a commit that referenced this issue Feb 20, 2025
#1496)

Summary:
Pull Request resolved: #1496

Got #1486 when I was oncall a while ago. A user ran into this error:
> TypeError: ShapleyValues.attribute() got an unexpected keyword argument 'skip_tokens'

due to being on a package of Captum 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

It's not sufficient to be on the latest Captum release (v0.7), atp they need to install from Github

Reviewed By: craymichael

Differential Revision: D69566114

fbshipit-source-id: 38f5fdc46c610a8ab1e8a21ef375121fa18c9606
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