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

Add text2text evaluator #261

Merged
merged 11 commits into from
Oct 12, 2022
Merged

Add text2text evaluator #261

merged 11 commits into from
Oct 12, 2022

Conversation

lvwerra
Copy link
Member

@lvwerra lvwerra commented Aug 18, 2022

This PR adds three evaluators following the pipeline philosophy:

  • text2text
  • translation
  • summarization

While they are functionality similar they use slightly different defaults. The parity tests for the Trainer are missing but we can add those in a separate PR I think.

(for some reason I can't add you as reviewer @fxmarty but I think you can comment anyway)

cc @philschmid

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 18, 2022

The documentation is not available anymore as the PR was closed or merged.

@@ -350,7 +350,7 @@ def prepare_pipeline(
pipe = model_or_pipeline
if tokenizer is not None and feature_extractor is not None:
logger.warning("Ignoring the value of the preprocessor argument (`tokenizer` or `feature_extractor`).")
if pipe.task != self.task:
if (pipe.task != self.task) and not (self.task == "translation" and pipe.task.startswith("translation")):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because for translation the task in the pipeline is translation_xx_to_yy where the placeholders are the languages.

@fxmarty
Copy link
Contributor

fxmarty commented Aug 19, 2022

That's great! We should include the new subclasses in https://github.com/huggingface/evaluate/blob/main/docs/source/package_reference/evaluator_classes.mdx I think, and probably mention them in the how-to guide.

Copy link
Contributor

@ola13 ola13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, some comments and questions inline!

src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
lvwerra and others added 3 commits October 7, 2022 16:47
Co-authored-by: helen <31600291+mathemakitten@users.noreply.github.com>
@lvwerra
Copy link
Member Author

lvwerra commented Oct 10, 2022

Thanks for your feedback, I think I integrated everything. Let me know if you think anything else needs to be changed!

Copy link
Contributor

@mathemakitten mathemakitten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good to me, just some minor changes needed to the examples in the doc; see comments.

@NimaBoscarino have you had a chance to try this out yet? We can merge this for now but make updates to text2text-generation if it doesn't work with HONEST.

src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
Co-authored-by: helen <31600291+mathemakitten@users.noreply.github.com>
Copy link
Contributor

@NimaBoscarino NimaBoscarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a couple small comments! I don't think that this works with HONEST for the moment for a couple reasons, but I'm wrapping up a few tests and will post my thoughts + questions as soon as I'm done.

EDIT: After talking with Leandro, it sounds like HONEST would likely work better with a FillMaskEvaluator, so I can hack one together for that tomorrow!

src/evaluate/evaluator/__init__.py Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
src/evaluate/evaluator/text2text_generation.py Outdated Show resolved Hide resolved
lvwerra and others added 2 commits October 12, 2022 11:53
Co-authored-by: Nima Boscarino <nima.boscarino@gmail.com>
@lvwerra lvwerra merged commit 039a77c into main Oct 12, 2022
@lvwerra lvwerra deleted the add-text2text-evaluator branch October 12, 2022 10:44
NimaBoscarino added a commit that referenced this pull request Oct 17, 2022
* add text2text evaluator

* add tests

* Apply suggestions from code review

Co-authored-by: helen <31600291+mathemakitten@users.noreply.github.com>

* final tweaks to t2t evaluators

* fix compute docstring in base class

* add new split/subset logic

* Apply suggestions from code review

Co-authored-by: helen <31600291+mathemakitten@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Nima Boscarino <nima.boscarino@gmail.com>

* update docs

Co-authored-by: helen <31600291+mathemakitten@users.noreply.github.com>
Co-authored-by: Nima Boscarino <nima.boscarino@gmail.com>
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

Successfully merging this pull request may close these issues.

None yet

6 participants