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

chore: update transformers test dependency #8752

Merged
merged 3 commits into from
Jan 21, 2025
Merged

Conversation

anakin87
Copy link
Member

Related Issues

  • we should use a recent version of transformers in the CI

Proposed Changes:

How did you test it?

CI

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@anakin87 anakin87 added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label Jan 20, 2025
@coveralls
Copy link
Collaborator

coveralls commented Jan 20, 2025

Pull Request Test Coverage Report for Build 12873461371

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 91.306%

Totals Coverage Status
Change from base Build 12864293707: 0.0%
Covered Lines: 8853
Relevant Lines: 9696

💛 - Coveralls

@@ -42,6 +42,7 @@ def mock_pipeline_tokenizer():
# Mocking the tokenizer
mock_tokenizer = Mock(spec=PreTrainedTokenizer)
mock_tokenizer.encode.return_value = ["Berlin", "is", "cool"]
mock_tokenizer.pad_token_id = 100
Copy link
Member Author

Choose a reason for hiding this comment

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

PreTrainedTokenizer in new versions of transformers does not have a default pad_token_id, so I'm setting it in the Mock.
(In any case, we are confident that our component works properly also thanks to an integration test.)

stop_words_criteria = StopWordsCriteria(tokenizer=Mock(spec=PreTrainedTokenizerFast), stop_words=["mock data"])

mock_tokenizer = Mock(spec=PreTrainedTokenizerFast)
mock_tokenizer.pad_token = "<pad>"
Copy link
Member Author

Choose a reason for hiding this comment

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

similar case as above.

@@ -459,3 +463,15 @@ def test_hf_pipeline_runs_with_our_criteria(self):
results = generator.run(prompt="something that triggers something")
assert results["replies"] != []
assert generator.stopping_criteria_list is not None

@pytest.mark.integration
Copy link
Member Author

Choose a reason for hiding this comment

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

I also added an integration test with a small model: it was missing and it helps to make sure everything works...

@anakin87 anakin87 marked this pull request as ready for review January 20, 2025 17:56
@anakin87 anakin87 requested a review from a team as a code owner January 20, 2025 17:56
@anakin87 anakin87 requested review from mpangrazzi and removed request for a team January 20, 2025 17:56
@anakin87 anakin87 merged commit f96839e into main Jan 21, 2025
31 checks passed
@anakin87 anakin87 deleted the transformers-4.47.1 branch January 21, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-for-release-notes PRs with this flag won't be included in the release notes. topic:build/distribution topic:tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants