Skip to content

🗝️ Fix type hint in vLLM client #3205

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

Merged
merged 2 commits into from
Apr 2, 2025
Merged

🗝️ Fix type hint in vLLM client #3205

merged 2 commits into from
Apr 2, 2025

Conversation

qgallouedec
Copy link
Member

What does this PR do?

Fixes # (issue)

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? 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.
  • 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.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to fix an incorrect type hint in the vLLM client while also temporarily disabling the communicator initialization and cleanup routines.

  • Fix the type hint in the generate method from list[list[str]] to list[list[int]].
  • Comment out communicator initialization and atexit registration which could affect client resource management.
Comments suppressed due to low confidence (1)

trl/extras/vllm_client.py:94

  • Commenting out the communicator initialization and cleanup may lead to resource management issues if left in production. If this change is temporary, consider adding a comment explaining the rationale or removing the dead code altogether.
# self.init_communicator()

@@ -140,7 +139,7 @@ def generate(
min_p: float = 0.0,
max_tokens: int = 16,
guided_decoding_regex: Optional[str] = None,
) -> list[list[str]]:
) -> list[list[int]]:
Copy link
Preview

Copilot AI Apr 1, 2025

Choose a reason for hiding this comment

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

The updated type hint now indicates the function returns list[list[int]], which differs from the previous list[list[str]]. Please verify that model completions are meant to be represented as integers.

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

completion_ids: list[list[int]]

@qgallouedec qgallouedec requested a review from Copilot April 1, 2025 21:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an incorrect type hint in the vLLM client. The key change is updating the annotated return type of the generate() function from list[list[str]] to list[list[int]].

Comments suppressed due to low confidence (1)

trl/extras/vllm_client.py:143

  • The updated type hint indicates that the function should return a list of lists of ints. Please verify that the actual returned values match this new type to avoid potential type errors.
) -> list[list[int]]:

@HuggingFaceDocBuilderDev

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.

@qgallouedec qgallouedec merged commit 657f9ce into main Apr 2, 2025
8 of 10 checks passed
@qgallouedec qgallouedec deleted the fix-type-hint branch April 2, 2025 16:40
yxliu-TAMU pushed a commit to mincheolseong/ECEN743-GRPO-Project-Proposal that referenced this pull request Apr 20, 2025
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.

3 participants