Skip to content

Clean-up generation tests after moving methods to private#29582

Merged
gante merged 10 commits intohuggingface:mainfrom
zucchini-nlp:generation_tests
Mar 19, 2024
Merged

Clean-up generation tests after moving methods to private#29582
gante merged 10 commits intohuggingface:mainfrom
zucchini-nlp:generation_tests

Conversation

@zucchini-nlp
Copy link
Copy Markdown
Member

What does this PR do?

Folllowing #29437 , this PR removes tests that call "to be private" generation methods. Instead we check each generation method by passing its arguments to the generate method.

All tests in generation, including slow are passing.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@gante

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Copy Markdown
Contributor

@gante gante left a comment

Choose a reason for hiding this comment

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

Thank you for the cleanup! 🧼

Comment thread tests/generation/test_utils.py Outdated
@gante gante requested a review from amyeroberts March 11, 2024 17:11
@gante
Copy link
Copy Markdown
Contributor

gante commented Mar 11, 2024

@zucchini-nlp a more descriptive PR name would be nice :D Musicgen seems to need some retouches, looking at the failing CI.

@amyeroberts see the PR header in #29437 for more context on why we are deprecating calls to the internal decoding methods

@zucchini-nlp zucchini-nlp changed the title Generation tests Clean-up generation tests after moving methods to private Mar 11, 2024
@zucchini-nlp
Copy link
Copy Markdown
Member Author

Fixed MusicGen. All passed except for two tests for multigpu, but those are failing in main also. Not related to current changes

Copy link
Copy Markdown
Contributor

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Thanks for working on this tidy up - great to see so much code killed.

Only request before merge is that we still have a max length backwards compatibility test

],
)

def test_max_length_backward_compat_greedy(self):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should still have at least one test_max_length_backward_compat test which calls model.generate

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I removed this tests, because we can only check it if the (now private) generate methods are called directly. When calling from the model.generate, the max_length get defined by default from the generation config.

We have a test test_default_max_length_warning, which check max_length warnings when calling directly generate

Comment thread tests/generation/test_utils.py Outdated
@gante
Copy link
Copy Markdown
Contributor

gante commented Mar 19, 2024

@zucchini-nlp suggestion: revert docsting changes, as they will cause CI to fail ( #29718 fixes the CI error) :)

@gante gante merged commit 425ba56 into huggingface:main Mar 19, 2024
ArthurZucker pushed a commit that referenced this pull request Mar 20, 2024
* clean-up tests

* refine comments

* fix musicgen tests

* make style

* remove slow decorator from a test

* more clean-up

* fix other failing tests
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.

4 participants