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

refactor!: make TGI generators compatible with huggingface_hub>=0.22.0 #7425

Merged
merged 6 commits into from
Mar 26, 2024

Conversation

anakin87
Copy link
Member

Related Issues

Proposed Changes:

  • Adopt all new abstractions of huggingface_hub: they are now public (and less susceptible to breaking changes, I hope)
  • Encourage users to install huggingface_hub>=0.22.0 in lazy_import message and release note. Since it is not a core dependency, there seems to be no effective way to make this encouragement mandatory.
  • Remove pin from tests dependencies

How did you test it?

  • CI, adapted tests
  • manual tests for both the generators, in streaming and non-streaming mode, with the HF Inference API and a local TGI container

Checklist

@github-actions github-actions bot added type:documentation Improvements on the docs topic:tests topic:build/distribution 2.x Related to Haystack v2.0 labels Mar 26, 2024
@@ -261,7 +265,7 @@ def _run_streaming(
message = ChatMessage.from_assistant(chunk.generated_text)
message.meta.update(
{
"finish_reason": chunk.details.finish_reason.value,
"finish_reason": chunk.details.finish_reason,
Copy link
Member Author

Choose a reason for hiding this comment

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

finish_reason became a Literal[str]

@anakin87 anakin87 marked this pull request as ready for review March 26, 2024 12:15
@anakin87 anakin87 requested review from a team as code owners March 26, 2024 12:15
@anakin87 anakin87 requested review from dfokina and silvanocerza and removed request for a team March 26, 2024 12:15
@vblagoje
Copy link
Member

vblagoje commented Mar 26, 2024

@silvanocerza do you want me to review this one? I'd love to

@coveralls
Copy link
Collaborator

coveralls commented Mar 26, 2024

Pull Request Test Coverage Report for Build 8435759942

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 10 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.003%) to 89.426%

Files with Coverage Reduction New Missed Lines %
components/generators/chat/hugging_face_tgi.py 5 94.79%
components/generators/hugging_face_tgi.py 5 94.38%
Totals Coverage Status
Change from base Build 8435328396: -0.003%
Covered Lines: 5514
Relevant Lines: 6166

💛 - Coveralls

@anakin87 anakin87 requested a review from vblagoje March 26, 2024 14:32
@anakin87
Copy link
Member Author

@vblagoje feel free to review this PR!

Copy link
Member

@vblagoje vblagoje left a comment

Choose a reason for hiding this comment

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

LGTM, left an optional comment

TextGenerationOutput,
TextGenerationOutputToken,
TextGenerationStreamOutput,
)
Copy link
Member

Choose a reason for hiding this comment

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

Niceee, they externalised these classes...

pyproject.toml Show resolved Hide resolved
@anakin87 anakin87 merged commit e26ee0f into main Mar 26, 2024
40 checks passed
@anakin87 anakin87 deleted the fix-tgi branch March 26, 2024 15:10
@anakin87 anakin87 mentioned this pull request Apr 6, 2024
1 task
silvanocerza pushed a commit that referenced this pull request Apr 8, 2024
….0` (#7425)

* progress

* progress

* better lazy imports

* fixes

* reno
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0 topic:build/distribution topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor TGI generators to make them compatible with huggingface_hub>=0.22.0
3 participants