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

Set tqdm to iterate over sentences when doing attributions for multiple sentences #177

Open
1 task done
jumelet opened this issue May 11, 2023 · 1 comment
Open
1 task done
Labels
enhancement New feature or request user qol Quality of life improvements for library users
Milestone

Comments

@jumelet
Copy link

jumelet commented May 11, 2023

Description

When computing attributions for a list of sentences the tqdm iterator prints out the iteration per token, which gives no insight into how far in you are with the corpus of sentences that you are attributing over. I would suggest that when attributing over a List of strings the tqdm iterates per sentence, and drops the per token iteration.

image

Commit to Help

Happy to have a go at this if you agree this could be nice.

  • I'm willing to help with this feature.
@jumelet jumelet added the enhancement New feature or request label May 11, 2023
@gsarti
Copy link
Member

gsarti commented May 11, 2023

Hey @jumelet, nice idea, and of course any help would be more than welcome! 😄

Some details and comments that might help in this sense:

  • The loop happens in the attribute method call, and supports both tqdm (in notebooks) and rich (in console, if pretty_progress=True) logging if show_progress=True.
  • attribute receives only a batch of inputs to attribute, since the full set of inputs is actually split in batches and passed gradually by the batched decorator around prepare_and_attribute
  • A simple way to achieve the desired behavior is to use tqdm for the outer loop inside batched, and set show_progress=False to avoid showing the per-example one. Consider however that for the console case, keeping the per-example rich progress might still be desirable.

Hope this helps, let me know how it goes!

@gsarti gsarti added the user qol Quality of life improvements for library users label May 11, 2023
@gsarti gsarti added this to the v0.5 milestone May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request user qol Quality of life improvements for library users
Projects
None yet
Development

No branches or pull requests

2 participants