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

[draft] Use vLLM in LogCompletionsCallback #2797

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tchang1997
Copy link

What does this PR do?

Implements changes to completion-logging callback suggested in #2786.

Normally, LogCompletionsCallback calls a helper function called _generate_completions. However, this uses the default model.generate, which can be slower than vLLM. This PR:

  • adds a helper called _generate_completions_vllm with equivalent functionality
  • adds a switch to on_step_end in LogCompletionsCallback to choose whether to use vLLM or not based on args.use_vllm from the Trainer
  • adds a utility function to [partially] convert the GenerationConfig normally passed to __init__ in the callback to SamplingParams compatible with vLLM.

I have not fully written tests yet (hence the draft), or fully checked compatibility with non-GRPOTrainer trainers, but this yields identical logging as the original LogCompletionsCallback in my own training scripts. Posting PR draft here for early feedback.

Fixes # (issue)

#2786

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.
  • [in progress] 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.

@tchang1997 tchang1997 marked this pull request as draft February 7, 2025 15:53
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.

1 participant