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

Token Classification Memory Issue #117

Open
mattdeeperinsights opened this issue Nov 23, 2022 · 0 comments
Open

Token Classification Memory Issue #117

mattdeeperinsights opened this issue Nov 23, 2022 · 0 comments

Comments

@mattdeeperinsights
Copy link

mattdeeperinsights commented Nov 23, 2022

Hi there, I am using TokenClassificationExplainer which works great with small text inputs. However, for a large 512 token input my machine runs out of memory and crashes.

This is probably because of an [unavoidable?] exponential memory issue of creating attributions for all 512 subtokens for each subtoken. Normally, the local context is most likely to contribute to the classificaiton of each token, it could be useful to reduce the number of pairs we make for each token. For example, the 512th token is less related to the 10th token, than tokens 1 - 20.

Would it be possible to add in a context_window_size: Optional[int] = None somewhere (possibly here), to reduce the number of pairs, so we we only calculate attributions for the context_window_size many tokens to the left and right.

I have tried to dig into the code to add this functionality in a PR but I don't understand all of the functions as they are missing doc strings and comments (in here).

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

1 participant